Skip to content

Commit 9047ac1

Browse files
committed
Fixing Android test suite. Prepping for Github workflow.
1 parent a0ba3b0 commit 9047ac1

File tree

2 files changed

+25
-4
lines changed

2 files changed

+25
-4
lines changed

tools/powersynctests/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

tools/powersynctests/e2e/rawQueries.test.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff 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', () => {
9189
async 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+
}

0 commit comments

Comments
 (0)