diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiKeyCrudTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiKeyCrudTests.cs index 76d59f05..615978c6 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiKeyCrudTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Admin/ApiKeyCrudTests.cs @@ -130,12 +130,12 @@ public sealed class ApiKeyCrudTests : IClassFixture 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");