From 98a00b3cb9e86fc0c481b41d0d5d2c745da34550 Mon Sep 17 00:00:00 2001 From: Nik Ho Date: Tue, 12 Aug 2025 18:45:06 +1200 Subject: [PATCH 1/4] ci: keep browser alive for Unity deep link redirect in tests --- sample/.gitignore | 3 ++- sample/Tests/test/test_windows_helpers.py | 11 ++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sample/.gitignore b/sample/.gitignore index da85648b0..276e7baa5 100644 --- a/sample/.gitignore +++ b/sample/.gitignore @@ -1,3 +1,4 @@ **/Payload.ipa **/logFile.log -**/local.log \ No newline at end of file +**/local.log +venv/ diff --git a/sample/Tests/test/test_windows_helpers.py b/sample/Tests/test/test_windows_helpers.py index 48ef6f619..3d8115c46 100644 --- a/sample/Tests/test/test_windows_helpers.py +++ b/sample/Tests/test/test_windows_helpers.py @@ -56,9 +56,9 @@ def login(): # Get all window handles all_windows = driver.window_handles - + print(f"Found {len(all_windows)} new windows to check: {all_windows}") - + # Find the window with email input target_window = None for window in all_windows: @@ -72,12 +72,12 @@ def login(): except: print(f"Email input not found in window: {window}, trying next...") continue - + if not target_window: print("Could not find email input field in any window!") driver.quit() return - + print("Switch to the target window") driver.switch_to.window(target_window) @@ -111,7 +111,8 @@ def login(): wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'h1[data-testid="checking_title"]'))) print("Connected to Passport!") - driver.quit() + # Keep browser alive for Unity deep link redirect + # driver.quit() def open_sample_app(): product_name = get_product_name() From a57cd8629b685a7331b2823546746c42e73a18fd Mon Sep 17 00:00:00 2001 From: Nik Ho Date: Tue, 12 Aug 2025 19:20:18 +1200 Subject: [PATCH 2/4] ci: use stable data-testid selector for email input field --- sample/Packages/packages-lock.json | 5 ++++- sample/Tests/test/test_windows_helpers.py | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/sample/Packages/packages-lock.json b/sample/Packages/packages-lock.json index c10c870a9..ff081b89e 100644 --- a/sample/Packages/packages-lock.json +++ b/sample/Packages/packages-lock.json @@ -36,7 +36,10 @@ "source": "local", "dependencies": { "com.unity.nuget.newtonsoft-json": "3.2.0", - "com.cysharp.unitask": "2.3.3" + "com.cysharp.unitask": "2.3.1", + "com.unity.modules.unitywebrequest": "1.0.0", + "com.unity.modules.jsonserialize": "1.0.0", + "com.unity.modules.androidjni": "1.0.0" } }, "com.unity.ai.navigation": { diff --git a/sample/Tests/test/test_windows_helpers.py b/sample/Tests/test/test_windows_helpers.py index 3d8115c46..e082f52c5 100644 --- a/sample/Tests/test/test_windows_helpers.py +++ b/sample/Tests/test/test_windows_helpers.py @@ -65,7 +65,7 @@ def login(): try: print(f"Checking window: {window}") driver.switch_to.window(window) - driver.find_element(By.ID, ':r1:') + driver.find_element(By.CSS_SELECTOR, '[data-testid="TextInput__input"]') target_window = window print(f"Found email input in window: {window}") break @@ -84,7 +84,7 @@ def login(): wait = WebDriverWait(driver, 60) print("Wait for email input...") - email_field = wait.until(EC.presence_of_element_located((By.ID, ':r1:'))) + email_field = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '[data-testid="TextInput__input"]'))) print("Enter email...") email_field.send_keys(EMAIL) email_field.send_keys(Keys.RETURN) From 9901fb93b7bc4a021daeaf8a3985137915cec3f4 Mon Sep 17 00:00:00 2001 From: ImmutableJeffrey Date: Tue, 12 Aug 2025 22:46:33 +1000 Subject: [PATCH 3/4] Revert "ci: keep browser alive for Unity deep link redirect in tests" This reverts commit 98a00b3cb9e86fc0c481b41d0d5d2c745da34550. --- sample/.gitignore | 3 +-- sample/Tests/test/test_windows_helpers.py | 11 +++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/sample/.gitignore b/sample/.gitignore index 276e7baa5..da85648b0 100644 --- a/sample/.gitignore +++ b/sample/.gitignore @@ -1,4 +1,3 @@ **/Payload.ipa **/logFile.log -**/local.log -venv/ +**/local.log \ No newline at end of file diff --git a/sample/Tests/test/test_windows_helpers.py b/sample/Tests/test/test_windows_helpers.py index e082f52c5..d98df0382 100644 --- a/sample/Tests/test/test_windows_helpers.py +++ b/sample/Tests/test/test_windows_helpers.py @@ -56,9 +56,9 @@ def login(): # Get all window handles all_windows = driver.window_handles - + print(f"Found {len(all_windows)} new windows to check: {all_windows}") - + # Find the window with email input target_window = None for window in all_windows: @@ -72,12 +72,12 @@ def login(): except: print(f"Email input not found in window: {window}, trying next...") continue - + if not target_window: print("Could not find email input field in any window!") driver.quit() return - + print("Switch to the target window") driver.switch_to.window(target_window) @@ -111,8 +111,7 @@ def login(): wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'h1[data-testid="checking_title"]'))) print("Connected to Passport!") - # Keep browser alive for Unity deep link redirect - # driver.quit() + driver.quit() def open_sample_app(): product_name = get_product_name() From 7d623bd7c2a3d0089b4c85b8dd612924b4615d7e Mon Sep 17 00:00:00 2001 From: ImmutableJeffrey Date: Wed, 13 Aug 2025 00:38:31 +1000 Subject: [PATCH 4/4] Revert "ci: use stable data-testid selector for email input field" This reverts commit a57cd8629b685a7331b2823546746c42e73a18fd. --- sample/Packages/packages-lock.json | 5 +---- sample/Tests/test/test_windows_helpers.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/sample/Packages/packages-lock.json b/sample/Packages/packages-lock.json index ff081b89e..c10c870a9 100644 --- a/sample/Packages/packages-lock.json +++ b/sample/Packages/packages-lock.json @@ -36,10 +36,7 @@ "source": "local", "dependencies": { "com.unity.nuget.newtonsoft-json": "3.2.0", - "com.cysharp.unitask": "2.3.1", - "com.unity.modules.unitywebrequest": "1.0.0", - "com.unity.modules.jsonserialize": "1.0.0", - "com.unity.modules.androidjni": "1.0.0" + "com.cysharp.unitask": "2.3.3" } }, "com.unity.ai.navigation": { diff --git a/sample/Tests/test/test_windows_helpers.py b/sample/Tests/test/test_windows_helpers.py index d98df0382..48ef6f619 100644 --- a/sample/Tests/test/test_windows_helpers.py +++ b/sample/Tests/test/test_windows_helpers.py @@ -65,7 +65,7 @@ def login(): try: print(f"Checking window: {window}") driver.switch_to.window(window) - driver.find_element(By.CSS_SELECTOR, '[data-testid="TextInput__input"]') + driver.find_element(By.ID, ':r1:') target_window = window print(f"Found email input in window: {window}") break @@ -84,7 +84,7 @@ def login(): wait = WebDriverWait(driver, 60) print("Wait for email input...") - email_field = wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, '[data-testid="TextInput__input"]'))) + email_field = wait.until(EC.presence_of_element_located((By.ID, ':r1:'))) print("Enter email...") email_field.send_keys(EMAIL) email_field.send_keys(Keys.RETURN)