playwright.config.ts

1.8 KB · raw

1import { defineConfig } from "@playwright/test";2import { fileURLToPath } from "node:url";3import { dirname, join } from "node:path";45const __filename = fileURLToPath(import.meta.url);6const __dirname = dirname(__filename);7const EXTENSION_PATH = join(__dirname, "dist-chrome");89const CI = process.env.CI === "true" || process.env.PEACH_RELEASE_BROWSER_GATE === "1";1011export default defineConfig({12  testDir: "./tests",13  timeout: 30_000,14  use: {15    headless: false,16    viewport: { width: 320, height: 600 },17    trace: CI ? "retain-on-failure" : "off",18    screenshot: CI ? "only-on-failure" : "off",19  },20  projects: [21    {22      name: "peach-extension",23      use: {24        launchOptions: {25          args: [26            `--disable-extensions-except=${EXTENSION_PATH}`,27            `--load-extension=${EXTENSION_PATH}`,28            `--no-sandbox`,29            `--disable-gpu`,30            `--disable-dev-shm-usage`,31          ],32        },33      },34      testMatch: "**/*.spec.ts",35      testIgnore: /security-sentinels\.spec\.ts/,36    },37    // PB-26-210: mandatory Chrome release browser gate.38    // Headless, deterministic timeouts, artifact capture on failure.39    // Runs security sentinels for PB-26-201 (authorization) and40    // PB-26-203 (session storage isolation).41    {42      name: "chrome-release",43      use: {44        headless: true,45        launchOptions: {46          executablePath: process.env.PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH,47          args: [48            `--disable-extensions-except=${EXTENSION_PATH}`,49            `--load-extension=${EXTENSION_PATH}`,50            `--no-sandbox`,51            `--disable-gpu`,52            `--disable-dev-shm-usage`,53          ],54        },55      },56      testMatch: /security-sentinels\.spec\.ts/,57      timeout: 120_000,58      retries: 0,59    },60  ],61});