From 263586d4fd6348511833a2d11d2a4a1e13fbff74 Mon Sep 17 00:00:00 2001 From: Sid Vishnoi <8426945+sidvishnoi@users.noreply.github.com> Date: Thu, 12 Sep 2024 20:00:43 +0530 Subject: [PATCH] use persistentContext for setup also --- tests/e2e/auth.setup.ts | 2 +- tests/e2e/fixtures/helpers.ts | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/e2e/auth.setup.ts b/tests/e2e/auth.setup.ts index db6b0ccd..b7f1bda9 100644 --- a/tests/e2e/auth.setup.ts +++ b/tests/e2e/auth.setup.ts @@ -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 diff --git a/tests/e2e/fixtures/helpers.ts b/tests/e2e/fixtures/helpers.ts index 753124cf..01c1667c 100644 --- a/tests/e2e/fixtures/helpers.ts +++ b/tests/e2e/fixtures/helpers.ts @@ -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;