@react-ui-org/react-ui
Version:
React UI is a themeable UI library for React apps.
69 lines (65 loc) • 2.21 kB
text/typescript
import {
defineConfig,
devices,
} from '@playwright/experimental-ct-react';
import { parseEnvironment } from './tests/playwright/env/parseEnvironment';
const environment = parseEnvironment();
const isCI = !!process.env.CI;
/**
* @see https://playwright.dev/docs/test-configuration
*/
module.exports = defineConfig({
// Fail the build on CI if you accidentally left test.only in the source code
forbidOnly: isCI,
// Run tests in files in parallel
fullyParallel: true,
// Directory where the output generated by Playwright is stored
outputDir: './tests/playwright/.temp/playwright-ct-output/',
// Run tests for following projects
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] },
},
],
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
// Retry failed tests once to eliminate flakiness
retries: 1,
// Directory where the snapshots are located
// (must be same as testDir to save snapshots in place where tests are located)
snapshotDir: './src/',
// Directory where the tests are located
testDir: './src/',
// Pattern to search for test files
testMatch: '*/*.spec.{ts,tsx}',
// Timeout for each test
timeout: 10 * 1000,
// Do not update snapshots automatically
updateSnapshots: 'none',
// Configuration for Playwright component testing
use: {
// Directory where the cache is stored
ctCacheDir: './tests/playwright/.temp/playwright-ct-cache',
// Port to use for Playwright component endpoint
ctPort: environment.CT_PORT,
// Directory where the templates are stored
ctTemplateDir: './tests/playwright/templates',
// Launch options for Playwright
launchOptions: {
args: [
'--use-gl=egl',
// # Must be set to `new` to enable new version of Chromium Headless to obtain correct snapshots
'--headless=new',
],
ignoreDefaultArgs: [
// # Must be ignored to enable new version of Chromium Headless to obtain correct snapshots
'--headless',
],
},
// Collect trace on all retries
trace: 'on-all-retries',
},
// Number of workers to use
workers: environment.WORKERS,
});