Open History to see the last commit
1import { defineConfig, devices } from '@playwright/test'
2import {
3 getDummyServerPort,
4 getTestServerPort,
5} from '@tanstack/router-e2e-utils'
6import packageJson from './package.json' with { type: 'json' }
7β
8const PORT = await getTestServerPort(packageJson.name)
9const EXTERNAL_PORT = await getDummyServerPort(packageJson.name)
10const baseURL = `http://localhost:${PORT}`
11β
12/**
13 * See https://playwright.dev/docs/test-configuration.
14 */
15export default defineConfig({
16 testDir: './tests',
17 workers: 1,
18β
19 reporter: [['line']],
20 globalSetup: './tests/setup/global.setup.ts',
21 globalTeardown: './tests/setup/global.teardown.ts',
22 use: {
23 /* Base URL to use in actions like `await page.goto('/')`. */
24 baseURL,
25 },
26β
27 webServer: {
28 command: `VITE_NODE_ENV="test" VITE_SERVER_PORT=${PORT} VITE_EXTERNAL_PORT=${EXTERNAL_PORT} pnpm build && pnpm serve --port ${PORT}`,
29 url: baseURL,
30 reuseExistingServer: !process.env.CI,
31 stdout: 'pipe',
32 },
33β
34 projects: [
35 {
36 name: 'chromium',
37 use: { ...devices['Desktop Chrome'] },
38 },
39 ],
40})