From 7a6598f7c3ec49e89e173d74d351ee611127a1bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 15 Jul 2026 22:23:04 +0200 Subject: [PATCH] test(e2e): stabilise the profile-timezone sessions-card expand The sessions card toggle's onClick could be dropped when Playwright clicked before React hydrated the handler, leaving the region hidden for the whole wait and failing intermittently in CI. Retry the click until aria-expanded actually flips. --- e2e/timezone-profile.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/e2e/timezone-profile.spec.ts b/e2e/timezone-profile.spec.ts index e47d0bac4..50dd311d4 100644 --- a/e2e/timezone-profile.spec.ts +++ b/e2e/timezone-profile.spec.ts @@ -77,12 +77,20 @@ test.describe("profile-timezone display (#490)", () => { await page.goto("/settings/privacy", { waitUntil: "domcontentloaded" }); - // The sessions card is collapsed by default — expand it first. + // The sessions card is collapsed by default — expand it first. The + // toggle's onClick can be dropped if Playwright clicks before React has + // hydrated the handler, leaving the region `hidden` for the whole wait. + // Retry the click until `aria-expanded` actually flips. const toggle = page.locator( '[data-slot="settings-security-sessions-toggle"]', ); await expect(toggle).toBeVisible({ timeout: 10_000 }); - await toggle.click(); + await expect(async () => { + await toggle.click(); + await expect(toggle).toHaveAttribute("aria-expanded", "true", { + timeout: 2_000, + }); + }).toPass({ timeout: 15_000 }); const row = page.locator('[data-slot="security-session-row"]').first(); await expect(row).toBeVisible({ timeout: 10_000 });