Tests navigateur : bilan en page, et fin-de-partie.mjs (1m)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
2a8d14d02b
commit
d74e70f02b
+25
-27
@@ -269,8 +269,8 @@ async function waitForPlayer() {
|
||||
if (!panel.hidden) {
|
||||
return panel.dataset.kind;
|
||||
}
|
||||
// Le bilan remplace le panneau de fin de partie (étape 1e).
|
||||
if (!document.getElementById("summary-veil").hidden) {
|
||||
// Le bilan, une page, arrive à la fin de la partie (étape 1m).
|
||||
if (!document.getElementById("summary").hidden) {
|
||||
return "over";
|
||||
}
|
||||
const usable = (id) => {
|
||||
@@ -1619,8 +1619,8 @@ for (let actions = 0; ; actions++) {
|
||||
|
||||
// --------------------------------------------------------- Fin de partie
|
||||
|
||||
// Le panneau de fin de partie, puis le bilan à sa place une fois
|
||||
// l'analyse prête (étape 1e, testé en détail par bilan.mjs).
|
||||
// Le bilan arrive en page à la fin de la partie, puis se remplit avec
|
||||
// l'analyse (étape 1m, testé en détail par bilan.mjs et fin-de-partie.mjs).
|
||||
await page.waitForSelector('#summary[data-ready="true"]', { timeout: 120_000 });
|
||||
// Le bilan posé : son mini-plateau dessiné (ou « Aucun coup à revoir »).
|
||||
await page.waitForSelector("#summary-board .board-frame, #summary .summary-none", { state: "attached" });
|
||||
@@ -1628,17 +1628,16 @@ const journal = await savedJournal();
|
||||
/** Le titre du bilan et la phrase du résultat. */
|
||||
async function summaryResult() {
|
||||
const title = await page.textContent("#summary-title");
|
||||
const reading = await page.textContent("#summary-reading");
|
||||
const detail = /^(Vous avez passé son double : |L'ordinateur a passé votre double : )?\d+ points? pour (vous|lui)(, videau à \d+)?\./.exec(reading)?.[0] ?? reading;
|
||||
const detail = await page.textContent("#summary-detail");
|
||||
return `${title}, ${detail}`;
|
||||
}
|
||||
const result = await summaryResult();
|
||||
check((await page.textContent("#summary .overline")) === "Fin de partie" &&
|
||||
/^(Vous gagnez|L'ordinateur gagne)/.test(await page.textContent("#summary-title")) &&
|
||||
/^(Vous avez passé son double : |L'ordinateur a passé votre double : )?\d+ points? pour (vous|lui)(, videau à \d+)?\. /.test(
|
||||
await page.textContent("#summary-reading")),
|
||||
/^(Vous avez passé son double : |L'ordinateur a passé votre double : )?\d+ points? pour (vous|lui)(, videau à \d+)?\.$/.test(
|
||||
await page.textContent("#summary-detail")) &&
|
||||
(await page.textContent("#summary-reading")).startsWith("D'après mon analyse"),
|
||||
`bilan de fin de partie : ${result}`);
|
||||
check((await page.textContent("#prompt")) === "", "fin de partie : la consigne répète le panneau");
|
||||
log(
|
||||
`partie finie : ${result} (${countMoves(journal, "player")} coups du joueur, ` +
|
||||
`${countMoves(journal, "computer")} de l'ordinateur, ${journal.events.length} événements)`,
|
||||
@@ -1651,12 +1650,6 @@ check((await page.textContent("#summary-analysis")) === "Voir l'analyse" &&
|
||||
(await page.textContent("#summary-settings")) === "Changer les réglages" &&
|
||||
(await page.getAttribute("#summary-settings", "href")) === "#/nouvelle-partie",
|
||||
"fin de partie : bilan sans « Voir l'analyse », « Rejouer » et « Changer les réglages »");
|
||||
await review("6-fin-de-partie");
|
||||
await page.setViewportSize({ width: 844, height: 320 });
|
||||
await sleep(150);
|
||||
check((await page.locator("#band-text").count()) === 0, "fin de partie : consigne sous le panneau en paysage");
|
||||
await page.setViewportSize(PORTRAIT);
|
||||
await sleep(150);
|
||||
check(countMoves(journal, "player") >= 3 && countMoves(journal, "computer") >= 3, "trop peu de coups");
|
||||
check(reloaded && resumed, "rechargement ou reprise de l'ancienne partie non essayés");
|
||||
check(replays === 2, "le coup de l'ordinateur n'a pas été revu");
|
||||
@@ -1681,13 +1674,17 @@ log(skips > 0 ? `aucun coup possible ${skips} fois (${skipsByDice} en touchant l
|
||||
log(`vibrations demandées : ${(await vibrations()).length}`);
|
||||
await shot("4-fin-de-partie");
|
||||
|
||||
// Fermer le bilan laisse voir la partie finie, sans panneau ; « Rejouer »
|
||||
// reste dans la barre d'actions.
|
||||
await page.click("#summary-close");
|
||||
await page.waitForSelector("#summary-veil", { state: "hidden" });
|
||||
// Le retour du téléphone ramène au plateau final, sans panneau, avec
|
||||
// « Partie terminée · Voir le bilan » ; « Rejouer » reste dans la barre
|
||||
// d'actions.
|
||||
await page.goBack();
|
||||
await page.waitForSelector("#summary", { state: "hidden" });
|
||||
check(!(await page.isVisible("#panel")) && (await page.textContent("#again > span")) === "Rejouer" &&
|
||||
(await page.isVisible("#again")),
|
||||
"bilan fermé : panneau toujours là, ou pas de « Rejouer »");
|
||||
(await page.isVisible("#again")) &&
|
||||
(await page.textContent("#over-line")) === "Partie terminée · Voir le bilan",
|
||||
"retour du bilan : panneau toujours là, pas de « Rejouer » ou pas de ligne de fin");
|
||||
// La recette sur le plateau final, en lecture seule.
|
||||
await review("6-fin-de-partie");
|
||||
|
||||
step("mes parties");
|
||||
// Mes parties (IndexedDB), depuis le menu : une deuxième partie commencée,
|
||||
@@ -1752,7 +1749,8 @@ step("mes parties");
|
||||
check(shown === result, `écran différent après la reprise : ${shown}`);
|
||||
check((await page.evaluate(() => performance.getEntriesByType("navigation").length)) === loads,
|
||||
"la page a été rechargée");
|
||||
await page.click("#summary-close");
|
||||
await page.goBack();
|
||||
await page.waitForSelector("#summary", { state: "hidden" });
|
||||
log(
|
||||
`mes parties : ${listed} parties listées (${branchCount} branche(s) pour la première), ` +
|
||||
`SGF exporté (${sgf.length} octets), première partie reprise sans rechargement`,
|
||||
@@ -1828,11 +1826,11 @@ if (offline === "roll") {
|
||||
await page.click("#roll");
|
||||
await waitForPlayer();
|
||||
}
|
||||
// Si la partie reprise est finie, son bilan se rouvre au rechargement et
|
||||
// couvre l'écran (c'est voulu) : on le ferme avant d'ouvrir l'aide.
|
||||
if (await page.locator("#summary-veil").isVisible()) {
|
||||
await page.click("#summary-close");
|
||||
await page.waitForSelector("#summary-veil", { state: "hidden" });
|
||||
// Si la page rechargée est le bilan, on revient au plateau avant d'ouvrir
|
||||
// l'aide.
|
||||
if (await page.locator("#summary").isVisible()) {
|
||||
await page.goBack();
|
||||
await page.waitForSelector("#summary", { state: "hidden" });
|
||||
}
|
||||
await page.click("#help-button");
|
||||
await page.waitForSelector(".glossary dt", { state: "attached" });
|
||||
|
||||
Reference in New Issue
Block a user