From 3b950fb7b5573fa4e5016878818809c027955a35 Mon Sep 17 00:00:00 2001 From: Sahil Shah Date: Wed, 29 Jul 2026 10:16:36 -0400 Subject: [PATCH] CONSOLE-5196: Refresh admin auth between packages to prevent session expiry MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auth storageState is created once at test start. On CI with 300+ tests and 2 workers (~50 min runtime), the OAuth session can expire mid-run, causing every subsequent test to fail with an OAuth redirect in warmupSPA. Chain auth refresh projects between every package so each package starts with a fresh token: admin-auth → smoke → refresh-1 → console → refresh-2 → dev-console → ... Each refresh project reuses admin-auth.setup.ts (no new setup file needed). Every package gets fresh auth regardless of how many tests any individual package has. Scales automatically as packages are added. Overhead is ~35s total (7 refreshes × ~5s each). Co-Authored-By: Claude Opus 4.6 (1M context) --- frontend/playwright.config.ts | 42 ++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/frontend/playwright.config.ts b/frontend/playwright.config.ts index e301d244394..b4b8e943b10 100644 --- a/frontend/playwright.config.ts +++ b/frontend/playwright.config.ts @@ -29,6 +29,13 @@ const packages = [ // Packages that also have developer-persona tests const devPackages = ['smoke', 'dev-console', 'topology', 'webterminal']; +const setupDir = path.resolve(__dirname, 'e2e', 'setup'); +const chromeAuth = { + ...devices['Desktop Chrome'], + userAgent: INTEGRATION_TEST_USER_AGENT, + ignoreHTTPSErrors: true, +}; + const chromeArgs = [ '--ignore-certificate-errors', '--window-size=1920,1080', @@ -127,16 +134,31 @@ export default defineConfig({ testMatch: 'teardown.setup.ts', }, - ...packages.map((pkg) => ({ - name: pkg, - testDir: path.resolve(__dirname, 'e2e', 'tests', pkg), - testIgnore: '**/developer/**', - dependencies: ['admin-auth'], - use: { - ...chrome, - storageState: adminStorageState, - }, - })), + ...packages.flatMap((pkg, i) => { + const prevDep = i === 0 ? 'admin-auth' : packages[i - 1]; + const refreshProject = + i > 0 + ? [ + { + name: `admin-auth-refresh-${i}`, + testDir: setupDir, + testMatch: 'admin-auth.setup.ts', + dependencies: [prevDep], + use: { ...chromeAuth, launchOptions: { args: chromeArgs } }, + }, + ] + : []; + return [ + ...refreshProject, + { + name: pkg, + testDir: path.resolve(__dirname, 'e2e', 'tests', pkg), + testIgnore: '**/developer/**', + dependencies: [i > 0 ? `admin-auth-refresh-${i}` : 'admin-auth'], + use: { ...chrome, storageState: adminStorageState }, + }, + ]; + }), ...(hasDeveloper ? devPackages.map((pkg) => ({ name: `${pkg}-developer`,