@@ -7,7 +7,8 @@ if (!testEnv) {
7
7
throw new Error ( 'No test env defined' ) ;
8
8
}
9
9
10
- const port = Number ( process . env . BASE_PORT ) + Number ( process . env . PORT_MODULO ) ;
10
+ const nextPort = Number ( process . env . BASE_PORT ) + Number ( process . env . PORT_MODULO ) ;
11
+ const eventProxyPort = Number ( process . env . BASE_PORT ) + Number ( process . env . PORT_MODULO ) + Number ( process . env . PORT_GAP ) ;
11
12
12
13
/**
13
14
* See https://playwright.dev/docs/test-configuration.
@@ -36,7 +37,7 @@ const config: PlaywrightTestConfig = {
36
37
/* Maximum time each action such as `click()` can take. Defaults to 0 (no limit). */
37
38
actionTimeout : 0 ,
38
39
/* Base URL to use in actions like `await page.goto('/')`. */
39
- baseURL : `http://localhost:${ port } ` ,
40
+ baseURL : `http://localhost:${ nextPort } ` ,
40
41
41
42
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
42
43
trace : 'on-first-retry' ,
@@ -55,12 +56,15 @@ const config: PlaywrightTestConfig = {
55
56
/* Run your local dev server before starting the tests */
56
57
webServer : [
57
58
{
58
- command : testEnv === 'development' ? `yarn next dev -p ${ port } ` : `yarn next start -p ${ port } ` ,
59
- port,
59
+ command : 'pnpm ts-node-script start-event-proxy.ts' ,
60
+ port : eventProxyPort ,
60
61
} ,
61
62
{
62
- command : 'yarn ts-node-script start-event-proxy.ts' ,
63
- port : Number ( process . env . BASE_PORT ) + Number ( process . env . PORT_MODULO ) + Number ( process . env . PORT_GAP ) ,
63
+ command :
64
+ testEnv === 'development'
65
+ ? `pnpm wait-port ${ eventProxyPort } && pnpm next dev -p ${ nextPort } `
66
+ : `pnpm wait-port ${ eventProxyPort } && pnpm next start -p ${ nextPort } ` ,
67
+ port : nextPort ,
64
68
} ,
65
69
] ,
66
70
} ;
0 commit comments