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 page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
||||||
await Assertions.Expect(page.Locator("h4:has-text('Add External System')")).ToBeVisibleAsync();
|
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 has THREE input[type=text].form-control fields
|
||||||
// ExternalSystemForm.razor, Name is the first text input and Endpoint URL
|
// (Name, Endpoint URL, and Auth Config JSON), so index-based selection is
|
||||||
// is the second — select by order.
|
// fragile. Anchor each fill to its own div.mb-3 wrapper via the field label
|
||||||
var textInputs = page.Locator("input[type=text].form-control");
|
// so the selectors survive field reordering and uniquely match one element.
|
||||||
await textInputs.Nth(0).FillAsync(name);
|
await page.Locator("div.mb-3:has(label:has-text('Name')) input[type=text].form-control")
|
||||||
await textInputs.Nth(1).FillAsync("https://example.invalid/api");
|
.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();
|
await page.Locator("button.btn-success:has-text('Save')").ClickAsync();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user