Hello, I encountered an issue while running Playwright and generating a report. Could you please assist me in resolving this?
Error: Process from config.webServer was not able to start. Exit code: 2
below is my code
// playwright.config.js
import { defineConfig, devices } from '@playwright/test';
const isShowReport = process.argv.includes('show-report');
export default defineConfig({
testDir: './tests', // Directory for test files
// Run tests in parallel
fullyParallel: true,
// Fail the build on CI if 'test.only' is left accidentally
forbidOnly: !!process.env.CI,
// Retry failing tests on CI
retries: process.env.CI ? 2 : 0,
// Limit workers on CI
workers: process.env.CI ? 1 : undefined,
// HTML reporter for test results
reporter: 'html',
use: {
// Set a base URL for your application
baseURL: 'http://127.0.0.1:5174', // Django's default dev server URL
// Collect traces for the first retry of failed tests
trace: 'on-first-retry',
// Headless mode for tests by default
headless: true,
// Base timeout for all tests
timeout: 50 * 1000,
// Screen size to simulate a desktop environment
viewport: { width: 1280, height: 720 },
// Additional options for handling Vue.js frontend
ignoreHTTPSErrors: true, // For local dev servers with self-signed certs
// Run your local Django server before starting tests
webServer: {
command: 'npm run dev',
url: 'http://localhost:5174',
timeout: 180 * 1000,
reuseExistingServer: !process.env.CI,
}
Hello, I encountered an issue while running Playwright and generating a report. Could you please assist me in resolving this? Error: Process from config.webServer was not able to start. Exit code: 2
below is my code
// playwright.config.js import { defineConfig, devices } from '@playwright/test';
// /* // Playwright configuration for a Django backend and Vue.js frontend project. // @see https://playwright.dev/docs/test-configuration // /
const isShowReport = process.argv.includes('show-report'); export default defineConfig({ testDir: './tests', // Directory for test files // Run tests in parallel fullyParallel: true, // Fail the build on CI if 'test.only' is left accidentally forbidOnly: !!process.env.CI, // Retry failing tests on CI retries: process.env.CI ? 2 : 0, // Limit workers on CI workers: process.env.CI ? 1 : undefined, // HTML reporter for test results reporter: 'html',
use: { // Set a base URL for your application baseURL: 'http://127.0.0.1:5174', // Django's default dev server URL
},
projects: [ { name: 'Desktop Chrome', use: { ...devices['Desktop Chrome'] }, }, // { // name: 'Desktop Firefox', // use: { ...devices['Desktop Firefox'] }, // }, // { // name: 'Desktop Safari', // use: { ...devices['Desktop Safari'] }, // }, ],
// Run your local Django server before starting tests webServer: { command: 'npm run dev', url: 'http://localhost:5174', timeout: 180 * 1000, reuseExistingServer: !process.env.CI, }
});