test(e2e): scope Site delete dropdown to .dropdown (review fix)
This commit is contained in:
@@ -158,13 +158,15 @@ public class SiteCrudTests
|
|||||||
await Assertions.Expect(page.Locator("div.card", new() { HasText = name })).ToBeVisibleAsync();
|
await Assertions.Expect(page.Locator("div.card", new() { HasText = name })).ToBeVisibleAsync();
|
||||||
|
|
||||||
// ── DELETE ────────────────────────────────────────────────────────────────
|
// ── 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 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();
|
await kebab.ClickAsync();
|
||||||
|
|
||||||
// Click Delete in the now-open dropdown — scoped to the card.
|
// Click Delete in the now-open dropdown — scoped to the .dropdown container.
|
||||||
var deleteBtn = cardAfterEdit.Locator(".dropdown-menu button.dropdown-item.text-danger");
|
var deleteBtn = cardDropdown.Locator(".dropdown-menu button.dropdown-item.text-danger");
|
||||||
await deleteBtn.ClickAsync();
|
await deleteBtn.ClickAsync();
|
||||||
|
|
||||||
// Confirm the global danger dialog.
|
// Confirm the global danger dialog.
|
||||||
|
|||||||
Reference in New Issue
Block a user