From 5b40cef198a82f695666953e3bc50b367e5be7ad Mon Sep 17 00:00:00 2001 From: Adam Date: Wed, 7 Oct 2026 12:16:12 +0000 Subject: [PATCH] test(e2e): wait for the welcome tour to settle before clicking it On a slow CI runner the mobile first-run spec clicked the tour's Start debate button just before the tooltip slid below the Current Debate card. The dialog never opened and the motion fill timed out. Both first-run tests now wait for the tooltip's final position, below the card, before they click it. Co-Authored-By: Claude Opus 5.5 (1M context) --- e2e/full-stack/first-run.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/e2e/full-stack/first-run.spec.ts b/e2e/full-stack/first-run.spec.ts index 82980586d..8c6f8dbe7 100644 --- a/e2e/full-stack/first-run.spec.ts +++ b/e2e/full-stack/first-run.spec.ts @@ -64,6 +64,18 @@ async function signUpFresh(page: Page, user: DemoUser, locale: Locale) { await expect(page).toHaveURL(/\/app$/, { timeout: 20_000 }); } +// On a slow runner the welcome tooltip first renders over the card and only +// slides below it a moment later. A click before that slide was lost, so wait +// for the tooltip's final position. +async function welcomeTourSettled(page: Page) { + const tooltip = page.locator(".react-joyride__tooltip"); + const card = page.locator('[data-tour="current-debate"]'); + await expect.poll(async () => { + const [tip, target] = await Promise.all([tooltip.boundingBox(), card.boundingBox()]); + return !!tip && !!target && tip.y >= target.y + target.height; + }, { timeout: 15_000 }).toBe(true); +} + async function serverDebates(user: DemoUser) { const userId = await user.userId(); const [{ data: debates }, { data: current }] = await Promise.all([ @@ -86,6 +98,7 @@ for (const locale of ["en", "hu"] as const) { await expect(tooltip).toContainText(text.firstDebate); await expect(page.locator("html")).toHaveAttribute("lang", locale); + await welcomeTourSettled(page); await tooltip.getByRole("button", { name: text.startDebate }).click(); const dialog = page.getByRole("dialog"); await dialog.getByLabel(text.motionField).fill(text.tourMotion); @@ -123,6 +136,7 @@ for (const locale of ["en", "hu"] as const) { test(`[${locale}] a fresh account that skips the tour is offered a debate from its motion`, async ({ page, user }) => { test.setTimeout(90_000); await signUpFresh(page, user, locale); + await welcomeTourSettled(page); await page.locator('[data-test-id="button-skip"]').click(); await expect(page.locator(".react-joyride__tooltip")).toHaveCount(0);