Set up Playwright for browser testing
- Playwright config for local browsers (Firefox by default) and Docker Chrome - docker-compose.chrome.yml for browserless/chrome container (arm64) - 4 connectivity smoke tests (home, contact, blog pages) - 3 auth tests (redirect, login, logout) with auth helpers - Custom fixtures with remote CDP connect support - Shell scripts for start/stop/full Docker Chrome workflow - Makefile targets: playwright, playwright-docker, playwright-full
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
import { defineConfig, devices } from "@playwright/test";
|
||||
|
||||
// Docker Chrome Playwright configuration.
|
||||
// Connects to a remote browserless/chrome container via CDP.
|
||||
//
|
||||
// Usage:
|
||||
// 1. Start the Chrome container:
|
||||
// docker compose -f docker-compose.chrome.yml up -d
|
||||
//
|
||||
// 2. Run tests:
|
||||
// npx playwright test --config=playwright.docker.config.ts
|
||||
|
||||
const CDP_URL = process.env.PLAYWRIGHT_CDP_URL || "http://localhost:3000";
|
||||
|
||||
export default defineConfig({
|
||||
testDir: "./test/e2e",
|
||||
fullyParallel: true,
|
||||
forbidOnly: !!process.env.CI,
|
||||
retries: process.env.CI ? 2 : 0,
|
||||
workers: process.env.CI ? 1 : undefined,
|
||||
reporter: "list",
|
||||
|
||||
use: {
|
||||
baseURL: process.env.PLAYWRIGHT_BASE_URL || "http://localhost:8056",
|
||||
trace: "on-first-retry",
|
||||
headless: process.env.PLAYWRIGHT_HEADLESS !== "false",
|
||||
},
|
||||
|
||||
// Connect to remote Chrome via CDP instead of launching locally.
|
||||
// browserless/chrome exposes CDP at port 3000.
|
||||
projects: [
|
||||
{
|
||||
name: "docker-chrome",
|
||||
use: {
|
||||
...devices["Desktop Chrome"],
|
||||
launchOptions: {
|
||||
// Not used for remote connection, but placeholder for clarity
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
Reference in New Issue
Block a user