From 1e2263a6d8918ff30bc0e4876c182dff3fa25afe Mon Sep 17 00:00:00 2001 From: Kalle <38327916+Sendouc@users.noreply.github.com> Date: Thu, 24 Sep 2026 21:04:02 +0300 Subject: [PATCH] Fix flaky test --- e2e/pages/sendouq/sendouq-match-page.ts | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/e2e/pages/sendouq/sendouq-match-page.ts b/e2e/pages/sendouq/sendouq-match-page.ts index 58b764cdc..601695530 100644 --- a/e2e/pages/sendouq/sendouq-match-page.ts +++ b/e2e/pages/sendouq/sendouq-match-page.ts @@ -158,21 +158,27 @@ export class SendouQMatchPage { await expect(this.locators.confirmScoreButton).toBeEnabled({ timeout: 10_000, }); - await this.locators.confirmScoreButton.click(); + // only a loss needs a second tap; any other first tap already submits, so + // the response wait has to be armed before it + const isLoss = ( + await this.locators.confirmScoreButton.textContent() + )?.includes("loss"); - const armedLossButton = this.locators.confirmScoreButton.filter({ - hasText: "Tap again", - }); - - const isArmed = await armedLossButton.isVisible(); - if (isArmed) { + if (isLoss) { + await this.locators.confirmScoreButton.click(); + const armedLossButton = this.locators.confirmScoreButton.filter({ + hasText: "Tap again", + }); + await expect(armedLossButton).toBeVisible(); await waitOutLossConfirmMinGap(this.page); + await waitForPOSTResponse(this.page, async () => { + await armedLossButton.click(); + }); + return; } await waitForPOSTResponse(this.page, async () => { - if (isArmed) { - await armedLossButton.click(); - } + await this.locators.confirmScoreButton.click(); }); }