34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
import {expect, test} from "@playwright/test";
|
||
|
||
import {login} from "./helpers";
|
||
|
||
test("la connexion refuse un mauvais mot de passe", async ({page}) => {
|
||
await page.goto("/");
|
||
await page.getByLabel("Nom d’utilisateur").fill("admin");
|
||
await page.getByLabel("Mot de passe").fill("faux");
|
||
await page.getByRole("button", {name: "Se connecter"}).click();
|
||
await expect(page.getByText("Identifiants incorrects")).toBeVisible();
|
||
await expect(page.getByRole("button", {name: "Se connecter"})).toBeVisible();
|
||
});
|
||
|
||
test("la connexion réussie mène au tableau de bord, la déconnexion revient au login", async ({
|
||
page,
|
||
}) => {
|
||
await login(page);
|
||
await expect(page.getByRole("button", {name: "Tableau de bord"})).toBeVisible();
|
||
|
||
// Menu utilisateur: theme + déconnexion.
|
||
await page.getByRole("button", {name: "Menu utilisateur"}).click();
|
||
await page.getByRole("menuitem", {name: "Déconnexion"}).click();
|
||
await expect(page.getByRole("button", {name: "Se connecter"})).toBeVisible();
|
||
});
|
||
|
||
test("le basculement de thème persiste", async ({page}) => {
|
||
await login(page);
|
||
await page.getByRole("button", {name: "Menu utilisateur"}).click();
|
||
await page.getByRole("menuitem", {name: "Passer en thème clair"}).click();
|
||
await expect(page.locator("html")).toHaveAttribute("data-theme", "light");
|
||
await page.reload();
|
||
await expect(page.locator("html")).toHaveAttribute("data-theme", "light");
|
||
});
|