Skip to content

Commit 8cb65d0

Browse files
committed
test: fix windows login tab
1 parent 803d8c1 commit 8cb65d0

File tree

5 files changed

+31
-8
lines changed

5 files changed

+31
-8
lines changed

sample/Tests/test/test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ def test_2_imx_functions(self):
9393

9494
# Connect to IMX
9595
self.altdriver.find_object(By.NAME, "ConnectBtn").tap()
96+
time.sleep(5)
9697
text = output.get_text()
9798
print(f"ConnectBtn output: {text}")
9899
self.assertEqual("Connected to IMX", text)

sample/Tests/test/test_android.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ def test_6_pkce_relogin(self):
142142

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

147148
self.altdriver.stop()

sample/Tests/test/test_mac.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ def test_6_relogin(self):
221221

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

226227
self.altdriver.stop()

sample/Tests/test/test_windows.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ def test_6_relogin(self):
115115

116116
# Click Connect to IMX button
117117
self.get_altdriver().find_object(By.NAME, "ConnectBtn").tap()
118+
time.sleep(5)
118119
self.assertEqual("Connected to IMX", output.get_text())
119120

120121
def test_7_reconnect_connect_imx(self):

sample/Tests/test/test_windows_helpers.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,30 @@ def login():
5656

5757
# Get all window handles
5858
all_windows = driver.window_handles
59-
60-
print("Find the new window")
61-
new_window = [window for window in all_windows if window != driver.current_window_handle][0]
62-
63-
print("Switch to the new window")
64-
driver.switch_to.window(new_window)
59+
60+
print(f"Found {len(all_windows)} new windows to check: {all_windows}")
61+
62+
# Find the window with email input
63+
target_window = None
64+
for window in all_windows:
65+
try:
66+
print(f"Checking window: {window}")
67+
driver.switch_to.window(window)
68+
driver.find_element(By.ID, ':r1:')
69+
target_window = window
70+
print(f"Found email input in window: {window}")
71+
break
72+
except:
73+
print(f"Email input not found in window: {window}, trying next...")
74+
continue
75+
76+
if not target_window:
77+
print("Could not find email input field in any window!")
78+
driver.quit()
79+
return
80+
81+
print("Switch to the target window")
82+
driver.switch_to.window(target_window)
6583

6684
wait = WebDriverWait(driver, 60)
6785

@@ -126,8 +144,9 @@ def bring_sample_app_to_foreground():
126144

127145
command = [
128146
"powershell.exe",
129-
"-Command",
130-
f"Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process; & '{powershell_script_path}' -appName '{product_name}'"
147+
"-ExecutionPolicy", "Bypass",
148+
"-File", powershell_script_path,
149+
"-appName", product_name
131150
]
132151

133152
subprocess.run(command, check=True)

0 commit comments

Comments
 (0)