Skip to content

Commit

Permalink
use persistentContext for setup also
Browse files Browse the repository at this point in the history
  • Loading branch information
sidvishnoi committed Sep 12, 2024
1 parent c0f1f49 commit 263586d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/e2e/auth.setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test as setup, expect } from '@playwright/test';
import { test as setup, expect } from './fixtures/base';
import { authFile } from './fixtures/helpers';

// Authenticate with wallet once in "setup" so we don't have to do it over and
Expand Down
8 changes: 7 additions & 1 deletion tests/e2e/fixtures/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,13 @@ export async function loadContext({ browserName, channel }: BrowserInfo) {

// Note that loading this directly via config -> use({ storageState }) doesn't
// work correctly with our browser context. So, we addCookies manually.
const { cookies } = await readFile(authFile, 'utf8').then(JSON.parse);
const { cookies } = await readFile(authFile, 'utf8')
.then(JSON.parse)
.catch(() => {
// eslint-disable-next-line no-console
console.log('loadContext: authFile does not exist');
return { cookies: [] };
});
await context.addCookies(cookies);

return context;
Expand Down

0 comments on commit 263586d

Please sign in to comment.