From 87840469358791fe6e958a99c8ba6a59f084dc7a Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Tue, 5 May 2026 07:08:08 +0300 Subject: [PATCH] Deflake E2E test --- e2e/sendouq-match.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/e2e/sendouq-match.spec.ts b/e2e/sendouq-match.spec.ts index 383055ce7..2cf8e05a8 100644 --- a/e2e/sendouq-match.spec.ts +++ b/e2e/sendouq-match.spec.ts @@ -232,6 +232,20 @@ async function reportMapWinner(page: Page, winner: "ALPHA" | "BRAVO") { .first() .click(); }); + // Wait for the action panel to remount with the new reportedCount. + // waitForPOSTResponse only waits for the POST itself, not the loader + // revalidation. MatchActionTab is keyed on reportedCount, so it (and the + // nested WeaponReporter) unmounts and remounts when the loader returns. + // Without this wait, a follow-up click can land on the about-to-unmount + // instance — local state set by that click (e.g. WeaponReporter's isOpen) + // is then thrown away on remount. + await waitForActionPanelMounted(page); +} + +async function waitForActionPanelMounted(page: Page) { + await expect( + page.locator('[data-testid^="winner-radio-"][data-selected="true"]'), + ).toHaveCount(0); } async function selectMapWinner(page: Page, winner: "ALPHA" | "BRAVO") {