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(); },