Stop the Cards admin E2E from racing short reveal phases
Pause the page clock while reading each reveal phase's styles, and poll for the palette menu's settled position, so a loaded CI runner cannot miss them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
f7eb225eb8
commit
301c40454d
1 changed files with 20 additions and 2 deletions
|
|
@ -31,6 +31,10 @@ async function expectOpenMenuVisible(page, selector) {
|
|||
expect(result).toEqual({ inside: true, covered: 0 });
|
||||
}
|
||||
|
||||
// Une phase d'aura dure de 300 à 450 ms, pilotées par setTimeout : sur une machine chargée, elle peut finir avant la lecture de ses styles.
|
||||
// Figer l'horloge de la page garde chaque phase affichée le temps des assertions ; `page.clock.runFor()` passe à la suivante et `resume()` relance le temps.
|
||||
const holdRevealTimers = async (page) => page.clock.pauseAt(await page.evaluate(() => Date.now()) + 1000);
|
||||
|
||||
// Rend un anneau légendaire et un anneau mythique figés au même instant, avec une palette unie identique,
|
||||
// puis compare leurs profils de luminance radiaux : la silhouette (trait + lueur) doit être la même.
|
||||
async function expectMythicRingSilhouetteToMatchLegendary(page) {
|
||||
|
|
@ -519,6 +523,7 @@ test("player opens and reveals a three-card pack", async ({ page }) => {
|
|||
|
||||
test("administrator navigates sections, manages mythic content and previews visuals", async ({ page }) => {
|
||||
test.setTimeout(90_000);
|
||||
await page.clock.install();
|
||||
const noOverflow = async () => expect(await page.locator("html").evaluate((element) => element.scrollWidth > element.clientWidth)).toBe(false);
|
||||
await page.goto("/#/cards/admin");
|
||||
await page.getByRole("button", { name: "Version développement", exact: true }).click();
|
||||
|
|
@ -715,8 +720,8 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await expect(lastPaletteOption).toBeVisible();
|
||||
await lastPaletteOption.scrollIntoViewIfNeeded();
|
||||
// L'événement de défilement part à la frame suivante : le menu doit rester défilé après son traitement.
|
||||
await page.evaluate(() => new Promise((done) => globalThis.requestAnimationFrame(() => globalThis.requestAnimationFrame(done))));
|
||||
expect(await lastPaletteOption.evaluate((element) => {
|
||||
// Le menu se recale après le défilement : on attend sa position stable, et un vrai recouvrement échoue à l'expiration.
|
||||
await expect.poll(() => lastPaletteOption.evaluate((element) => {
|
||||
const box = element.getBoundingClientRect();
|
||||
return element.contains(element.ownerDocument.elementFromPoint(box.left + box.width / 2, box.bottom - 4));
|
||||
})).toBe(true);
|
||||
|
|
@ -859,6 +864,7 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
const rareCard = rarePreview.getByRole("button", { name: "Révéler la carte Rare", exact: true });
|
||||
const rareSurface = rarePreview.locator(".nebula-card-reveal");
|
||||
await rareCard.focus();
|
||||
await holdRevealTimers(page);
|
||||
await rareCard.press("Enter");
|
||||
await expect(rareSurface).toHaveAttribute("data-reveal-phase", "aura");
|
||||
await expect(rareSurface).not.toHaveAttribute("disabled", "");
|
||||
|
|
@ -867,6 +873,7 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await expect(rareSurface).toHaveCSS("--opening-aura", "#3b82f6");
|
||||
expect(await rareSurface.evaluate((element) => element.ownerDocument.defaultView.getComputedStyle(element, "::after").animationName)).toBe("nebula-opening-aura");
|
||||
await expect(rareSurface.locator(".nebula-card-particles i")).toHaveCount(0);
|
||||
await page.clock.resume();
|
||||
await expect(rarePreview.getByRole("button", { name: "Remettre la carte Rare face cachée", exact: true })).toHaveAttribute("data-reveal-phase", "revealed");
|
||||
await rarePreview.getByRole("button", { name: "Remettre la carte Rare face cachée", exact: true }).click();
|
||||
await expect(rarePreview.getByRole("button", { name: "Révéler la carte Rare", exact: true })).toHaveAttribute("data-reveal-phase", "concealed");
|
||||
|
|
@ -874,21 +881,27 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
const epicPreview = openingEffects.filter({ has: page.locator('[data-opening-effect="epic-opening"]') });
|
||||
const epicCard = epicPreview.getByRole("button", { name: "Révéler la carte Épique", exact: true });
|
||||
const epicSurface = epicPreview.locator(".nebula-card-reveal");
|
||||
await holdRevealTimers(page);
|
||||
await epicCard.click();
|
||||
await expect(epicSurface).toHaveAttribute("data-reveal-phase", "aura");
|
||||
await expect(epicSurface).toHaveCSS("--card-rarity", "#d946ef");
|
||||
await expect(epicSurface).toHaveCSS("--opening-aura", "#d946ef");
|
||||
await page.clock.runFor(350);
|
||||
await expect(epicSurface.locator(".nebula-card-particles i")).toHaveCount(18);
|
||||
await expect(epicSurface.locator(".nebula-card-particles i").first()).toHaveCSS("animation-name", "nebula-particle");
|
||||
await page.clock.resume();
|
||||
await expect(epicPreview.getByRole("button", { name: "Remettre la carte Épique face cachée", exact: true })).toHaveAttribute("data-reveal-phase", "revealed");
|
||||
|
||||
const legendaryPreview = openingEffects.filter({ has: page.locator('[data-opening-effect="legendary-opening"]') });
|
||||
const legendaryCard = legendaryPreview.getByRole("button", { name: "Révéler la carte Légendaire", exact: true });
|
||||
const legendarySurface = legendaryPreview.locator(".nebula-card-reveal");
|
||||
await holdRevealTimers(page);
|
||||
await legendaryCard.click();
|
||||
await expect(legendarySurface).toHaveAttribute("data-reveal-phase", "aura");
|
||||
await expect(legendarySurface).toHaveCSS("--opening-aura", "#f6c453");
|
||||
await page.clock.runFor(450);
|
||||
await expect(legendarySurface.locator(".nebula-card-particles i")).toHaveCount(32);
|
||||
await page.clock.resume();
|
||||
await expect(legendaryPreview.getByRole("button", { name: "Remettre la carte Légendaire face cachée", exact: true })).toHaveAttribute("data-reveal-phase", "revealed");
|
||||
|
||||
await legendaryPreview.getByRole("button", { name: "Remettre la carte Légendaire face cachée", exact: true }).click();
|
||||
|
|
@ -1009,6 +1022,7 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
await mythicPreview.getByRole("button", { name: "Forme de particules : Flocons de neige" }).click();
|
||||
await mythicPreview.getByRole("button", { name: "Étincelles", exact: true }).click();
|
||||
await expect(mythicSurface).toHaveAttribute("data-particle-shape", "sparks");
|
||||
await holdRevealTimers(page);
|
||||
await mythicCard.click();
|
||||
await expect(mythicSurface).toHaveAttribute("data-reveal-phase", "aura");
|
||||
await expect(mythicSurface).toHaveCSS("--opening-aura", "#ff3b30");
|
||||
|
|
@ -1070,6 +1084,7 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
expect(auraPaletteVisual.zIndex).toBe("1");
|
||||
expect(crownPaletteVisual.zIndex).toBe("1");
|
||||
await expect(mythicSurface.locator(".nebula-card-tilt-surface")).toHaveCSS("z-index", "2");
|
||||
await page.clock.runFor(450);
|
||||
await expect(mythicSurface.locator(".nebula-card-particles i")).toHaveCount(48);
|
||||
const mythicBurstGeometry = await mythicSurface.locator(".nebula-card-particles").evaluate((element) => {
|
||||
const styles = element.ownerDocument.defaultView;
|
||||
|
|
@ -1119,6 +1134,7 @@ test("administrator navigates sections, manages mythic content and previews visu
|
|||
expect(mythicRayBackground).toContain("rgb(52, 199, 89)");
|
||||
const mythicParticleColors = await mythicSurface.locator(".nebula-card-particles i").evaluateAll((particles) => [...new Set(particles.map((particle) => globalThis.getComputedStyle(particle).color))]);
|
||||
expect(mythicParticleColors.length).toBe(7);
|
||||
await page.clock.resume();
|
||||
await expect(mythicPreview.getByRole("button", { name: "Remettre la carte Mythique face cachée", exact: true })).toHaveAttribute("data-reveal-phase", "revealed");
|
||||
|
||||
await page.setViewportSize({ width: 768, height: 900 });
|
||||
|
|
@ -1481,6 +1497,8 @@ test("a player reads the privacy notice and deletes the account for good", async
|
|||
await page.goto("/#/cards");
|
||||
await page.locator(".nebula-privacy-details summary").click();
|
||||
await expect(page.locator(".nebula-privacy-details").getByRole("link", { name: "privacy@example.invalid" })).toHaveAttribute("href", "mailto:privacy@example.invalid");
|
||||
await expect(page.locator(".nebula-privacy-details")).toContainText("Exploitant E2E");
|
||||
await expect(page.locator(".nebula-privacy-details")).toContainText("24 mois");
|
||||
await login.click();
|
||||
await page.getByRole("navigation", { name: "Sections de Sokko TCG" }).getByRole("link", { name: "Compte", exact: true }).click();
|
||||
await expect(page.getByRole("heading", { name: "Compte", exact: true })).toBeVisible();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue