test(centralui): fix flaky audit-grid resize-survives-reload test

ResizeHandle_DraggingWidensColumn_AndSurvivesReload called page.ReloadAsync()
immediately after the resize drag, racing the asynchronous persist: pointer-up
fires a fire-and-forget JS→.NET OnColumnResized invoke that round-trips back
through JS interop to write sessionStorage. When the reload won the race the
restored grid fell back to the default column width and the test failed
(~1 in 3 runs).

Wait for auditGrid:columnWidths to land via the existing WaitForStorageKeyAsync
helper before reloading — the same guard the sibling
ColumnOrderAndWidths_PersistAcrossReload_ViaSessionStorage test already uses.
Verified: 6/6 consecutive passes.
This commit is contained in:
Joseph Doherty
2026-05-22 08:00:46 -04:00
parent c07cc379e6
commit bb6f6aaa54

View File

@@ -146,6 +146,14 @@ public class AuditGridColumnTests
Assert.True(after > before + 40,
$"Expected the {columnKey} column to widen after the resize drag (before={before}, after={after}).");
// The resize persists asynchronously: pointer-up fires a
// fire-and-forget JS→.NET OnColumnResized invoke, and the .NET
// handler then round-trips back through JS interop to write
// sessionStorage. Wait for that write to land before reloading —
// otherwise the reload races it and the restored grid falls back
// to the default width.
await WaitForStorageKeyAsync(page, "auditGrid:columnWidths");
// Reload: the persisted width is restored from sessionStorage.
await page.ReloadAsync();
await page.WaitForLoadStateAsync(LoadState.NetworkIdle);