From 6771d7fae8814adc55538c2ef40b8f2975cedb19 Mon Sep 17 00:00:00 2001 From: master <> Date: Fri, 3 Apr 2026 07:41:35 +0300 Subject: [PATCH] Prime liveAuthPage with integrations navigation after login Fix for the 2 remaining OIDC redirect failures: after login, the page lands on Dashboard. When a test calls page.goto('/setup/...'), Angular sometimes redirects back to Dashboard because the auth guard hasn't settled. Fix: After loginAndGetToken, navigate to /setup/integrations and wait for [role="tab"] to render. This: 1. Settles the OIDC auth guard (validates token, caches auth state) 2. Lazy-loads the integration module chunk 3. Primes Angular's router with the /setup/ route tree Subsequent page.goto() calls from tests will work reliably because Angular already has auth state and the lazy chunk is cached. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../tests/e2e/integrations/live-auth.fixture.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/Web/StellaOps.Web/tests/e2e/integrations/live-auth.fixture.ts b/src/Web/StellaOps.Web/tests/e2e/integrations/live-auth.fixture.ts index 84e9659e7..13446f55b 100644 --- a/src/Web/StellaOps.Web/tests/e2e/integrations/live-auth.fixture.ts +++ b/src/Web/StellaOps.Web/tests/e2e/integrations/live-auth.fixture.ts @@ -128,11 +128,20 @@ export const test = base.extend({ await ctx.dispose(); }, { scope: 'worker' }], - // Test-scoped: each UI test gets a fresh authenticated page + // Test-scoped: each UI test gets a fresh authenticated page. + // After login, navigate to integrations to prime the auth guard + // and lazy-load the integration module. This prevents the OIDC + // callback race where page.goto() redirects back to Dashboard. liveAuthPage: async ({ browser }, use) => { const context = await browser.newContext({ ignoreHTTPSErrors: true }); const page = await context.newPage(); await loginAndGetToken(page); + + // Prime: navigate to integrations shell and wait for tabs to render. + // This ensures auth guard is settled and lazy chunks are loaded. + await page.goto(`${BASE_URL}/setup/integrations`, { waitUntil: 'load', timeout: 30_000 }).catch(() => {}); + await page.waitForSelector('[role="tab"]', { timeout: 20_000 }).catch(() => {}); + await use(page); await context.close(); },