Interface : drapeau et feuille d'abandon, Crawford sur la barre
Le drapeau à votre tour avant le lancer (barre d'actions, colonne de commandes en paysage, menu), la feuille de choix en cartes radio avec les points ou le score du match, la réponse de l'ordinateur ; la capsule « Crawford » sur la barre, le videau estompé, la ligne du match et la bande sans préfixe. Test navigateur retours-2.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
de32811bba
commit
cddb2707a2
+73
-8
@@ -150,10 +150,54 @@ async function shownMatch() {
|
||||
computer: document.querySelector("#strip-computer .match-score").textContent,
|
||||
player: document.querySelector("#strip-player .match-score").textContent,
|
||||
cube: document.querySelectorAll("#board .cube").length,
|
||||
cubeDimmed: document.querySelectorAll("#board .cube.crawford").length,
|
||||
// La partie Crawford se lit sur la barre (étape 1k).
|
||||
crawford: document.querySelectorAll("#board .crawford-capsule").length === 1,
|
||||
capsule: document.querySelector("#board .crawford-capsule")?.getAttribute("aria-label") ?? null,
|
||||
double: !document.getElementById("double").hidden,
|
||||
}));
|
||||
}
|
||||
|
||||
/** La capsule « Crawford » sur la barre : sur la barre, dans une moitié,
|
||||
* sans toucher la pastille du compte en paysage, 11 px au moins, et pas
|
||||
* une cible (charte, « Crawford sur la barre »). */
|
||||
async function capsuleProblems() {
|
||||
return page.evaluate(() => {
|
||||
const svg = document.getElementById("board");
|
||||
const capsule = svg.querySelector(".crawford-capsule");
|
||||
const bar = svg.querySelector(".board-bar")?.getBBox();
|
||||
if (capsule === null || bar === undefined) {
|
||||
return ["capsule absente"];
|
||||
}
|
||||
const found = [];
|
||||
const frame = capsule.querySelector(".crawford-frame").getBBox();
|
||||
if (frame.x < bar.x || frame.x + frame.width > bar.x + bar.width) {
|
||||
found.push("hors de la barre");
|
||||
}
|
||||
const box = svg.getBoundingClientRect();
|
||||
const vb = svg.viewBox.baseVal;
|
||||
const scale = Math.min(box.width / vb.width, box.height / vb.height);
|
||||
const px = Number(capsule.querySelector(".crawford-text").getAttribute("font-size")) * scale;
|
||||
if (px < 11) {
|
||||
found.push(`texte de ${px.toFixed(1)} px`);
|
||||
}
|
||||
if (getComputedStyle(capsule).pointerEvents !== "none") {
|
||||
found.push("cible tactile");
|
||||
}
|
||||
for (const chip of svg.querySelectorAll(".pip-chip")) {
|
||||
const c = chip.getBBox();
|
||||
const gap = Math.max(c.y - (frame.y + frame.height), frame.y - (c.y + c.height));
|
||||
if (gap * scale < 8) {
|
||||
found.push(`à ${(gap * scale).toFixed(1)} px de la pastille`);
|
||||
}
|
||||
}
|
||||
if (capsule.getAttribute("role") !== "note") {
|
||||
found.push("rôle");
|
||||
}
|
||||
return found;
|
||||
});
|
||||
}
|
||||
|
||||
// ---------------------------------------------------- Écran « Nouvelle partie »
|
||||
|
||||
await page.goto(`${base}#/nouvelle-partie`);
|
||||
@@ -281,9 +325,10 @@ for (;;) {
|
||||
check(actions++ < 20000, "le match ne finit pas");
|
||||
const what = await todo();
|
||||
const now = await shownMatch();
|
||||
const crawford = now.line.endsWith("· partie Crawford");
|
||||
const crawford = now.crawford;
|
||||
if (crawford && what !== "over") {
|
||||
check(now.cube === 0 && !now.double, `partie Crawford : videau visible ${JSON.stringify(now)}`);
|
||||
check(now.cube === 1 && now.cubeDimmed === 1 && !now.double,
|
||||
`partie Crawford : videau estompé, pas de « Doubler » ${JSON.stringify(now)}`);
|
||||
}
|
||||
if (what === "over") {
|
||||
// Le bilan, une fois l'analyse prête, à la place du panneau.
|
||||
@@ -352,13 +397,17 @@ for (;;) {
|
||||
games++;
|
||||
await until("partie suivante", () => !document.body.classList.contains("busy"));
|
||||
const next = await shownMatch();
|
||||
if (next.line.endsWith("· partie Crawford")) {
|
||||
if (next.crawford) {
|
||||
crawfordGames++;
|
||||
check(next.cube === 0, "partie Crawford : le videau est dessiné");
|
||||
check(next.cube === 1 && next.cubeDimmed === 1, "partie Crawford : le videau n'est pas estompé");
|
||||
check(next.capsule === "Partie Crawford : le videau ne peut pas être proposé pendant cette partie.",
|
||||
`partie Crawford : libellé « ${next.capsule} »`);
|
||||
if (!crawfordShot) {
|
||||
crawfordShot = true;
|
||||
check(next.line === "Match en 3 points · partie Crawford",
|
||||
`partie Crawford, portrait : « ${next.line} »`);
|
||||
check(next.line === "Match en 3 points",
|
||||
`partie Crawford, portrait : la ligne du match « ${next.line} »`);
|
||||
const portraitProblems = await capsuleProblems();
|
||||
check(portraitProblems.length === 0, `capsule, portrait : ${portraitProblems.join(", ")}`);
|
||||
await page.setViewportSize(LANDSCAPE);
|
||||
await sleep(200);
|
||||
const band = await page.evaluate(() => {
|
||||
@@ -370,12 +419,28 @@ for (;;) {
|
||||
text.getBBox().width <= pill.getBBox().width - 16,
|
||||
};
|
||||
});
|
||||
check(band.text.startsWith("Partie Crawford · "),
|
||||
`partie Crawford, paysage : « ${band.text} »`);
|
||||
check(!band.text.includes("Crawford"),
|
||||
`partie Crawford, paysage : le préfixe reste (« ${band.text} »)`);
|
||||
check(band.fits, `partie Crawford, paysage : la consigne déborde (« ${band.text} »)`);
|
||||
const landscapeProblems = await capsuleProblems();
|
||||
check(landscapeProblems.length === 0, `capsule, paysage : ${landscapeProblems.join(", ")}`);
|
||||
await page.setViewportSize(PORTRAIT);
|
||||
await sleep(200);
|
||||
await capture("3-partie-crawford");
|
||||
// La recette du 2e lot des retours des joueurs (étape 1k).
|
||||
if (full) {
|
||||
mkdirSync(`${shots}/retours-2`, { recursive: true });
|
||||
for (const size of [PORTRAIT, LANDSCAPE]) {
|
||||
await page.setViewportSize(size);
|
||||
await sleep(200);
|
||||
await page.screenshot({
|
||||
path: `${shots}/retours-2/0-capsule-crawford-${size.width}x${size.height}.png`,
|
||||
});
|
||||
captures++;
|
||||
}
|
||||
await page.setViewportSize(PORTRAIT);
|
||||
await sleep(200);
|
||||
}
|
||||
}
|
||||
} else if (!scoreShot) {
|
||||
scoreShot = true;
|
||||
|
||||
Reference in New Issue
Block a user