140 lines
2.6 KiB
TypeScript
140 lines
2.6 KiB
TypeScript
import { defineConfig, devices } from '@playwright/test';
|
|
|
|
/**
|
|
* Playwright Configuration
|
|
* Generated by playwright-e2e-automation skill
|
|
*
|
|
* Framework: {{FRAMEWORK_NAME}}
|
|
* Base URL: {{BASE_URL}}
|
|
* Generated: {{GENERATED_DATE}}
|
|
*/
|
|
|
|
export default defineConfig({
|
|
testDir: './tests/specs',
|
|
|
|
/**
|
|
* Maximum time one test can run for
|
|
*/
|
|
timeout: {{TIMEOUT}},
|
|
|
|
/**
|
|
* Test execution settings
|
|
*/
|
|
fullyParallel: true,
|
|
forbidOnly: !!process.env.CI,
|
|
retries: process.env.CI ? 2 : 0,
|
|
workers: process.env.CI ? 1 : undefined,
|
|
|
|
/**
|
|
* Reporter configuration
|
|
* CI: GitHub Actions reporter
|
|
* Local: HTML reporter with screenshots
|
|
*/
|
|
reporter: process.env.CI
|
|
? 'github'
|
|
: [
|
|
['html', { outputFolder: 'playwright-report' }],
|
|
['json', { outputFile: 'test-results/results.json' }],
|
|
],
|
|
|
|
/**
|
|
* Shared settings for all projects
|
|
*/
|
|
use: {
|
|
/* Base URL for navigation */
|
|
baseURL: '{{BASE_URL}}',
|
|
|
|
/* Collect trace on first retry */
|
|
trace: 'on-first-retry',
|
|
|
|
/* Screenshot settings */
|
|
screenshot: {
|
|
mode: 'only-on-failure',
|
|
fullPage: true,
|
|
},
|
|
|
|
/* Video settings */
|
|
video: 'retain-on-failure',
|
|
|
|
/* Maximum time each action can take */
|
|
actionTimeout: 10000,
|
|
|
|
/* Navigation timeout */
|
|
navigationTimeout: 30000,
|
|
},
|
|
|
|
/**
|
|
* Browser and device configurations
|
|
*/
|
|
projects: [
|
|
{
|
|
name: 'chromium-desktop',
|
|
use: {
|
|
...devices['Desktop Chrome'],
|
|
viewport: { width: 1280, height: 720 },
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'firefox-desktop',
|
|
use: {
|
|
...devices['Desktop Firefox'],
|
|
viewport: { width: 1280, height: 720 },
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'webkit-desktop',
|
|
use: {
|
|
...devices['Desktop Safari'],
|
|
viewport: { width: 1280, height: 720 },
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'mobile-chrome',
|
|
use: {
|
|
...devices['Pixel 5'],
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'mobile-safari',
|
|
use: {
|
|
...devices['iPhone 13'],
|
|
},
|
|
},
|
|
|
|
{
|
|
name: 'tablet',
|
|
use: {
|
|
...devices['iPad Pro'],
|
|
},
|
|
},
|
|
],
|
|
|
|
/**
|
|
* Web server configuration
|
|
* Starts dev server before running tests
|
|
*/
|
|
webServer: {
|
|
command: '{{DEV_SERVER_COMMAND}}',
|
|
url: '{{BASE_URL}}',
|
|
reuseExistingServer: !process.env.CI,
|
|
timeout: 120 * 1000,
|
|
stdout: 'pipe',
|
|
stderr: 'pipe',
|
|
},
|
|
|
|
/**
|
|
* Output directories
|
|
*/
|
|
outputDir: 'test-results',
|
|
|
|
/**
|
|
* Global setup/teardown
|
|
*/
|
|
globalSetup: require.resolve('./tests/setup/global-setup.ts'),
|
|
globalTeardown: require.resolve('./tests/setup/global-teardown.ts'),
|
|
});
|