test(playwright): use label-anchored ExternalSystem form selectors (review fix)
This commit is contained in:
+8
-6
@@ -35,12 +35,14 @@ public class ExternalSystemCrudTests
|
||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||
await Assertions.Expect(page.Locator("h4:has-text('Add External System')")).ToBeVisibleAsync();
|
||||
|
||||
// Name and Endpoint URL are both input[type=text].form-control. Per
|
||||
// ExternalSystemForm.razor, Name is the first text input and Endpoint URL
|
||||
// is the second — select by order.
|
||||
var textInputs = page.Locator("input[type=text].form-control");
|
||||
await textInputs.Nth(0).FillAsync(name);
|
||||
await textInputs.Nth(1).FillAsync("https://example.invalid/api");
|
||||
// ExternalSystemForm.razor has THREE input[type=text].form-control fields
|
||||
// (Name, Endpoint URL, and Auth Config JSON), so index-based selection is
|
||||
// fragile. Anchor each fill to its own div.mb-3 wrapper via the field label
|
||||
// so the selectors survive field reordering and uniquely match one element.
|
||||
await page.Locator("div.mb-3:has(label:has-text('Name')) input[type=text].form-control")
|
||||
.FillAsync(name);
|
||||
await page.Locator("div.mb-3:has(label:has-text('Endpoint URL')) input[type=text].form-control")
|
||||
.FillAsync("https://example.invalid/api");
|
||||
|
||||
await page.Locator("button.btn-success:has-text('Save')").ClickAsync();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user