Test onboarding visibility in production builds
All checks were successful
Deploy Sokko G / deploy (push) Successful in 19s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 19s
This commit is contained in:
parent
6de016ec7b
commit
713bc3b70e
9 changed files with 87 additions and 4 deletions
41
e2e/production/onboarding.spec.js
Normal file
41
e2e/production/onboarding.spec.js
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
// Rôle : vérifie la visibilité de la prise en main sur le vrai build après création et suppression persistées.
|
||||
import { test, expect } from "@playwright/test";
|
||||
import { readFile } from "node:fs/promises";
|
||||
|
||||
const site = JSON.parse(await readFile("website/public/data/site.json", "utf8"));
|
||||
|
||||
test("production home hides onboarding after creation and restores it after deleting the last toolbox", async ({ page }) => {
|
||||
const errors = [];
|
||||
page.on("pageerror", (error) => errors.push(error.message));
|
||||
await page.goto("/");
|
||||
const onboarding = page.getByRole("region", { name: site.home.onboarding.title, exact: true });
|
||||
await expect(onboarding).toBeVisible();
|
||||
await expect(page.locator('script[type="module"][src^="/assets/"]')).toHaveCount(1);
|
||||
await expect(page.locator('script[src*="/@vite/client"]')).toHaveCount(0);
|
||||
await onboarding.getByRole("button", { name: site.home.onboarding.primaryAction, exact: true }).click();
|
||||
const dialog = page.getByRole("dialog");
|
||||
await dialog.getByRole("textbox", { name: "Nom", exact: true }).fill("Production toolbox");
|
||||
await dialog.getByRole("button", { name: "Créer", exact: true }).click();
|
||||
await expect(page).toHaveURL(/#\/toolbox\//);
|
||||
await expect(page.locator('[data-module-type="memos"]')).toBeVisible();
|
||||
await expect(page.locator('[data-module-type="links"]')).toBeVisible();
|
||||
|
||||
await page.goto("/#/");
|
||||
await expect(page.getByRole("heading", { name: site.home.hero.title, exact: true })).toBeVisible();
|
||||
await expect(onboarding).toHaveCount(0);
|
||||
await page.reload();
|
||||
await expect(page.getByRole("heading", { name: site.home.hero.title, exact: true })).toBeVisible();
|
||||
await expect(onboarding).toHaveCount(0);
|
||||
await page.goto("/#/about");
|
||||
await expect(onboarding).toBeVisible();
|
||||
|
||||
await page.goto("/#/toolboxes");
|
||||
await page.getByRole("button", { name: "Supprimer Production toolbox", exact: true }).click();
|
||||
await page.getByRole("dialog").getByRole("button", { name: "Supprimer", exact: true }).click();
|
||||
await expect(page.locator(".toolbox-card")).toHaveCount(0);
|
||||
await page.goto("/#/");
|
||||
await expect(onboarding).toBeVisible();
|
||||
await page.reload();
|
||||
await expect(onboarding).toBeVisible();
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue