| Conditions | 1 |
| Total Lines | 23 |
| Code Lines | 21 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { expect, firefox, type FullConfig, type Browser } from "@playwright/test"; |
||
| 14 | |||
| 15 | async function saveAuthenticatedState( |
||
| 16 | browser: Browser, |
||
| 17 | config: FullConfig, |
||
| 18 | email: string, |
||
| 19 | password: string, |
||
| 20 | path: string |
||
| 21 | ) { |
||
| 22 | const page = await browser.newPage({ |
||
| 23 | baseURL: config.projects[0].use.baseURL, |
||
| 24 | }); |
||
| 25 | await page.goto("/login"); |
||
| 26 | |||
| 27 | await page.getByLabel("Adresse email").fill(email); |
||
| 28 | await page.getByLabel("Mot de passe").fill(password); |
||
| 29 | await page.getByText("Se connecter").click(); |
||
| 30 | |||
| 31 | const response = await page.waitForResponse("**/api/login"); |
||
| 32 | expect(response.status()).toBe(201); |
||
| 33 | |||
| 34 | await page.context().storageState({ path }); |
||
| 35 | |||
| 36 | await page.close(); |
||
| 37 | } |
||
| 38 |