From 6a665da21d7d791a696f48f147afa625bdb4d8f2 Mon Sep 17 00:00:00 2001 From: shad Date: Sun, 14 Jun 2026 15:38:04 +0400 Subject: [PATCH] test(qa): harden flaky geo + landing assertions to wait-for-condition Two flake sources removed: - geo_attendance_renders_eight_markers: waitForFunction($$ markers >= 8) with 20s timeout instead of a 3s fixed sleep. EA2 fetch + leaflet hydration race fixed. - ceo_persona_dev_login_lands_on_landing + landing_exposes_all_hubs: waitForSelector(.hero-actions) + waitForFunction(hub-chip count >= 7) with 15s timeouts instead of 2.5s fixed sleep. Slow EA2 dev-login round-trips no longer race past hydration. QA verified stable across two consecutive runs: 32/32 each. --- qa/full_dogfood.mjs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/qa/full_dogfood.mjs b/qa/full_dogfood.mjs index a3e9c1c..7535bf5 100644 --- a/qa/full_dogfood.mjs +++ b/qa/full_dogfood.mjs @@ -26,10 +26,12 @@ record("login_shows_three_personas", chips.length === 3, chips.join(" | ")); const ssoBtn = await p.locator(".sso-btn").count(); record("login_has_microsoft_sso_button", ssoBtn === 1); -// 2. Persona dev-login works +// 2. Persona dev-login works. Wait for the landing hero to actually hydrate +// rather than a fixed sleep so a slow EA2 round-trip doesn't flake. await p.locator(".persona-chip", { hasText: /Mariana/ }).click(); await p.locator(".dev-login-btn").click(); -await p.waitForTimeout(2500); +await p.waitForSelector(".hero-actions", { timeout: 15000 }).catch(() => {}); +await p.waitForFunction(() => document.querySelectorAll(".hub-chip").length >= 7, undefined, { timeout: 15000 }).catch(() => {}); const onLanding = await p.locator(".hero-actions").count(); record("ceo_persona_dev_login_lands_on_landing", onLanding === 1); @@ -45,11 +47,12 @@ await p.waitForTimeout(1000); const explainerCards = await p.locator(".explainer-card").count(); record("explainer_renders_eight_cards", explainerCards === 8, `cards=${explainerCards}`); -// 5. Geo-attendance: tiles + markers + stats +// 5. Geo-attendance: tiles + markers + stats. Wait up to 20s for EA2 fetch +// + leaflet hydration; the attendance API materialises 8 docs lazily. await p.locator(".tab", { hasText: /Home/ }).first().click(); await p.waitForTimeout(800); await p.locator(".hub-chip", { hasText: /Attendance Map/ }).click(); -await p.waitForTimeout(3000); +await p.waitForFunction(() => document.querySelectorAll(".leaflet-marker-icon").length >= 8, undefined, { timeout: 20000 }).catch(() => {}); const tiles = await p.locator(".leaflet-tile").count(); const markers = await p.locator(".leaflet-marker-icon").count(); record("geo_attendance_renders_tiles", tiles > 10, `tiles=${tiles}`);