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:
+16
-8
@@ -193,7 +193,9 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
||||
/// rig's <see cref="RigInstanceName"/>, skipping the test with a rig-shaped message whenever an
|
||||
/// option is missing — none of these objects is provisioned by the fixture. Site is matched by
|
||||
/// LABEL because its id differs per rig (the seed names it "Test Plant A", identifier
|
||||
/// <c>site-a</c>); the script is matched by option VALUE, which is its canonical name.
|
||||
/// <c>site-a</c>); the instance goes through the shared <c>InstancePicker</c> combobox (typed
|
||||
/// name filters the tree, exact-text row click selects); the script is matched by option VALUE,
|
||||
/// which is its canonical name.
|
||||
/// </summary>
|
||||
private static async Task<ILocator> SelectRigScriptAsync(IPage page, string scriptName)
|
||||
{
|
||||
@@ -206,11 +208,17 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
||||
Skip.If(siteLabel is null, "The rig's site-a ('Test Plant A') is not in the Flow Debugger site list — run docker/seed-sites.sh.");
|
||||
await sites.SelectOptionAsync(new SelectOptionValue { Label = siteLabel! });
|
||||
|
||||
var instances = page.Locator("select[data-test='flow-instance-select']");
|
||||
var instanceLabel = await WaitForOptionLabelAsync(
|
||||
page, instances, l => string.Equals(l, RigInstanceName, StringComparison.Ordinal));
|
||||
Skip.If(instanceLabel is null, $"Instance {RigInstanceName} is not on the rig's site-a — run docker/seed-delmia-sim.sh.");
|
||||
await instances.SelectOptionAsync(new SelectOptionValue { Label = instanceLabel! });
|
||||
// Instance selection goes through the shared InstancePicker combobox (prefix
|
||||
// "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.
|
||||
var instanceInput = page.Locator("[data-test='flow-instance-input']");
|
||||
await instanceInput.FillAsync(RigInstanceName);
|
||||
var instancePanel = page.Locator("[data-test='flow-instance-panel']");
|
||||
var instanceRow = instancePanel.GetByText(RigInstanceName, new() { Exact = true });
|
||||
Skip.IfNot(
|
||||
await WaitForCountAsync(page, instanceRow),
|
||||
$"Instance {RigInstanceName} is not on the rig's site-a — run docker/seed-delmia-sim.sh.");
|
||||
await instanceRow.ClickAsync();
|
||||
|
||||
var scripts = page.Locator("select[data-test='flow-script-select']");
|
||||
var option = scripts.Locator($"option[value='{scriptName}']");
|
||||
@@ -223,8 +231,8 @@ public class FlowDebuggerTests : IClassFixture<FlowDebuggerFixture>
|
||||
|
||||
/// <summary>
|
||||
/// Polls a <c><select></c>'s option labels until one matches, returning it (or null on
|
||||
/// timeout). The instance and script lists are filled by a server round-trip after the previous
|
||||
/// picker changes, so the options do not exist at first render.
|
||||
/// timeout). Used for the site select, whose options are filled by a server round-trip after
|
||||
/// the page loads, so the options do not exist at first render.
|
||||
/// </summary>
|
||||
private static async Task<string?> WaitForOptionLabelAsync(
|
||||
IPage page, ILocator select, Func<string, bool> match, int timeoutMs = 15_000)
|
||||
|
||||
Reference in New Issue
Block a user