File tree Expand file tree Collapse file tree 2 files changed +25
-4
lines changed
Expand file tree Collapse file tree 2 files changed +25
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ buildscript {
2121 allprojects {
2222 repositories {
2323 maven {
24- url(" $rootDir /../node_modules/detox/Detox-android" )
24+ url(" $rootDir /../../../ node_modules/detox/Detox-android" )
2525 }
2626 }
2727 }
Original file line number Diff line number Diff line change @@ -14,9 +14,7 @@ describe('Raw queries', () => {
1414 . label ;
1515 testCount = Number ( testCounterLabel ) ;
1616
17- await waitFor ( element ( by . text ( '⏳' ) ) )
18- . not . toBeVisible ( )
19- . withTimeout ( 20000 ) ;
17+ await waitForAllLoadingIndicatorsToDisappear ( 30000 ) ;
2018 } ) ;
2119
2220 // Since tests need to be defined statically, we need to use a loop to evaluate the tests dynamically
@@ -91,3 +89,26 @@ describe('Raw queries', () => {
9189async function getText ( element : IndexableNativeElement ) : Promise < string > {
9290 return ( ( await element . getAttributes ( ) ) as any ) . label as string ;
9391}
92+
93+ // Custom wait for function as Detox' waitFor() does not work with multiple elements
94+ async function waitForAllLoadingIndicatorsToDisappear ( timeout = 20000 ) {
95+ const startTime = Date . now ( ) ;
96+
97+ while ( Date . now ( ) - startTime < timeout ) {
98+ try {
99+ await expect ( element ( by . text ( '⏳' ) ) ) . not . toExist ( ) ;
100+
101+ // If we reach here, all indicators are gone
102+ return true ;
103+ } catch ( error ) {
104+ // If error, some indicators still exist
105+ console . log ( 'Loading indicators still present, waiting...' ) ;
106+
107+ await new Promise ( resolve => setTimeout ( resolve , 500 ) ) ;
108+ }
109+ }
110+
111+ throw new Error (
112+ `All loading indicators did not disappear within ${ timeout } ms` ,
113+ ) ;
114+ }
You can’t perform that action at this time.
0 commit comments