firehose/app/test/e2e/fixtures.ts
Firehose Bot 6b201e7e63 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
2026-05-18 23:12:42 +01:00

28 lines
763 B
TypeScript

/**
* Custom Playwright test fixtures.
*
* Provides a `test` function that connects to a remote Chrome via CDP
* when PLAYWRIGHT_CDP_URL is set (Docker Chrome mode).
* Falls back to the default local browser otherwise.
*/
import { test as base, chromium } from "@playwright/test";
type Fixtures = {
// Browser is provided by Playwright Test by default.
// We only override it when connecting to remote Docker Chrome.
};
const cdpUrl = process.env.PLAYWRIGHT_CDP_URL;
export const test = cdpUrl
? base.extend<Fixtures>({
browser: async ({}, use) => {
const browser = await chromium.connectOverCDP(cdpUrl);
await use(browser);
await browser.close();
},
})
: base;
export { expect } from "@playwright/test";