1- import type { PlaywrightTestConfig } from '@ playwright/test' ;
2- import { devices } from '@ playwright/test' ;
1+ import playwrightPackage from 'playwright/package.json' with { type : 'json' } ;
2+ import { devices , type PlaywrightTestConfig } from 'playwright/test' ;
33
44const isCI = ! ! process . env [ 'CI' ] ;
55/**
66 * See https://playwright.dev/docs/test-configuration.
77 */
88const config : PlaywrightTestConfig = {
99 testDir : './tests' ,
10+ // FIXME: remove '-linux'
11+ snapshotPathTemplate :
12+ '{snapshotDir}/{testFileDir}/{testFileName}-snapshots/{arg}{-projectName}-linux{ext}' ,
1013 /* Maximum time one test can run for. */
1114 timeout : 20 * 1000 ,
1215 expect : {
@@ -38,12 +41,17 @@ const config: PlaywrightTestConfig = {
3841
3942 /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
4043 trace : 'retain-on-failure' ,
44+
45+ connectOptions : {
46+ wsEndpoint : 'ws://127.0.0.1:3000/' ,
47+ exposeNetwork : '<loopback>' ,
48+ } ,
4149 } ,
4250 projects : [
4351 {
4452 name : 'Demo' ,
4553 testMatch : 'Demo.spec.ts' ,
46- use : { baseURL : 'http://localhost :9090' } ,
54+ use : { baseURL : 'http://127.0.0.1 :9090' } ,
4755 } ,
4856 {
4957 name : 'WebpackExample' ,
@@ -57,10 +65,26 @@ const config: PlaywrightTestConfig = {
5765 } ,
5866 ] ,
5967 outputDir : 'test-results/' ,
60- webServer : {
61- command : 'npm run serve' ,
62- url : 'http://localhost:9090/' ,
63- } ,
68+ webServer : [
69+ {
70+ name : 'playwright-server' ,
71+ env : { PLAYWRIGHT_VERSION : playwrightPackage . version } ,
72+ command :
73+ 'docker compose up --abort-on-container-exit --build playwright-server' ,
74+ url : 'http://127.0.0.1:3000/' ,
75+ stdout : 'pipe' ,
76+ timeout : 120 * 1000 ,
77+ gracefulShutdown : {
78+ signal : 'SIGINT' ,
79+ timeout : 120 * 1000 ,
80+ } ,
81+ } ,
82+ {
83+ name : 'npm run serve' ,
84+ command : 'npm run serve' ,
85+ url : 'http://localhost:9090/' ,
86+ } ,
87+ ] ,
6488} ;
6589
6690export default config ;
0 commit comments