test(e2e): scope Site delete dropdown to .dropdown (review fix)

This commit is contained in:
Joseph Doherty
2026-06-05 10:34:07 -04:00
parent 917e5f30bf
commit 043914fd71
@@ -158,13 +158,15 @@ public class SiteCrudTests
await Assertions.Expect(page.Locator("div.card", new() { HasText = name })).ToBeVisibleAsync();
// ── DELETE ────────────────────────────────────────────────────────────────
// Re-locate the card after navigation; scope the kebab to avoid strict mode.
// Re-locate the card after navigation; scope kebab+delete to the .dropdown
// container inside the card to be defensive against strict-mode violations.
var cardAfterEdit = page.Locator("div.card", new() { HasText = name });
var kebab = cardAfterEdit.Locator("button[aria-label^='More actions']");
var cardDropdown = cardAfterEdit.Locator(".dropdown");
var kebab = cardDropdown.Locator("button[aria-label^='More actions']");
await kebab.ClickAsync();
// Click Delete in the now-open dropdown — scoped to the card.
var deleteBtn = cardAfterEdit.Locator(".dropdown-menu button.dropdown-item.text-danger");
// Click Delete in the now-open dropdown — scoped to the .dropdown container.
var deleteBtn = cardDropdown.Locator(".dropdown-menu button.dropdown-item.text-danger");
await deleteBtn.ClickAsync();
// Confirm the global danger dialog.