test(playwright): Flow Debugger instance row matched through the data-test contract
The instance row locator used Locator.GetByText scoped to the panel, which bypasses the [data-test='flow-instance-row'] contract InstancePicker rows are documented to carry. Match through the data-test attribute instead, with an exact-text regex since the test only knows the instance name (not its id, unlike Debug View's tests). Claude-Session: https://claude.ai/code/session_01NcMG6xXdsJbmD2wYAgkK29
This commit is contained in:
+7
-3
@@ -1,4 +1,5 @@
|
|||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
using System.Text.RegularExpressions;
|
||||||
using Microsoft.Playwright;
|
using Microsoft.Playwright;
|
||||||
using ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
|
using ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests.Cluster;
|
||||||
using Xunit;
|
using Xunit;
|
||||||
@@ -210,11 +211,14 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
|||||||
|
|
||||||
// Instance selection goes through the shared InstancePicker combobox (prefix
|
// Instance selection goes through the shared InstancePicker combobox (prefix
|
||||||
// "flow-instance"): typing the name filters the area tree and expands its
|
// "flow-instance"): typing the name filters the area tree and expands its
|
||||||
// ancestors, then the exact-text row is clicked to select and close the panel.
|
// ancestors, then the exact-text row is clicked to select and close the panel. The
|
||||||
|
// test only knows the instance NAME (not its id), so the row is matched through the
|
||||||
|
// data-test contract (flow-instance-row) with an exact-text regex rather than a
|
||||||
|
// free-text GetByText scan.
|
||||||
var instanceInput = page.Locator("[data-test='flow-instance-input']");
|
var instanceInput = page.Locator("[data-test='flow-instance-input']");
|
||||||
await instanceInput.FillAsync(RigInstanceName);
|
await instanceInput.FillAsync(RigInstanceName);
|
||||||
var instancePanel = page.Locator("[data-test='flow-instance-panel']");
|
var instanceRow = page.Locator("[data-test='flow-instance-row']",
|
||||||
var instanceRow = instancePanel.GetByText(RigInstanceName, new() { Exact = true });
|
new() { HasTextRegex = new Regex($"^\\s*{Regex.Escape(RigInstanceName)}\\s*$") });
|
||||||
Skip.IfNot(
|
Skip.IfNot(
|
||||||
await WaitForCountAsync(page, instanceRow),
|
await WaitForCountAsync(page, instanceRow),
|
||||||
$"Instance {RigInstanceName} is not on the rig's site-a — run docker/seed-delmia-sim.sh.");
|
$"Instance {RigInstanceName} is not on the rig's site-a — run docker/seed-delmia-sim.sh.");
|
||||||
|
|||||||
Reference in New Issue
Block a user