Skip to content

Commit b3312bf

Browse files
committed
fix: add a wait to make sure test does go without loading auth file
1 parent e3d4444 commit b3312bf

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

testing/e2e/src/helpers/fixtures.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,14 @@ export const test = base.extend<TestArgs, WorkerArgs>({
5757
async ({ getProjectMetadata }, use) => {
5858
return use(async () => {
5959
const authStorageFile = getProjectMetadata('authStorageFile');
60+
// Wait for auth file to exist with timeout
61+
let attempts = 0;
62+
while (!fs.existsSync(authStorageFile) && attempts < 50) {
63+
await new Promise((resolve) => setTimeout(resolve, 100));
64+
attempts++;
65+
}
6066
if (!fs.existsSync(authStorageFile)) {
61-
throw new Error(`Cannot get project auth: storage file does not exist: ${authStorageFile}`);
67+
throw new Error(`Cannot get project auth: storage file does not exist after waiting: ${authStorageFile}`);
6268
}
6369
return JSON.parse(await fs.promises.readFile(authStorageFile, 'utf8')) as ProjectAuth;
6470
});

0 commit comments

Comments
 (0)