extend Page element to login for all tests
This commit is contained in:
@@ -4,10 +4,18 @@ import { createWorkerFixture } from 'playwright-msw';
|
||||
import { handlers } from './src/mocks/e2e-handlers';
|
||||
|
||||
import type { MockServiceWorker } from 'playwright-msw';
|
||||
|
||||
const test = base.extend<{
|
||||
worker: MockServiceWorker;
|
||||
}>({
|
||||
worker: createWorkerFixture(...handlers),
|
||||
page: async ({ page }, use) => {
|
||||
// Set is-authenticated in sessionStorage to true
|
||||
await page.addInitScript(`window.sessionStorage.setItem('is-authenticated', 'true');`);
|
||||
|
||||
// Use signed-in page in all tests
|
||||
await use(page);
|
||||
},
|
||||
});
|
||||
|
||||
export { test, expect };
|
||||
|
||||
Reference in New Issue
Block a user