Skip to content

Commit f2d5334

Browse files
nattb8ImmutableJeffrey
authored andcommitted
test: remove device code auth from windows test
1 parent f3726eb commit f2d5334

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()
@@ -131,12 +118,9 @@ def test_6_relogin(self):
131118
time.sleep(5)
132119
self.assertEqual("Connected to IMX", output.get_text())
133120

134-
def test_7_reconnect_device_code_connect_imx(self):
121+
def test_7_reconnect_connect_imx(self):
135122
self.restart_app_and_altdriver()
136123

137-
use_pkce = False
138-
self.select_auth_type(use_pkce)
139-
140124
# Reconnect
141125
print("Reconnecting...")
142126
self.get_altdriver().wait_for_object(By.NAME, "ReconnectBtn").tap()
@@ -172,7 +156,7 @@ def test_7_reconnect_device_code_connect_imx(self):
172156
launch_browser()
173157
bring_sample_app_to_foreground()
174158
self.get_altdriver().wait_for_object(By.NAME, "ConnectBtn").tap()
175-
login(use_pkce)
159+
login()
176160
bring_sample_app_to_foreground()
177161

178162
# 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()
@@ -91,12 +91,6 @@ def login(use_pkce: bool):
9191

9292
wait = WebDriverWait(driver, 60)
9393

94-
if not use_pkce:
95-
print("Wait for device confirmation...")
96-
contine_button = wait.until(EC.element_to_be_clickable((By.XPATH, "//button[span[text()='Continue']]")))
97-
contine_button.click()
98-
print("Confirmed device")
99-
10094
print("Wait for email input...")
10195
email_field = wait.until(EC.presence_of_element_located((By.ID, ':r1:')))
10296
print("Enter email...")
@@ -122,8 +116,7 @@ def login(use_pkce: bool):
122116
otp_field.send_keys(code)
123117

124118
print("Wait for success page...")
125-
success_title = 'h1[data-testid="checking_title"]' if use_pkce else 'h1[data-testid="device_success_title"]'
126-
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, success_title)))
119+
wait.until(EC.presence_of_element_located((By.CSS_SELECTOR, 'h1[data-testid="checking_title"]')))
127120
print("Connected to Passport!")
128121

129122
driver.quit()

0 commit comments

Comments
 (0)