forked from
npmx.dev/npmx.dev
[READ-ONLY]
a fast, modern browser for the npm registry
1import process from 'node:process'
2import { fileURLToPath } from 'node:url'
3import { defineConfig, devices } from '@playwright/test'
4import type { ConfigOptions } from '@nuxt/test-utils/playwright'
5
6const baseURL = 'http://localhost:5678'
7
8export default defineConfig<ConfigOptions>({
9 testDir: './test/e2e',
10 fullyParallel: true,
11 forbidOnly: !!process.env.CI,
12 retries: process.env.CI ? 2 : 0,
13 reporter: 'html',
14 timeout: 120_000,
15 webServer: {
16 command: 'pnpm start:playwright:webserver',
17 url: baseURL,
18 reuseExistingServer: false,
19 timeout: 60_000,
20 },
21 // Start/stop mock connector server before/after all tests (teardown via returned closure)
22 globalSetup: fileURLToPath(new URL('./test/e2e/global-setup.ts', import.meta.url)),
23 // We currently only test on one browser on one platform
24 snapshotPathTemplate: '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{ext}',
25 use: {
26 baseURL,
27 trace: 'on-first-retry',
28 nuxt: {
29 rootDir: fileURLToPath(new URL('.', import.meta.url)),
30 host: baseURL,
31 },
32 },
33 projects: [
34 {
35 name: 'chromium-headless-shell',
36 use: { ...devices['Desktop Chrome'] },
37 },
38 ],
39})