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.
This commit is contained in:
+7
-4
@@ -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}`);
|
||||
|
||||
Reference in New Issue
Block a user