50 lines
1.9 KiB
TypeScript
50 lines
1.9 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
// Target: data.transquinnftw.com (prod) by default. Override in CI via
|
|
// QUINN_DATA_BASE_URL if you want to point at a staging VPS.
|
|
//
|
|
// Why a spoofed Chrome UA by default?
|
|
// quinn.data/nginx/prod.conf blocks $is_scraper in the authenticated
|
|
// dashboard locations (/, /provider/, /api/, /provider/api/, /assets/),
|
|
// and the $is_scraper map in quinn-maps.conf matches HeadlessChrome —
|
|
// which is Playwright's default UA. Without this override every dashboard
|
|
// probe in the smoke spec would return 403 (which is actually a REGRESSION
|
|
// test we do keep, under an explicit HeadlessChrome UA — see smoke.spec.ts).
|
|
//
|
|
// So: the "default" test context pretends to be a real Chrome user and
|
|
// expects 302→admin-login for the dashboard. The scraper-regression tests
|
|
// use request.newContext({ userAgent: 'HeadlessChrome...' }) explicitly.
|
|
const REAL_CHROME_UA =
|
|
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 ' +
|
|
'(KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36';
|
|
|
|
export default defineConfig({
|
|
testDir: './e2e',
|
|
timeout: 30_000,
|
|
expect: { timeout: 10_000 },
|
|
retries: process.env['CI'] ? 2 : 0,
|
|
workers: 1,
|
|
reporter: 'list',
|
|
|
|
use: {
|
|
baseURL: process.env['QUINN_DATA_BASE_URL'] ?? 'https://data.transquinnftw.com',
|
|
userAgent: REAL_CHROME_UA,
|
|
// quinn.data is behind admin auth — every dashboard request for an
|
|
// unauthenticated client should redirect. Playwright follows redirects
|
|
// for navigation by default; we disable it for request-level assertions
|
|
// so we can observe the 302 directly.
|
|
extraHTTPHeaders: {
|
|
// Signal to log-scrapers on the VPS that this traffic is synthetic.
|
|
'X-Smoke-Test': 'quinn.data',
|
|
},
|
|
ignoreHTTPSErrors: false,
|
|
...devices['Desktop Chrome'],
|
|
},
|
|
|
|
projects: [
|
|
{
|
|
name: 'chromium',
|
|
use: { ...devices['Desktop Chrome'], userAgent: REAL_CHROME_UA },
|
|
},
|
|
],
|
|
});
|