@@ -20,6 +20,9 @@ def tearDownClass(cls):
2020 stop_sample_app ()
2121
2222 def test_1_device_code_login (self ):
23+ # Select use device code auth
24+ self .altdriver .find_object (By .NAME , "DeviceCodeAuth" ).tap ()
25+
2326 # Wait for unauthenticated screen
2427 self .altdriver .wait_for_current_scene_to_be ("UnauthenticatedScene" )
2528
@@ -48,9 +51,12 @@ def test_1_device_code_login(self):
4851 if attempt == 0 :
4952 # Reset app
5053
51- # Relogin
54+ # Relogin (optional: only if the button is present)
5255 print ("Try reset the app and log out once..." )
53- self .altdriver .wait_for_object (By .NAME , "ReloginBtn" ).tap ()
56+ try :
57+ self .altdriver .wait_for_object (By .NAME , "ReloginBtn" ).tap ()
58+ except Exception as e :
59+ print ("ReloginBtn not found, skipping relogin step. User may already be in AuthenticatedScene." )
5460
5561 # Wait for authenticated screen
5662 self .altdriver .wait_for_current_scene_to_be ("AuthenticatedScene" )
@@ -95,6 +101,9 @@ def test_6_relogin(self):
95101 self .altdriver = AltDriver ()
96102 time .sleep (5 )
97103
104+ # Select use device code auth
105+ self .altdriver .find_object (By .NAME , "DeviceCodeAuth" ).tap ()
106+
98107 # Relogin
99108 print ("Re-logging in..." )
100109 self .altdriver .wait_for_object (By .NAME , "ReloginBtn" ).tap ()
@@ -124,6 +133,9 @@ def test_7_reconnect_device_code_connect_imx(self):
124133 self .altdriver = AltDriver ()
125134 time .sleep (5 )
126135
136+ # Select use device code auth
137+ self .altdriver .find_object (By .NAME , "DeviceCodeAuth" ).tap ()
138+
127139 # Reconnect
128140 print ("Reconnecting..." )
129141 self .altdriver .wait_for_object (By .NAME , "ReconnectBtn" ).tap ()
0 commit comments