test(playwright): flush ApiKey name @bind before Save to destabilize validation flake

This commit is contained in:
Joseph Doherty
2026-06-06 15:50:33 -04:00
parent 037184f213
commit 8f63ef08eb
@@ -130,12 +130,12 @@ public sealed class ApiKeyCrudTests : IClassFixture<ApiSurfaceFixture>
await Assertions.Expect(nameInput).ToBeVisibleAsync(new() { Timeout = 15_000 });
// 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
// and let the change round-trip to the server (NetworkIdle) so _formName is populated before
// Save, otherwise the name-required rule short-circuits first.
// The name input uses Blazor default @bind (onchange), which only commits to the server
// (_formName) on change — dispatch the change event explicitly to flush the bound value
// 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.BlurAsync();
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);
await nameInput.DispatchEventAsync("change");
await page.GetByRole(AriaRole.Button, new() { Name = "Save" }).ClickAsync();
var error = page.Locator("div.text-danger.small");