Skip to content

[ID-3586] test: mac pkce UI test #491

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jun 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,6 @@ sample/Assets/Vuplex*

__pycache__/
*.pyc
.pytest_cache/
.pytest_cache/

xcuserdata/
2 changes: 1 addition & 1 deletion Plugins/Mac/Sources/ImmutableWebView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -424,5 +424,5 @@ void _CImmutableWebViewPlugin_LaunchAuthURL(void *instance, const char *url, con
if (instance == NULL)
return;
CWebViewPlugin *webViewPlugin = (__bridge CWebViewPlugin *)instance;
[webViewPlugin launchAuthURL:url redirectUri: redirectUri];
[webViewPlugin launchAuthURL:url redirectUri:redirectUri];
}
1 change: 0 additions & 1 deletion Plugins/Mac/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,3 @@ mkdir -p $DSTDIR

cp -r DerivedData/ImmutableWebView.bundle $DSTDIR
rm -rf DerivedData
cp *.bundle.meta $DSTDIR
17 changes: 16 additions & 1 deletion sample/Assets/Editor/MacBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ private static void BuildPlayer(string defaultBuildPath, BuildOptions buildOptio
{
// Clean up AltTester settings after build
AltBuilder.RemoveAltTesterFromScriptingDefineSymbols(BuildTargetGroup.Standalone);

// Clean up custom e2e testing define
var defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
defineSymbols = defineSymbols.Replace("IMMUTABLE_E2E_TESTING;", "").Replace(";IMMUTABLE_E2E_TESTING", "").Replace("IMMUTABLE_E2E_TESTING", "");
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols);

RemoveAltFromScene(buildPlayerOptions.scenes[0]);
}
}
Expand Down Expand Up @@ -66,7 +72,7 @@ private static BuildPlayerOptions CreateBuildPlayerOptions(string buildPath, Bui
{
scenes = new[]
{
"Assets/Scenes/Passport/SelectAuthMethod.unity",
"Assets/Scenes/Passport/Initialisation.unity",
"Assets/Scenes/Passport/UnauthenticatedScene.unity",
"Assets/Scenes/Passport/AuthenticatedScene.unity",
"Assets/Scenes/Passport/ZkEvm/ZkEvmGetBalance.unity",
Expand All @@ -85,6 +91,15 @@ private static BuildPlayerOptions CreateBuildPlayerOptions(string buildPath, Bui
private static void SetupAltTester(BuildPlayerOptions buildPlayerOptions)
{
AltBuilder.AddAltTesterInScriptingDefineSymbolsGroup(BuildTargetGroup.Standalone);

// Add custom define for e2e testing to enable default browser behavior
var defineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone);
if (!defineSymbols.Contains("IMMUTABLE_E2E_TESTING"))
{
defineSymbols += ";IMMUTABLE_E2E_TESTING";
PlayerSettings.SetScriptingDefineSymbolsForGroup(BuildTargetGroup.Standalone, defineSymbols);
}

AltBuilder.CreateJsonFileForInputMappingOfAxis();

var instrumentationSettings = new AltInstrumentationSettings();
Expand Down
2 changes: 1 addition & 1 deletion sample/Assets/Editor/MobileBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ private static BuildPlayerOptions CreateBuildPlayerOptions(string buildPath, Bui
{
scenes = new[]
{
"Assets/Scenes/Passport/SelectAuthMethod.unity",
"Assets/Scenes/Passport/Initialisation.unity",
"Assets/Scenes/Passport/UnauthenticatedScene.unity",
"Assets/Scenes/Passport/AuthenticatedScene.unity",
"Assets/Scenes/Passport/ZkEvm/ZkEvmGetBalance.unity",
Expand Down
2 changes: 1 addition & 1 deletion sample/Assets/Editor/WindowsBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ private static BuildPlayerOptions CreateBuildPlayerOptions(string buildPath, Bui
{
scenes = new[]
{
"Assets/Scenes/Passport/SelectAuthMethod.unity",
"Assets/Scenes/Passport/Initialisation.unity",
"Assets/Scenes/Passport/UnauthenticatedScene.unity",
"Assets/Scenes/Passport/AuthenticatedScene.unity",
"Assets/Scenes/Passport/ZkEvm/ZkEvmGetBalance.unity",
Expand Down
6 changes: 3 additions & 3 deletions sample/Assets/Scenes/Passport/Initialisation.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1128,7 +1128,7 @@ MonoBehaviour:
m_TargetGraphic: {fileID: 167431872}
m_HandleRect: {fileID: 167431871}
m_Direction: 2
m_Value: 1
m_Value: 0
m_Size: 1
m_NumberOfSteps: 0
m_OnValueChanged:
Expand Down Expand Up @@ -1398,8 +1398,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 1108.9248, y: 0}
m_SizeDelta: {x: 2177.8496, y: 0}
m_AnchoredPosition: {x: 1801.0891, y: 0}
m_SizeDelta: {x: 3562.1782, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1661390145
MonoBehaviour:
Expand Down
4 changes: 2 additions & 2 deletions sample/Assets/Scripts/Passport/Login/LoginScript.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ public async void Login()
await Passport.Login();
SceneManager.LoadScene("AuthenticatedScene");
}
catch (OperationCanceledException)
catch (OperationCanceledException ex)
{
ShowOutput("Failed to login: cancelled");
ShowOutput($"Failed to login: cancelled {ex.Message}\\n{ex.StackTrace}");
}
catch (Exception ex)
{
Expand Down
5 changes: 3 additions & 2 deletions sample/ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ PlayerSettings:
androidFullscreenMode: 1
defaultIsNativeResolution: 1
macRetinaSupport: 0
runInBackground: 0
runInBackground: 1
captureSingleScreen: 0
muteOtherAudioSources: 0
Prepare IOS For Recording: 0
Expand Down Expand Up @@ -222,7 +222,8 @@ PlayerSettings:
iOSDeviceRequirements: []
iOSURLSchemes:
- immutablerunner
macOSURLSchemes: []
macOSURLSchemes:
- immutablerunner
iOSBackgroundModes: 0
iOSMetalForceHardShadows: 0
metalEditorSupport: 1
Expand Down
4 changes: 1 addition & 3 deletions sample/Tests/requirements-desktop.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
AltTester_Driver==2.1.1
google_api_python_client==2.136.0
google_auth_oauthlib==1.2.0
AltTester-Driver==2.1.1
protobuf==5.27.2
selenium==4.22.0
pytest==8.2.2
Expand Down
4 changes: 1 addition & 3 deletions sample/Tests/requirements-mobile.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
AltTester_Driver==2.1.1
google_api_python_client==2.136.0
google_auth_oauthlib==1.2.0
AltTester-Driver==2.1.1
protobuf==5.27.2
selenium==4.22.0
pytest==8.2.2
Expand Down
1 change: 1 addition & 0 deletions sample/Tests/test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_2_imx_functions(self):

# Connect to IMX
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
time.sleep(5)
text = output.get_text()
print(f"ConnectBtn output: {text}")
self.assertEqual("Connected to IMX", text)
Expand Down
1 change: 1 addition & 0 deletions sample/Tests/test/test_android.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_6_pkce_relogin(self):

# Click Connect to IMX button
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
time.sleep(5)
self.assertEqual("Connected to IMX", output.get_text())

self.altdriver.stop()
Expand Down
Loading
Loading