Files
SnapOtter/playwright.landing.config.ts
T
SnapOtter 2927e0d4be fix(e2e): disable Astro Dev Toolbar during landing e2e tests
The Astro Dev Toolbar (enabled by default in dev mode) injects h1
elements ("No islands detected", "Audit", "Settings") and a
"Community" link inside its shadow DOM. Playwright CSS selectors
pierce shadow DOM, causing 6 test failures:

- 5 heading-hierarchy tests saw extra h1 elements from the toolbar
- footer "Community" column title resolved to 2 elements (footer h4
  plus toolbar's Astro community chat link)

Root-cause fix: set PLAYWRIGHT=1 env var in the Playwright webServer
command; Astro config conditionally disables devToolbar when set.
Normal development retains the toolbar.
2026-06-21 12:13:48 +08:00

31 lines
699 B
TypeScript

import { defineConfig, devices } from "@playwright/test";
const LANDING_PORT = 4350;
export default defineConfig({
testDir: "./tests/e2e-landing",
timeout: 30_000,
expect: { timeout: 10_000 },
fullyParallel: true,
retries: 0,
workers: 1,
reporter: "html",
use: {
baseURL: `http://localhost:${LANDING_PORT}`,
screenshot: "only-on-failure",
trace: "retain-on-failure",
},
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},
],
webServer: {
command: `cd apps/landing && PLAYWRIGHT=1 npx astro dev --port ${LANDING_PORT}`,
port: LANDING_PORT,
reuseExistingServer: !process.env.CI,
timeout: 60_000,
},
});