diff --git a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportExportTests.cs b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportExportTests.cs index 081ce804..53325235 100644 --- a/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportExportTests.cs +++ b/tests/ZB.MOM.WW.ScadaBridge.CentralUI.PlaywrightTests/Transport/TransportExportTests.cs @@ -57,7 +57,10 @@ public sealed class TransportExportTests { var page = await _fixture.NewAuthenticatedPageAsync("multi-role", "password"); await page.GotoAsync($"{PlaywrightFixture.BaseUrl}/design/transport/export"); - await page.WaitForLoadStateAsync(LoadState.NetworkIdle); + // Wait for Step-1 to render (OnInitializedAsync makes 8 repo calls over SignalR + // before the template tree appears — NetworkIdle is an unreliable proxy for this). + await Assertions.Expect(page.Locator("[data-testid='group-templates']")) + .ToBeVisibleAsync(new() { Timeout = 15_000 }); // ── STEP 1: Select ──────────────────────────────────────────────────────── // Narrow the tree to just the zztest template, then tick its checkbox. @@ -82,9 +85,12 @@ public sealed class TransportExportTests // ── STEP 2: Review ──────────────────────────────────────────────────────── // The seed group lists the picked template; Next is always enabled here. + // Scope the Next click to the Step-2 panel — identified by its unique + // #include-deps toggle — so it cannot accidentally match a Step-1 button. await Assertions.Expect(page.Locator("[data-testid='seed-group']")) .ToBeVisibleAsync(new() { Timeout = 15_000 }); - await page.Locator("button.btn.btn-primary:has-text('Next')").ClickAsync(); + await page.Locator("div:has(#include-deps) button.btn.btn-primary:has-text('Next')") + .ClickAsync(); // ── STEP 3: Encrypt ─────────────────────────────────────────────────────── const string passphrase = "zztest-passphrase-123";