spanwright
Version:
CLI tool to generate Cloud Spanner E2E testing framework projects with Go database tools and Playwright browser automation
76 lines (64 loc) • 2.39 kB
text/typescript
import { defineConfig, devices } from '@playwright/test';
/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// require('dotenv').config();
/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: './scenarios',
/* Run tests in files in parallel with shared database */
fullyParallel: false, // Parallel execution with shared database setup
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Allow parallel execution with shared database setup */
workers: 1, // Limit workers in CI, more locally
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [['html'], ['list'], ['json', { outputFile: 'test-results/results.json' }]],
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: process.env.BASE_URL || 'http://localhost:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry',
/* Take screenshot on failure */
screenshot: 'only-on-failure',
/* Capture video on failure */
video: 'retain-on-failure',
/* Maximum time each action such as `click()` can take */
actionTimeout: 30000,
},
/* Global setup and teardown for shared database management */
globalSetup: require.resolve('./tests/global-setup'),
globalTeardown: require.resolve('./tests/global-teardown'),
/* Configure projects for major browsers */
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
// Other browsers can be added as needed
// {
// name: 'firefox',
// use: { ...devices['Desktop Firefox'] },
// },
// {
// name: 'webkit',
// use: { ...devices['Desktop Safari'] },
// },
],
/* Maximum time one test can run for */
timeout: 60000,
/* Maximum time the whole test suite can run */
globalTimeout: 600000,
/* Run your local dev server before starting the tests */
// webServer: {
// command: 'npm run start',
// url: 'http://localhost:3000',
// reuseExistingServer: !process.env.CI,
// },
});