test(e2e): symmetric page-load guard + document the pause-settle window (review polish)

This commit is contained in:
Joseph Doherty
2026-06-06 13:29:34 -04:00
parent 348c01c91a
commit 66b503df4d
@@ -84,6 +84,9 @@ public class DeploymentsRealtimeTests : IClassFixture<DeploymentFixture>
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<DeploymentFixture>
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);