The configuration uses the webServer array to manage local development servers required for testing. Each server entry specifies a name, cwd (current working directory), command to start the server, and the port it listens on.
To prevent conflicts in local development, reuseExistingServer is set to true (via !process.env.CI), allowing Playwright to use a server that is already running. In CI, it will always attempt to start a fresh instance.
Managed servers include:
custom-server: Located in examples/custom-server, runs npm run dev on port 3003.chat-room: Located in examples/chat-room, runs npm run dev -- --port 3001 on port 3001.base-path: Located in examples/base-path, runs npm run dev -- --port 3002 on port 3002.
Note: The redis-adapter tests are not managed here as they spawn their own instances.
webServer: [
{
name: 'custom-server',
cwd: 'examples/custom-server',
command: 'npm run dev',
env: { PORT: '3003' },
port: 3003,
reuseExistingServer: !process.env.CI,
},
{
name: 'chat-room',
cwd: 'examples/chat-room',
command: 'npm run dev -- --port 3001',
port: 3001,
reuseExistingServer: !process.env.CI,
},
{
name: 'base-path',
cwd: 'examples/base-path',
command: 'npm run dev -- --port 3002',
port: 3002,
reuseExistingServer: !process.env.CI,
},
],