2023-12-28 05:48:14 +00:00
// playwright.config.js
// @ts-check
2024-02-21 23:29:38 +00:00
import { devices } from '@playwright/test' ;
import { fileURLToPath } from 'url' ;
2023-12-28 05:48:14 +00:00
/** @type {import('@playwright/test').PlaywrightTestConfig} */
const config = {
2024-01-11 22:47:00 +00:00
retries : 0 , //Retries are not needed with watch mode
2023-12-28 05:48:14 +00:00
testDir : 'tests' ,
timeout : 60 * 1000 ,
webServer : {
command : 'npm run start' , //Start in dev mode for hot reloading
2024-04-01 18:29:47 +00:00
cwd : fileURLToPath ( new URL ( '../' , import . meta . url ) ) , // Provide cwd for the root of the project
2023-12-28 05:48:14 +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.
} ,
2024-01-11 22:47:00 +00:00
workers : '75%' , //Limit to 75% of the CPU to support running with dev server
2023-12-28 05:48:14 +00:00
use : {
baseURL : 'http://localhost:8080/' ,
headless : true ,
ignoreHTTPSErrors : true ,
screenshot : 'only-on-failure' ,
trace : 'on-first-retry' ,
video : 'off'
} ,
projects : [
{
name : 'chrome' ,
testMatch : '**/*.spec.js' , // run all tests
use : {
browserName : 'chromium'
}
2024-02-21 23:29:38 +00:00
} ,
{
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
}
2023-12-28 05:48:14 +00:00
}
] ,
reporter : [
[ 'list' ] ,
[
'html' ,
{
open : 'never' ,
outputFolder : '../html-test-results' //Must be in different location due to https://github.com/microsoft/playwright/issues/12840
}
] ,
2024-01-11 22:47:00 +00:00
[ 'junit' , { outputFile : '../test-results/results.xml' } ]
2023-12-28 05:48:14 +00:00
]
} ;
2024-01-02 15:24:22 +00:00
export default config ;