test(playwright): drive the instance picker on Flow Debugger and Debug View
Flow Debugger's script-entry instance selection and Debug View's instance
selection both go through the shared InstancePicker combobox now instead of
a flat <select>. Update the tests to type into the {prefix}-input, wait for
the matching {prefix}-row, and click it; keep the <select>-polling helper
for the site select, which is unchanged.
Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
+15
-12
@@ -12,15 +12,18 @@ namespace ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Deployment;
|
||||
/// without hanging.
|
||||
///
|
||||
/// <para>
|
||||
/// <b>The Enabled-only dropdown + deploy precondition (verified against
|
||||
/// <c>DebugView.razor::LoadInstancesForSite</c>):</b> the instance <c><select></c>
|
||||
/// lists ONLY instances whose config state is <c>Enabled</c>
|
||||
/// <b>The Enabled-only instance picker + deploy precondition (verified against
|
||||
/// <c>DebugView.razor::LoadInstancesForSite</c>):</b> the instance
|
||||
/// <c>InstancePicker</c> combobox (prefix <c>debug-instance</c>) lists ONLY
|
||||
/// instances whose config state is <c>Enabled</c>
|
||||
/// (<c>i.State == InstanceState.Enabled</c>). A freshly-minted instance is
|
||||
/// <c>NotDeployed</c> and would never appear, so Fact B first drives the instance
|
||||
/// to <c>Enabled</c> over the CLI (<c>instance deploy</c>) before it can be picked
|
||||
/// in the dropdown. Both <c><select></c>s carry the <c>data-test</c> hooks
|
||||
/// (<c>debug-site-select</c> / <c>debug-instance-select</c>, option value = entity
|
||||
/// id); Fact A asserts those hooks are served, which doubles as proof the cluster
|
||||
/// in the picker. The site <c><select></c> carries the <c>data-test</c> hook
|
||||
/// <c>debug-site-select</c> (option value = entity id); the instance picker carries
|
||||
/// the shared <c>InstancePicker</c> hooks (<c>debug-instance-picker</c>/<c>-input</c>/
|
||||
/// <c>-toggle</c>/<c>-panel</c>/<c>-row</c>, row <c>data-instance-id</c> = entity id).
|
||||
/// Fact A asserts those hooks are served, which doubles as proof the cluster
|
||||
/// rebuild that added them actually took.
|
||||
/// </para>
|
||||
///
|
||||
@@ -65,7 +68,7 @@ public class DebugViewTests : IClassFixture<DeploymentFixture>
|
||||
await Assertions.Expect(page.Locator("h4:has-text('Debug View')")).ToBeVisibleAsync();
|
||||
// The data-test hooks from Task 4 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-select']")).ToHaveCountAsync(1);
|
||||
await Assertions.Expect(page.Locator("[data-test='debug-instance-picker']")).ToHaveCountAsync(1);
|
||||
|
||||
// No site/instance selected -> Connect is disabled.
|
||||
var connect = page.Locator("button.btn.btn-primary.btn-sm:has-text('Connect')");
|
||||
@@ -90,11 +93,11 @@ public class DebugViewTests : IClassFixture<DeploymentFixture>
|
||||
|
||||
await page.Locator("[data-test='debug-site-select']")
|
||||
.SelectOptionAsync(new SelectOptionValue { Value = _cluster.SiteAId.ToString() });
|
||||
var instanceOption = page.Locator("[data-test='debug-instance-select'] option",
|
||||
new() { HasText = uniqueName });
|
||||
await Assertions.Expect(instanceOption).ToHaveCountAsync(1, new() { Timeout = 10_000 });
|
||||
await page.Locator("[data-test='debug-instance-select']")
|
||||
.SelectOptionAsync(new SelectOptionValue { Value = instanceId.ToString() });
|
||||
await page.Locator("[data-test='debug-instance-input']").FillAsync(uniqueName);
|
||||
var instanceRow = page.Locator(
|
||||
$"[data-test='debug-instance-row'][data-instance-id='{instanceId}']");
|
||||
await Assertions.Expect(instanceRow).ToBeVisibleAsync(new() { Timeout = 10_000 });
|
||||
await instanceRow.ClickAsync();
|
||||
|
||||
var connect = page.Locator("button.btn.btn-primary.btn-sm:has-text('Connect')");
|
||||
await Assertions.Expect(connect).ToBeEnabledAsync(new() { Timeout = 10_000 });
|
||||
|
||||
Reference in New Issue
Block a user