test(playwright): fix stale selectors after UI refactor (h1 headings, collapsed Topology/Audit disclosures, ParameterValueForm ids, method-select race)

This commit is contained in:
Joseph Doherty
2026-12-03 12:14:28 -05:00
parent 18311eb385
commit 5acb16ca07
23 changed files with 66 additions and 46 deletions
@@ -80,7 +80,7 @@ public class NotificationActionTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Notification Report')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Notification Report')")).ToBeVisibleAsync();
// Narrow to the seeded row: Parked status (so only Retry/Discard-bearing rows
// render) plus the unique subject keyword. The status select is a @bind
@@ -207,7 +207,7 @@ public class NotificationActionTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Notification Report')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Notification Report')")).ToBeVisibleAsync();
// #no-list is an exact-match text input bound @bind (commit-on-change), so
// FillAsync (which only fires `input`) must be followed by an explicit
@@ -263,7 +263,7 @@ public class NotificationActionTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Notification Report')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Notification Report')")).ToBeVisibleAsync();
// Narrow to the seeded row by its exact ListName marker (+ Parked status).
await page.Locator("#no-list").FillAsync(marker);
@@ -341,7 +341,7 @@ public class NotificationActionTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Notification Report')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Notification Report')")).ToBeVisibleAsync();
// Narrow to the pair by the exact ListName marker (commit the @bind value with a
// change dispatch — FillAsync only fires `input`), then Query.
@@ -416,7 +416,7 @@ public class NotificationActionTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{NotificationReportUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Notification Report')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Notification Report')")).ToBeVisibleAsync();
await page.Locator("#no-list").FillAsync(marker);
await page.Locator("#no-list").DispatchEventAsync("change");
@@ -44,7 +44,7 @@ public class NotificationKpisTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{KpisUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Notification KPIs')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Notification KPIs')")).ToBeVisibleAsync();
var tilesOk = await page.Locator("small.text-muted:has-text('Queue Depth')").IsVisibleAsync()
&& await page.Locator("small.text-muted:has-text('Oldest Pending Age')").IsVisibleAsync();
@@ -52,7 +52,7 @@ public class NotificationListCrudTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{ListsUrl}/create");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Add Notification List')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Add Notification List')")).ToBeVisibleAsync();
// The create form has exactly one input (the list name); recipients are edit-only.
await page.Locator("input.form-control").First.FillAsync(name);
@@ -78,7 +78,7 @@ public class NotificationListCrudTests
// loads the edit form's data); wait for it to settle before asserting the heading.
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Edit Notification List')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Edit Notification List')")).ToBeVisibleAsync();
// The edit page has TWO "Name" text inputs (list name + recipient name). Scope the
// recipient form to the card that contains the email input to disambiguate.
@@ -91,7 +91,7 @@ public class SmsNotificationE2ETests
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
// RENDER-CRASH GATE: the heading only appears if the new page's circuit rendered cleanly.
await Assertions.Expect(page.Locator("h4:has-text('SMS Configuration')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('SMS Configuration')")).ToBeVisibleAsync();
if (!alreadyExists)
{
@@ -160,7 +160,7 @@ public class SmsNotificationE2ETests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{ListsUrl}/create");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Add Notification List')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Add Notification List')")).ToBeVisibleAsync();
// The create form has the list-name text input and the Type <select>. The select's
// option values are the NotificationType enum names ("Email"/"Sms"); select by value.
@@ -182,7 +182,7 @@ public class SmsNotificationE2ETests
// Blazor enhanced navigation (SignalR round-trip) loads the edit form's data.
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Edit Notification List')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Edit Notification List')")).ToBeVisibleAsync();
// CHANNEL-AWARE ASSERTION: SMS list → phone input present, email input absent.
await Assertions.Expect(page.Locator("input[type=tel].form-control")).ToBeVisibleAsync(new() { Timeout = 10_000 });
@@ -226,7 +226,7 @@ public class SmsNotificationE2ETests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{ListsUrl}/create");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('Add Notification List')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('Add Notification List')")).ToBeVisibleAsync();
await page.Locator("input[type=text].form-control").First.FillAsync(name);
await page.Locator("select.form-select").SelectOptionAsync(new SelectOptionValue { Value = "Sms" });
@@ -63,7 +63,7 @@ public class SmtpConfigTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{SmtpUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('SMTP Configuration')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('SMTP Configuration')")).ToBeVisibleAsync();
// Open the form. Prefer the empty-state Add button (Host starts empty); otherwise
// edit the first existing card (Host pre-filled — we clear it below).
@@ -90,7 +90,7 @@ public class SmtpConfigTests
// Cancel and confirm the form closed (Save button gone). Leaves config exactly as found.
await page.Locator("button.btn-outline-secondary:has-text('Cancel')").ClickAsync();
await Assertions.Expect(page.Locator("button.btn-success:has-text('Save')")).ToHaveCountAsync(0);
await Assertions.Expect(page.Locator("h4:has-text('SMTP Configuration')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('SMTP Configuration')")).ToBeVisibleAsync();
}
/// <summary>
@@ -108,7 +108,7 @@ public class SmtpConfigTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{SmtpUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('SMTP Configuration')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('SMTP Configuration')")).ToBeVisibleAsync();
// Web-first: assert the page resolved to EITHER a config card (Credentials '(stored)' /
// '(not set)') OR the empty-state, with retry so a slow Blazor init does not spuriously
@@ -154,7 +154,7 @@ public class SmtpConfigTests
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}{SmtpUrl}");
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await Assertions.Expect(page.Locator("h4:has-text('SMTP Configuration')")).ToBeVisibleAsync();
await Assertions.Expect(page.Locator("h1:has-text('SMTP Configuration')")).ToBeVisibleAsync();
// Open the first card's Edit form. StartEdit reloads EVERY field (including the stored
// credential, _credentials = smtp.Credentials), so re-saving untouched rewrites the