Created
March 5, 2022 06:46
-
-
Save itaditya/9d57918cc9c94e2875d75869e079e519 to your computer and use it in GitHub Desktop.
Demo Auth Storage
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { test } from '@playwright/test'; | |
test.describe('When user logged-out', () => { | |
test('Test login page @flow=auth', async ({ page, context }) => { | |
await page.goto('https://remix-jokes.lol/login'); | |
await page.locator('input[name="username"]').fill('itaditya'); | |
await page.locator('input[name="password"]').fill('random'); | |
await Promise.all([page.waitForNavigation(), page.locator('text=Submit').click()]); | |
context.storageState({ | |
path: 'jokesAuth.json', | |
}); | |
}); | |
}); | |
test.describe('When user logged-in @flow=app', () => { | |
test.use({ | |
storageState: 'jokesAuth.json', | |
}); | |
test('Test jokes page', async ({ page }) => { | |
await page.goto('https://remix-jokes.lol/jokes'); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment