frontend/tests/auth.setup.ts.disabled (view raw)
1import {test as setup, expect} from '@playwright/test';
2
3const email = process.env.TEST_EMAIL || '';
4const password = process.env.TEST_PASSWORD || '';
5
6const authFile = 'tests/playwright/.auth/user.json';
7
8setup('authenticate', async ({page}) => {
9 await page.goto('/fr/auth/login');
10 await page.getByLabel('Email').click();
11 await page.getByLabel('Email').fill(email);
12 await page.getByLabel('Email').press('Tab');
13 await page.locator('input[name="password"]').fill(password);
14 await page.getByRole('button', {name: 'Se connecter'}).click();
15 await page.waitForURL('/fr/dashboard/');
16
17 await expect(
18 page.getByRole('heading', {name: 'Mes Carosters'})
19 ).toBeVisible();
20
21 await page.context().storageState({path: authFile});
22});