Skip to content

Commit 6c195b4

Browse files
committed
test: remove device code auth from windows test
1 parent 7dc1068 commit 6c195b4

File tree

2 files changed

+8
-31
lines changed

2 files changed

+8
-31
lines changed

sample/Tests/test/test_windows.py

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,7 @@ def restart_app_and_altdriver(self):
2525
time.sleep(5) # Give time for the app to open
2626
self.start_altdriver()
2727

28-
def select_auth_type(self, use_pkce: bool):
29-
auth_type = "PKCE" if use_pkce else "DeviceCodeAuth"
30-
self.get_altdriver().find_object(By.NAME, auth_type).tap()
31-
32-
def login(self, use_pkce: bool):
33-
self.select_auth_type(use_pkce)
34-
28+
def login(self):
3529
# Wait for unauthenticated screen
3630
self.get_altdriver().wait_for_current_scene_to_be("UnauthenticatedScene")
3731

@@ -46,7 +40,7 @@ def login(self, use_pkce: bool):
4640
launch_browser()
4741
bring_sample_app_to_foreground()
4842
login_button.tap()
49-
login(use_pkce)
43+
login()
5044
bring_sample_app_to_foreground()
5145

5246
# Wait for authenticated screen
@@ -88,12 +82,8 @@ def login(self, use_pkce: bool):
8882
else:
8983
raise SystemExit(f"Failed to reset app {err}")
9084

91-
def test_1a_pkce_login(self):
92-
self.login(True)
93-
94-
def test_1b_device_code_login(self):
95-
self.restart_app_and_altdriver()
96-
self.login(False)
85+
def test_1_login(self):
86+
self.login()
9787

9888
def test_2_other_functions(self):
9989
self.test_0_other_functions()
@@ -110,9 +100,6 @@ def test_5_zkevm_functions(self):
110100
def test_6_relogin(self):
111101
self.restart_app_and_altdriver()
112102

113-
# Select use device code auth
114-
self.select_auth_type(use_pkce=False)
115-
116103
# Relogin
117104
print("Re-logging in...")
118105
self.get_altdriver().wait_for_object(By.NAME, "ReloginBtn").tap()
@@ -130,12 +117,9 @@ def test_6_relogin(self):
130117
self.get_altdriver().find_object(By.NAME, "ConnectBtn").tap()
131118
self.assertEqual("Connected to IMX", output.get_text())
132119

133-
def test_7_reconnect_device_code_connect_imx(self):
120+
def test_7_reconnect_connect_imx(self):
134121
self.restart_app_and_altdriver()
135122

136-
use_pkce = False
137-
self.select_auth_type(use_pkce)
138-
139123
# Reconnect
140124
print("Reconnecting...")
141125
self.get_altdriver().wait_for_object(By.NAME, "ReconnectBtn").tap()
@@ -171,7 +155,7 @@ def test_7_reconnect_device_code_connect_imx(self):
171155
launch_browser()
172156
bring_sample_app_to_foreground()
173157
self.get_altdriver().wait_for_object(By.NAME, "ConnectBtn").tap()
174-
login(use_pkce)
158+
login()
175159
bring_sample_app_to_foreground()
176160

177161
# Wait for authenticated screen

sample/Tests/test/test_windows_helpers.py

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def get_product_name():
3939
# If regex fails, return default
4040
return "SampleApp"
4141

42-
def login(use_pkce: bool):
42+
def login():
4343
print("Connect to Chrome")
4444
# Set up Chrome options to connect to the existing Chrome instance
4545
chrome_options = Options()
@@ -65,12 +65,6 @@ def login(use_pkce: bool):
6565

6666
wait = WebDriverWait(driver, 60)
6767

68-
if not use_pkce:
69-
print("Wait for device confirmation...")
70-
contine_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[span[text()='Continue']]")))
71-
contine_button.click()
72-
print("Confirmed device")
73-
7468
print("Wait for email input...")
7569
email_field = wait.until(EC.presence_of_element_located((By.ID, ':r1:')))
7670
print("Enter email...")
@@ -96,8 +90,7 @@ def login(use_pkce: bool):
9690
otp_field.send_keys(code)
9791

9892
print("Wait for success page...")
99-
success_title = 'h1[data-testid="checking_title"]' if use_pkce else 'h1[data-testid="device_success_title"]'
100-
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, success_title)))
93+
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'h1[data-testid="checking_title"]')))
10194
print("Connected to Passport!")
10295

10396
driver.quit()

0 commit comments

Comments
 (0)