File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,7 +27,22 @@ class MacTest(UnityTest):
2727 @classmethod
2828 def setUpClass (cls ):
2929 open_sample_app ()
30- cls .altdriver = AltDriver ()
30+ time .sleep (10 ) # Increased wait time for app initialization
31+
32+ # Retry logic for AltDriver connection
33+ max_attempts = 3
34+ for attempt in range (max_attempts ):
35+ try :
36+ cls .altdriver = AltDriver ()
37+ print (f"AltDriver connected successfully on attempt { attempt + 1 } " )
38+ break
39+ except Exception as e :
40+ if attempt == max_attempts - 1 :
41+ print (f"Failed to connect to AltDriver after { max_attempts } attempts" )
42+ raise
43+ print (f"Attempt { attempt + 1 } failed: { str (e )} , retrying in 5s..." )
44+ time .sleep (5 )
45+
3146 cls .stop_browser ()
3247
3348 @classmethod
Original file line number Diff line number Diff line change @@ -20,9 +20,22 @@ class WindowsTest(UnityTest):
2020 def setUpClass (cls ):
2121 # Clear cached login state at the start of the test suite
2222 open_sample_app (clear_data = True )
23- time .sleep (5 ) # Give time for the app to open
24- # Initialize AltDriver with longer timeout for flaky CI environment
25- cls .altdriver = AltDriver (timeout = 120 ) # 120 seconds instead of default 20
23+ time .sleep (10 ) # Increased wait time for app initialization
24+
25+ # Retry logic for AltDriver connection
26+ max_attempts = 3
27+ for attempt in range (max_attempts ):
28+ try :
29+ # Initialize AltDriver with longer timeout for flaky CI environment
30+ cls .altdriver = AltDriver (timeout = 120 ) # 120 seconds instead of default 20
31+ print (f"AltDriver connected successfully on attempt { attempt + 1 } " )
32+ break
33+ except Exception as e :
34+ if attempt == max_attempts - 1 :
35+ print (f"Failed to connect to AltDriver after { max_attempts } attempts" )
36+ raise
37+ print (f"Attempt { attempt + 1 } failed: { str (e )} , retrying in 5s..." )
38+ time .sleep (5 )
2639
2740 @classmethod
2841 def tearDownClass (cls ):
You can’t perform that action at this time.
0 commit comments