ba-web-components/playwright.config.ts
Alan Bridgeman 4fe53e4ad0
Some checks failed
Build, Test, and Publish (to Private NPM Registry) UI Components Library / publish (push) Failing after 46s
Added tolerance for screenshot regression tests in the hope it fixes CI/CD issue
2026-05-13 11:42:23 -05:00

42 lines
No EOL
1.4 KiB
TypeScript

import { defineConfig, devices } from '@playwright/test';
export default defineConfig({
testDir: './test-harness/tests',
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retries for flakiness in CI */
retries: process.env.CI ? 2 : 0,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: 'html',
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
baseURL: 'http://localhost:3080',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry'
},
projects: [
{
name: 'chromium',
use: { ...devices['Desktop Chrome'] }
},
// You can add Firefox/WebKit here later if you want cross-browser testing
],
expect: {
// Configure global tolerance for visual regression tests
toHaveScreenshot: {
// Allows up to 2% of the pixels to be different before failing the test
maxDiffPixelRatio: 0.02
}
},
/* Run your local dev server before starting the tests */
webServer: {
command: 'yarn test:start', // The command to boot test-harness/server.ts
url: 'http://localhost:3080', // Playwright pings this until it gets a 2xx response
reuseExistingServer: !process.env.CI
}
});