diff --git a/playwright.config.js b/playwright.config.js index 225576f9..5d0687ea 100644 --- a/playwright.config.js +++ b/playwright.config.js @@ -9,7 +9,7 @@ import { dirname, join } from 'path'; * https://github.com/motdotla/dotenv */ import dotenv from 'dotenv'; -dotenv.config({ path: join(dirname(fileURLToPath(import.meta.url)), '.env') }); +dotenv.config({ path: join(dirname(fileURLToPath(import.meta.url)), '.env'), debug: false }); /** * Auth state storage path - shared across all browser projects diff --git a/tests/auth.setup.ts b/tests/auth.setup.ts index d7cd29f6..7d42a013 100644 --- a/tests/auth.setup.ts +++ b/tests/auth.setup.ts @@ -1,7 +1,7 @@ import { test as setup } from './fixtures/test'; import type { APIRequestContext } from '@playwright/test'; import { STORAGE_STATE } from './constants'; -import { readFileSync, statSync } from 'fs'; +import { readFileSync } from 'fs'; /** * Authentication Setup for E2E Tests @@ -58,21 +58,6 @@ async function performLoginAndSaveState( await request.storageState({ path: STORAGE_STATE }); console.log(`Auth state saved to ${STORAGE_STATE}`); - // Log storage state size to diagnose CI JSON.parse OOM - try { - const { size } = statSync(STORAGE_STATE); - const sizeKiB = Math.round(size / 1024); - console.log(`Auth state size: ${size} bytes (${sizeKiB} KiB)`); - if (size > 5 * 1024 * 1024) { - console.warn( - `⚠️ Auth state file is unusually large (>5 MiB). ` + - `This can cause Node.js heap OOM when Playwright loads storageState.` - ); - } - } catch (err) { - console.warn('⚠️ Could not stat auth state file:', err instanceof Error ? err.message : err); - } - // Verify cookie domain matches expected base URL try { const savedState = JSON.parse(readFileSync(STORAGE_STATE, 'utf-8')); diff --git a/tests/fixtures/auth-fixtures.ts b/tests/fixtures/auth-fixtures.ts index 7a966b55..3dcb2ae2 100644 --- a/tests/fixtures/auth-fixtures.ts +++ b/tests/fixtures/auth-fixtures.ts @@ -24,7 +24,7 @@ import { test as base, expect } from './test'; import { request as playwrightRequest } from '@playwright/test'; -import { existsSync, readFileSync, statSync } from 'fs'; +import { existsSync, readFileSync } from 'fs'; import { TestDataManager } from '../utils/TestDataManager'; import { STORAGE_STATE } from '../constants'; @@ -89,20 +89,6 @@ export const test = base.extend({ // Validate cookie domain matches baseURL to catch configuration issues early try { - try { - const { size } = statSync(STORAGE_STATE); - const sizeKiB = Math.round(size / 1024); - console.log(`Auth state size (fixture): ${size} bytes (${sizeKiB} KiB)`); - if (size > 5 * 1024 * 1024) { - console.warn( - `⚠️ Auth state file is unusually large (>5 MiB). ` + - `This can cause Node.js heap OOM when Playwright loads storageState.` - ); - } - } catch (err) { - console.warn('⚠️ Could not stat auth state file (fixture):', err instanceof Error ? err.message : err); - } - const savedState = JSON.parse(readFileSync(STORAGE_STATE, 'utf-8')); const cookies = savedState.cookies || []; const authCookie = cookies.find((c: { name: string }) => c.name === 'auth_token');