test(playwright): flush ApiKey name @bind before Save to destabilize validation flake
This commit is contained in:
@@ -130,12 +130,12 @@ public sealed class ApiKeyCrudTests : IClassFixture<ApiSurfaceFixture>
|
|||||||
await Assertions.Expect(nameInput).ToBeVisibleAsync(new() { Timeout = 15_000 });
|
await Assertions.Expect(nameInput).ToBeVisibleAsync(new() { Timeout = 15_000 });
|
||||||
|
|
||||||
// Fill the name but leave ALL method checkboxes unchecked so only the method rule fires.
|
// Fill the name but leave ALL method checkboxes unchecked so only the method rule fires.
|
||||||
// The name input uses Blazor @bind (onchange), which only commits on blur — blur the input
|
// The name input uses Blazor default @bind (onchange), which only commits to the server
|
||||||
// and let the change round-trip to the server (NetworkIdle) so _formName is populated before
|
// (_formName) on change — dispatch the change event explicitly to flush the bound value
|
||||||
// Save, otherwise the name-required rule short-circuits first.
|
// before Save rather than relying on blur + NetworkIdle timing (which flakes under load),
|
||||||
|
// otherwise the name-required rule short-circuits first.
|
||||||
await nameInput.FillAsync(CliRunner.UniqueName("apikey"));
|
await nameInput.FillAsync(CliRunner.UniqueName("apikey"));
|
||||||
await nameInput.BlurAsync();
|
await nameInput.DispatchEventAsync("change");
|
||||||
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
|
|
||||||
await page.GetByRole(AriaRole.Button, new() { Name = "Save" }).ClickAsync();
|
await page.GetByRole(AriaRole.Button, new() { Name = "Save" }).ClickAsync();
|
||||||
|
|
||||||
var error = page.Locator("div.text-danger.small");
|
var error = page.Locator("div.text-danger.small");
|
||||||
|
|||||||
Reference in New Issue
Block a user