- playwright.config.ts: desktop (1440) + mobile (Pixel 5) projects, static webServer over the exported out/; a PW_CHROME env override for the browser - tests/e2e: render + all core sections, tracked download hrefs with no R2 exposure, the live counter (mocked function), theme toggle, image loading, zero console errors, and responsive nav (desktop links / mobile menu reveal) - navbar: hide the closed mobile menu with `invisible` so its links stay out of the tab order and the accessibility tree, not merely clipped - add the test:e2e script and ignore test-results/ + playwright-report/
40 lines
1.0 KiB
TypeScript
40 lines
1.0 KiB
TypeScript
import { defineConfig, devices } from "@playwright/test";
|
|
|
|
const PORT = 4319;
|
|
const baseURL = `http://127.0.0.1:${PORT}`;
|
|
|
|
// Optional override for the Chromium binary (useful when the standard
|
|
// `playwright install` revision is unavailable locally); CI uses the bundled
|
|
// browser and leaves this unset.
|
|
const executablePath = process.env.PW_CHROME || undefined;
|
|
const launchOptions = executablePath ? { executablePath } : {};
|
|
|
|
export default defineConfig({
|
|
testDir: "./tests/e2e",
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
reporter: process.env.CI ? "line" : "list",
|
|
use: {
|
|
baseURL,
|
|
trace: "on-first-retry",
|
|
launchOptions,
|
|
},
|
|
projects: [
|
|
{
|
|
name: "desktop",
|
|
use: { ...devices["Desktop Chrome"], viewport: { width: 1440, height: 900 } },
|
|
},
|
|
{
|
|
name: "mobile",
|
|
use: { ...devices["Pixel 5"] },
|
|
},
|
|
],
|
|
webServer: {
|
|
command: `node tests/e2e/serve.mjs out ${PORT}`,
|
|
url: baseURL,
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 60_000,
|
|
},
|
|
});
|