From 961e8cb690effebaf58beff6acd74a4f987bf2c9 Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Mon, 4 May 2026 18:04:06 +0300 Subject: [PATCH] Fix e2e tests --- app/components/match-page/MatchActionTab.tsx | 1 + e2e/helpers/tournament-match.ts | 8 ++++++++ e2e/sendouq-match.spec.ts | 8 ++++++++ 3 files changed, 17 insertions(+) diff --git a/app/components/match-page/MatchActionTab.tsx b/app/components/match-page/MatchActionTab.tsx index 60719b9a5..632ccad79 100644 --- a/app/components/match-page/MatchActionTab.tsx +++ b/app/components/match-page/MatchActionTab.tsx @@ -126,6 +126,7 @@ export function MatchActionTab({ ]); } }} + isDisabled={isSubmitting} aria-label={t("q:match.action.selectWinner")} className={styles.selectionRow} > diff --git a/e2e/helpers/tournament-match.ts b/e2e/helpers/tournament-match.ts index 3da036fcf..2d036620c 100644 --- a/e2e/helpers/tournament-match.ts +++ b/e2e/helpers/tournament-match.ts @@ -92,6 +92,14 @@ export const reportResult = async ( ) => { for (let i = 0; i < mapsToReport; i++) { const isFinal = setEnds && i === mapsToReport - 1; + // Wait for the action panel to settle before clicking. waitForPOSTResponse + // only waits for the POST itself; the loader revalidation that swaps in + // the next map's component runs after, so a previous winner can still be + // `data-selected="true"` here. Clicking too early hits the about-to-unmount + // label and the selection is lost on remount. + await expect( + page.locator('[data-testid^="winner-radio-"][data-selected="true"]'), + ).toHaveCount(0); await page.getByTestId(`winner-radio-${winner}`).click(); if (isFinal) { await page.getByTestId("report-score-button").click(); diff --git a/e2e/sendouq-match.spec.ts b/e2e/sendouq-match.spec.ts index bfa4a8dd5..383055ce7 100644 --- a/e2e/sendouq-match.spec.ts +++ b/e2e/sendouq-match.spec.ts @@ -236,6 +236,14 @@ async function reportMapWinner(page: Page, winner: "ALPHA" | "BRAVO") { async function selectMapWinner(page: Page, winner: "ALPHA" | "BRAVO") { const teamName = winner === "ALPHA" ? "Group Alpha" : "Group Bravo"; + // Wait for the action panel to settle before clicking. waitForPOSTResponse + // only waits for the POST itself; the loader revalidation that swaps in the + // next map's component runs after, so a previous winner can still be + // `data-selected="true"` here. Clicking too early hits the about-to-unmount + // label and the selection is lost on remount. + await expect( + page.locator('[data-testid^="winner-radio-"][data-selected="true"]'), + ).toHaveCount(0); // react-aria's Radio renders a hidden input behind a span overlay; click the // wrapping label so the press handler fires and updates winnerId. await page.locator(`label:has(input[aria-label="${teamName}"])`).click();