diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentsRealtimeTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentsRealtimeTests.cs index 65cd5e8b..a177126d 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentsRealtimeTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Deployment/DeploymentsRealtimeTests.cs @@ -84,6 +84,9 @@ public class DeploymentsRealtimeTests : IClassFixture var page = await _pw.NewAuthenticatedPageAsync(); await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/deployment/deployments"); await page.WaitForLoadStateAsync(LoadState.NetworkIdle); + // Confirm the page loaded before interacting (symmetric with Fact A) — a failed + // load then surfaces as a clear heading-miss rather than a confusing Pause timeout. + await Assertions.Expect(page.Locator("h4:has-text('Deployment Status')")).ToBeVisibleAsync(); // Pause — the click round-trips over the circuit, so _autoRefresh is committed // false before the deploy below. The button flipping to "Resume" proves it. @@ -93,8 +96,13 @@ public class DeploymentsRealtimeTests : IClassFixture await CliRunner.DeployInstanceAsync(instanceId); - // Paused: StatusChanged is ignored, so the row is NOT auto-added. Settle briefly to - // give any (erroneous) push time to manifest, then assert absence. + // Paused: StatusChanged is ignored, so the row is NOT auto-added. The push chain + // (deploy write → StatusChanged → InvokeAsync re-render → SignalR diff) completes + // well under a second on a healthy cluster, so a 2s settle is ample to let any + // erroneous push manifest before we assert absence. This is the one deliberate + // fixed wait — a negative real-time assertion has no DOM event to await on the + // "stayed absent" path. The Refresh-restores assertion below is the independent + // positive guard if a loaded cluster ever makes this settle empirically tight. var row = page.Locator("table tbody tr", new() { HasText = uniqueName }); await page.WaitForTimeoutAsync(2_000); await Assertions.Expect(row).ToHaveCountAsync(0);