2021-11-30 00:34:47 +00:00
// playwright.config.js
// @ts-check
2024-04-01 18:29:47 +00:00
import { fileURLToPath } from 'url' ;
2022-07-30 00:35:43 +00:00
/** @type {import('@playwright/test').PlaywrightTestConfig<{ theme: string }>} */
2021-11-30 00:34:47 +00:00
const config = {
2023-05-18 21:54:46 +00:00
retries : 0 , // Visual tests should never retry due to snapshot comparison errors. Leaving as a shim
2023-12-19 22:16:08 +00:00
testDir : 'tests/visual-a11y' ,
2023-05-18 21:54:46 +00:00
testMatch : '**/*.visual.spec.js' , // only run visual tests
timeout : 60 * 1000 ,
workers : 1 , //Lower stress on Circle CI Agent for Visual tests https://github.com/percy/cli/discussions/1067
webServer : {
command : 'npm run start:coverage' ,
2024-04-01 18:29:47 +00:00
cwd : fileURLToPath ( new URL ( '../' , import . meta . url ) ) , // Provide cwd for the root of the project
2023-05-18 21:54:46 +00:00
url : 'http://localhost:8080/#' ,
timeout : 200 * 1000 ,
2024-06-25 05:08:01 +00:00
reuseExistingServer : true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
2023-05-18 21:54:46 +00:00
} ,
use : {
baseURL : 'http://localhost:8080/' ,
headless : true , // this needs to remain headless to avoid visual changes due to GPU rendering in headed browsers
ignoreHTTPSErrors : true ,
screenshot : 'only-on-failure' ,
trace : 'on-first-retry' ,
video : 'off'
} ,
projects : [
{
name : 'chrome' ,
use : {
browserName : 'chromium'
}
2021-11-30 00:34:47 +00:00
} ,
2023-05-18 21:54:46 +00:00
{
name : 'chrome-snow-theme' , //Runs the same visual tests but with snow-theme enabled
use : {
browserName : 'chromium' ,
theme : 'snow'
}
2024-04-25 23:06:07 +00:00
} ,
{
name : 'darkmatter-theme' , //Runs the same visual tests but with darkmatter-theme
use : {
browserName : 'chromium' ,
2024-06-19 01:16:54 +00:00
theme : 'darkmatter'
2024-04-25 23:06:07 +00:00
}
2023-05-18 21:54:46 +00:00
}
] ,
reporter : [
[ 'list' ] ,
[ 'junit' , { outputFile : '../test-results/results.xml' } ] ,
[
'html' ,
{
open : 'on-failure' ,
outputFolder : '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
}
2021-11-30 00:34:47 +00:00
]
2023-05-18 21:54:46 +00:00
]
2021-11-30 00:34:47 +00:00
} ;
2024-01-02 15:24:22 +00:00
export default config ;