2024-02-21 23:29:38 +00:00
// playwright.config.js
// @ts-check
import { devices } from '@playwright/test' ;
const MAX _FAILURES = 5 ;
import { fileURLToPath } from 'url' ;
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
retries : 1 , //Retries 2 times for a total of 3 runs. When running sharded and with max-failures=5, this should ensure that flake is managed without failing the full suite
testDir : 'tests' ,
2024-07-01 17:38:26 +00:00
testIgnore : '**/*.perf.spec.js' , //Ignore performance tests and define in playwright-performance.config.js
2024-02-21 23:29:38 +00:00
timeout : 30 * 1000 ,
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
2024-02-21 23:29:38 +00:00
url : 'http://localhost:8080/#' ,
timeout : 200 * 1000 ,
reuseExistingServer : true //This was originally disabled to prevent differences in local debugging vs. CI. However, it significantly speeds up local debugging.
} ,
maxFailures : MAX _FAILURES , //Limits failures to 5 to reduce CI Waste
2024-03-03 16:14:45 +00:00
workers : 1 , //Limit to 1 due to resource constraints similar to https://github.com/percy/cli/discussions/1067
2024-02-21 23:29:38 +00:00
use : {
baseURL : 'http://localhost:8080/' ,
headless : true ,
ignoreHTTPSErrors : true ,
screenshot : 'only-on-failure' ,
trace : 'on-first-retry' ,
2024-04-01 18:29:47 +00:00
video : 'off' ,
// @ts-ignore - custom configuration option for nyc codecoverage output path
2024-10-26 02:28:48 +00:00
coveragePath : fileURLToPath ( new URL ( '.nyc_output' , import . meta . url ) )
2024-02-21 23:29:38 +00:00
} ,
projects : [
{
name : 'ipad' ,
grep : /@mobile/ ,
use : {
storageState : fileURLToPath (
new URL ( './test-data/display_layout_with_child_layouts.json' , import . meta . url )
) ,
browserName : 'webkit' ,
... devices [ 'iPad (gen 7) landscape' ] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
}
} ,
{
name : 'iphone' ,
grep : /@mobile/ ,
use : {
storageState : fileURLToPath (
new URL ( './test-data/display_layout_with_child_layouts.json' , import . meta . url )
) ,
browserName : 'webkit' ,
... devices [ 'iPhone 14 Pro' ] // Complete List https://github.com/microsoft/playwright/blob/main/packages/playwright-core/src/server/deviceDescriptorsSource.json
}
}
] ,
reporter : [
[ 'list' ] ,
[
'html' ,
{
open : 'never' ,
2024-10-26 02:28:48 +00:00
outputFolder : '../../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
2024-02-21 23:29:38 +00:00
}
] ,
[ 'junit' , { outputFile : '../test-results/results.xml' } ]
]
} ;
export default config ;