test(e2e): harden LDAP teardown + tighten nav/health selectors (review fixes)

This commit is contained in:
Joseph Doherty
2026-06-05 10:19:48 -04:00
parent 754f049a98
commit 3d9ef0a477
3 changed files with 107 additions and 59 deletions
@@ -76,19 +76,26 @@ public class HealthDashboardTests
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
// ── Notification Outbox tiles (no data-test; inlined in Health.razor as
// plain div.card elements, not buttons — use that to disambiguate from
// the SiteCallKpiTiles which render their cards as <button class="card">)
// The Outbox section renders under the "Notification Outbox" h6 heading.
// Scope by the exact small.text-muted label to pinpoint each tile's h3.
// plain div.card elements under the "Notification Outbox" h6 heading).
// Scope all three cards to the div.row that immediately follows the flex
// container holding the h6 — prevents false matches if a second section
// later grows cards with the same label text ("Stuck", "Parked").
//
// Health.razor structure:
// <div class="d-flex ...">
// <h6 class="text-muted mb-0">Notification Outbox</h6> ← anchor
// <a ...>View details →</a>
// </div>
// <div class="row g-3 mb-3"> ← outboxSection (+sibling)
// <div class="col-..."><div class="card">Queue Depth</div></div>
// <div class="col-..."><div class="card">Stuck</div></div>
// <div class="col-..."><div class="card">Parked</div></div>
// </div>
var outboxSection = page.Locator("div.d-flex:has(h6:has-text('Notification Outbox')) + div.row");
var queueDepthH3 = page.Locator("div.card", new() { HasText = "Queue Depth" }).Locator("h3");
// "Stuck" and "Parked" labels appear in both the Outbox section (div.card)
// and the Site Call tiles section (button.card). Discriminate on the element
// type: the Outbox tiles are <div class="card">, the Site Call tiles are
// <button class="card">. Using `div.card` (not `button.card`) ensures we
// select the Notification Outbox cards only.
var outboxStuckH3 = page.Locator("div.card", new() { HasText = "Stuck" }).Locator("h3");
var outboxParkedH3 = page.Locator("div.card", new() { HasText = "Parked" }).Locator("h3");
var queueDepthH3 = outboxSection.Locator("div.card", new() { HasText = "Queue Depth" }).Locator("h3");
var outboxStuckH3 = outboxSection.Locator("div.card", new() { HasText = "Stuck" }).Locator("h3");
var outboxParkedH3 = outboxSection.Locator("div.card", new() { HasText = "Parked" }).Locator("h3");
await AssertTileResolvedAsync(queueDepthH3, "Outbox Queue Depth");
await AssertTileResolvedAsync(outboxStuckH3, "Outbox Stuck");