test(playwright): fix stale selectors after UI refactor (h1 headings, collapsed Topology/Audit disclosures, ParameterValueForm ids, method-select race)
This commit is contained in:
@@ -70,7 +70,7 @@ public class DebugViewTests : IClassFixture<DeploymentFixture>
|
||||
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/deployment/debug-view");
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
|
||||
await Assertions.Expect(page.Locator("h4:has-text('Debug View')")).ToBeVisibleAsync();
|
||||
await Assertions.Expect(page.Locator("h1:has-text('Debug View')")).ToBeVisibleAsync();
|
||||
// The data-test hooks must be served (proves the rebuild took).
|
||||
await Assertions.Expect(page.Locator("[data-test='debug-site-select']")).ToHaveCountAsync(1);
|
||||
await Assertions.Expect(page.Locator("[data-test='debug-instance-picker']")).ToHaveCountAsync(1);
|
||||
|
||||
+2
-2
@@ -62,7 +62,7 @@ public class DeploymentsRealtimeTests : IClassFixture<DeploymentFixture>
|
||||
var page = await _pw.NewAuthenticatedPageAsync();
|
||||
await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/deployment/deployments");
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
await Assertions.Expect(page.Locator("h4:has-text('Deployment Status')")).ToBeVisibleAsync();
|
||||
await Assertions.Expect(page.Locator("h1:has-text('Deployment Status')")).ToBeVisibleAsync();
|
||||
|
||||
// Deploy over the CLI — this writes deployment records and raises StatusChanged,
|
||||
// which the page reloads on (push). No Refresh click here: the row appearing IS
|
||||
@@ -93,7 +93,7 @@ public class DeploymentsRealtimeTests : IClassFixture<DeploymentFixture>
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
// Confirm the page loaded before interacting (symmetric with Fact A) — a failed
|
||||
// load then surfaces as a clear heading-miss rather than a confusing Pause timeout.
|
||||
await Assertions.Expect(page.Locator("h4:has-text('Deployment Status')")).ToBeVisibleAsync();
|
||||
await Assertions.Expect(page.Locator("h1:has-text('Deployment Status')")).ToBeVisibleAsync();
|
||||
|
||||
// Pause — the click round-trips over the circuit, so _autoRefresh is committed
|
||||
// false before the deploy below. The button flipping to "Resume" proves it.
|
||||
|
||||
+6
-2
@@ -55,7 +55,7 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
||||
// to Predicted and the method's ParameterValueForm (the same typed form the script
|
||||
// pane uses, inputs addressed by field id) appears.
|
||||
await Assertions.Expect(page.Locator("[data-test='flow-state']")).ToHaveTextAsync("Predicted", new() { Timeout = 15_000 });
|
||||
var input = page.Locator("#param-Text");
|
||||
var input = page.Locator("[data-param-path='Text']");
|
||||
await Assertions.Expect(input).ToBeVisibleAsync();
|
||||
|
||||
// @bind commits on change (blur), so commit the value as its own circuit message before Run.
|
||||
@@ -136,7 +136,7 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
||||
await Assertions.Expect(paramsCard.Or(noParamsNote)).ToBeVisibleAsync(new() { Timeout = 15_000 });
|
||||
if (await paramsCard.IsVisibleAsync())
|
||||
{
|
||||
var workOrder = page.Locator("#param-WorkOrder");
|
||||
var workOrder = page.Locator("[data-param-path='WorkOrder']");
|
||||
if (await workOrder.CountAsync() > 0)
|
||||
{
|
||||
await workOrder.FillAsync("WO-PW");
|
||||
@@ -299,6 +299,10 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
||||
await Assertions.Expect(select).ToBeVisibleAsync();
|
||||
// The option list is loaded server-side on init; wait for our method to be present.
|
||||
await Assertions.Expect(select.Locator($"option[value='{MethodIdText}']")).ToHaveCountAsync(1, new() { Timeout = 15_000 });
|
||||
// The static-rendered <select> is visible before the Blazor circuit attaches its change
|
||||
// handler; a selection made in that window is silently lost (state stays "Not run").
|
||||
// Wait for the circuit to settle, then select.
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
await select.SelectOptionAsync(MethodIdText);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ internal static class TopologyPageHelper
|
||||
// newly-expanded branches (and their "Load instances" loaders) exist. Wait until no
|
||||
// collapsed branch remains before counting loaders — counting immediately raced the
|
||||
// render and returned an unexpanded tree whenever the round-trip lost.
|
||||
// The tree toolbar's secondary actions live in a collapsed "More actions" <details>.
|
||||
var more = page.Locator("details.topology-actions-disclosure");
|
||||
if (!await more.EvaluateAsync<bool>("d => d.open"))
|
||||
await more.Locator("summary").ClickAsync();
|
||||
var collapsed = page.Locator("li[role='treeitem'][aria-expanded='false']");
|
||||
for (var branch = 0; branch < 300; branch++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user