Skip to content

Commit

Permalink
Fix dangling promise and open browser contexts
Browse files Browse the repository at this point in the history
  • Loading branch information
myieye committed Sep 20, 2022
1 parent 0bde046 commit ebc42d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion test/e2e/utils/globalSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ export default async function globalSetup(config: FullConfig) {
const browser = await projectBrowser.launch();
const context = await browser.newContext({ baseURL });
for (const user of usersToCreate) {
createUser(context.request, user);
await createUser(context.request, user);
}
await context.close();

// Now log in as each user and ensure there's a storage state saved
const sessionLifetime = 365 * 24 * 60 * 60 * 1000; // 1 year, in milliseconds
const now = new Date();
Expand All @@ -48,6 +50,7 @@ export default async function globalSetup(config: FullConfig) {
const page = await context.newPage();
await loginAs(page, user);
await context.storageState({ path });
await context.close();
}
}
}
3 changes: 2 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"max-classes-per-file": [false],
"radix": { "severity": "warning" },
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"],
"no-console": false
"no-console": false,
"no-floating-promises": true
}
}

0 comments on commit ebc42d4

Please sign in to comment.