Tests navigateur : accueil, tutoriel, aide, installation, mise à jour ; plan : résultat

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Pierre MARTIN
2026-11-09 15:35:00 +01:00
co-authored by Claude Opus 5.5
parent 441bca1bd7
commit 5fdca812d9
7 changed files with 644 additions and 30 deletions
+25 -6
View File
@@ -638,6 +638,9 @@ async function screenOf(tab) {
term: document.querySelector("#help-glossary dt.current")?.id ?? null,
menu: shown("menu"),
games: shown("games"),
home: shown("home"),
tutorial: shown("tutorial"),
install: shown("install-sheet"),
listed: document.querySelectorAll("#games .games-item").length,
expanded:
document
@@ -708,17 +711,19 @@ async function checkAddresses() {
let question = null;
let gameId = null;
let gamesBefore = 0;
const notYet = (s) => s.hash === "#/" && s.game && s.info.includes("n'existe pas encore");
const addresses = [
["#/", playing],
["#/accueil", notYet],
["#/accueil", (s) => s.home && !s.game && !s.tutorial],
["#/aide", (s) => s.help && s.play && !s.glossary && !s.about && s.question === null],
[() => `#/aide/${question}`, (s) => s.help && s.play && s.question === `aide-${question}`],
["#/glossaire", (s) => s.help && s.glossary && !s.play && s.term === null],
["#/glossaire/lien-de-position", (s) => s.help && s.glossary && s.term === "glossaire-lien-de-position"],
["#/a-propos", (s) => s.help && s.about && !s.play && !s.glossary],
["#/tutoriel", notYet],
["#/tutoriel/2", notYet],
["#/tutoriel", (s) => s.hash === "#/tutoriel/1" && s.tutorial && !s.game],
["#/tutoriel/2", (s) => s.tutorial && !s.home],
["#/tutoriel/3/a-vous", (s) => s.tutorial && s.hash === "#/tutoriel/3/a-vous"],
["#/tutoriel/fin", (s) => s.tutorial && s.hash === "#/tutoriel/fin"],
["#/installer", (s) => s.install && s.hash === "#/installer"],
["#/parties", (s) => s.games && s.listed >= 2 && !s.menu],
[() => `#/parties/${gameId}`, (s) => s.games && s.expanded === gameId],
["#/menu", (s) => s.menu && !s.games],
@@ -777,8 +782,20 @@ async function checkAddresses() {
check((await tab.locator(selector).and(tab.getByRole("link")).count()) === 0,
`${selector} : une action de jeu exposée comme un lien`);
}
// Le bouton « Aide » ouvre la question du moment de la partie
// (help-context.ts) ; ici, l'onglet « Jouer » sans question.
const helpHref = await tab.getAttribute("#help-button", "href");
check(/^#\/aide(\/[a-z0-9-]+)?$/.test(helpHref), `bouton Aide : ${helpHref}`);
await tab.click("#help-button");
await expectScreen(tab, "aide par son lien", (s) => s.hash === "#/aide" && s.help && s.play);
await expectScreen(tab, "aide par son lien", (s) => s.hash === helpHref && s.help && s.play);
if (helpHref !== "#/aide") {
await tab.goBack();
await expectScreen(tab, "retour à la partie", playing);
await tab.evaluate(() => {
location.hash = "#/aide";
});
await expectScreen(tab, "aide", (s) => s.hash === "#/aide" && s.help && s.play);
}
for (const selector of ["#help-back", "#help-tabs a", "#help-play .question h3 a"]) {
check(await isLink(tab, selector), `${selector} : pas des liens`);
}
@@ -920,7 +937,9 @@ await context.route("**/wasm/engine.data", async (route) => {
await route.continue();
});
const start = Date.now();
await page.goto(base);
// « #/ » : la partie ; sans adresse d'écran, l'application s'ouvrirait sur
// l'accueil (tests/browser/accueil.mjs).
await page.goto(`${base}#/`);
await page.waitForSelector("#board polygon[data-point]");
{
const loading = await page.evaluate(() => ({