Show a New badge when a pack reveals an unowned card edition
All checks were successful
Validate and deploy Sokko G / validate (push) Successful in 19m49s
Validate and deploy Sokko G / deploy (push) Successful in 10s

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Shinuwa 2026-11-06 10:11:57 +01:00
parent c95f767b63
commit 1adccb4e04
7 changed files with 19 additions and 5 deletions

View file

@ -292,6 +292,10 @@ test("player opens and reveals a three-card pack", async ({ page }) => {
await expect(page.locator(".nebula-home-rarest-card")).toHaveCount(0);
await page.getByRole("button", { name: "Reprendre l’ouverture", exact: true }).click();
await expect(page.getByRole("button", { name: "Révéler la carte" })).toHaveCount(3);
// Le badge « New » suit l'édition non possédée et n'apparaît qu'une fois la carte révélée : la première carte du tout premier paquet est forcément nouvelle.
const newEditions = await page.evaluate(async () => (await globalThis.fetch("/api/cards/state")).json().then((state) => state.pendingOpening.cards.map((card) => card.isNewEdition)));
expect(newEditions[0]).toBe(true);
await expect(page.locator(".nebula-card-new-badge")).toHaveCount(0);
await page.getByRole("button", { name: "Tout révéler" }).click();
const openingStage = page.locator(".nebula-opening-stage");
const revealedCards = page.locator('.nebula-opening-cards .nebula-card[data-card-size="lg"]');
@ -306,7 +310,9 @@ test("player opens and reveals a three-card pack", async ({ page }) => {
await expect(revealedCards.first().locator(".nebula-card-rarity-symbol")).toHaveCSS("color", "rgb(103, 232, 249)");
await expect(revealedCards.first().locator(".nebula-card-particles i").first()).toHaveCSS("color", "rgb(255, 59, 48)");
await expect(page.getByRole("button", { name: "Retour", exact: true })).toBeVisible();
const revealedNames = await revealedCards.evaluateAll((cards) => cards.map((card) => card.getAttribute("aria-label").replace(/ révélée$/, "")));
expect(await revealedCards.evaluateAll((cards) => cards.map((card) => card.querySelector(".nebula-card-new-badge")?.textContent === "New"))).toEqual(newEditions);
expect(await revealedCards.evaluateAll((cards) => cards.map((card) => card.getAttribute("aria-label").endsWith(", nouvelle carte")))).toEqual(newEditions);
const revealedNames = await revealedCards.evaluateAll((cards) => cards.map((card) => card.getAttribute("aria-label").replace(/ révélée(, nouvelle carte)?$/, "")));
await expect.poll(() => page.evaluate(async () => (await globalThis.fetch("/api/cards/state")).json().then((state) => state.pendingOpening))).toBeNull();
expect((await openingStage.boundingBox()).width).toBeLessThanOrEqual(1000);
await expect(page.locator(".nebula-opening-summary")).toHaveCount(0);