Files
route-commerce/playwright.config.ts
tyler cbb9f23012
Deploy to route.crispygoat.com / deploy (push) Failing after 2m3s
chore: fix playwright config + gitignore test-results
- playwright.config.ts: add testMatch pattern so playwright only picks up
  *.spec.ts (skipping tests/unit/*.test.ts which are vitest's domain).
  Before this, 'npx playwright test' would fail trying to run vitest tests.
- .gitignore: exclude test-results/ and playwright-report/ (generated by
  'npx playwright test', not source files).
2026-06-07 06:34:54 +00:00

35 lines
1.1 KiB
TypeScript

import { defineConfig, devices } from "@playwright/test";
import path from "path";
const LOCAL_BASE = process.env.PLAYWRIGHT_URL ?? "http://localhost:3000";
const PROD_BASE = "https://route-commerce-platform.vercel.app";
export default defineConfig({
testDir: "./tests",
fullyParallel: false,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
workers: 1,
// Playwright should only run E2E specs — vitest owns everything under
// tests/unit/. The glob below matches *.spec.ts at the top of tests/ and
// tests/e2e/ and tests/login/ but skips the .test.ts files (vitest).
testMatch: /(tests\/(smoke|e2e|login)\/.*|\/[^/]+\.spec\.ts$)/,
reporter: "list",
use: {
baseURL: LOCAL_BASE,
trace: "on-first-retry",
},
projects: [
{
name: "local",
use: { ...devices["Desktop Chrome"], baseURL: LOCAL_BASE },
},
{
name: "production",
// `PLAYWRIGHT_PROD=1 npx playwright test` to run against the live site.
testMatch: /.*\.prod\.spec\.ts$/,
use: { ...devices["Desktop Chrome"], baseURL: PROD_BASE },
},
],
});