diff --git a/tests/restart-chaos/board-ui.test.ts b/tests/restart-chaos/board-ui.test.ts index 6cfd43267e1..6d0f994c7e8 100644 --- a/tests/restart-chaos/board-ui.test.ts +++ b/tests/restart-chaos/board-ui.test.ts @@ -11,6 +11,8 @@ const pages: Record = { "/issues/CHA-4": `

Couldn’t load the subtasks.

Couldn’t finish this attempt.
`, "/issues/CHA-5": `
Couldn’t finish this attempt.
`, + "/issues/CHA-6": ` +
Couldn’t finish this attempt. Your message is saved.
`, }; let server: Server; let baseUrl: string; @@ -65,6 +67,13 @@ describe("BoardUi.clickRetry", () => { expect(posts).toContain("/api/issues/i4/retry"); }, 60_000); + it("finds the visible banner Retry when an earlier Retry match has no box", async () => { + await withBoard(async board => { + expect(await board.clickRetry("CHA-6", "i6", 3_000, 500)).toMatchObject({ clicked: true, httpStatus: 202, accepted: true, error: null }); + }); + expect(posts).toContain("/api/issues/i6/retry"); + }, 60_000); + it("does not count a retry request for a different issue", async () => { await withBoard(async board => { expect(await board.clickRetry("CHA-5", "i5", 1_500, 500)).toMatchObject({ clicked: true, error: UI_RETRY_NO_REQUEST }); diff --git a/tests/restart-chaos/board-ui.ts b/tests/restart-chaos/board-ui.ts index 029f2cba161..96343025eb7 100644 --- a/tests/restart-chaos/board-ui.ts +++ b/tests/restart-chaos/board-ui.ts @@ -37,7 +37,8 @@ export async function clickRetryOnPage(page: Page, url: string, issueRefs: reado return texts.map(text => text.trim()).filter(Boolean).join(" | ").slice(0, 500) || null; }; try { - await page.getByRole("button", { name: "Retry", exact: true }).first().waitFor({ state: "visible", timeout: timeoutMs }); + await page.getByRole("button", { name: "Retry", exact: true }).filter({ visible: true }).first() + .waitFor({ state: "visible", timeout: timeoutMs }); } catch { return { clicked: false, httpStatus: null, accepted: null, error: UI_RETRY_BUTTON_MISSING, bannerText: await banner() }; }