tests: use run-server for mode=service tests, restrict to page tests only (#19435)
This commit is contained in:
parent
d1559a0fcc
commit
b97900b925
|
|
@ -69,14 +69,23 @@ const config: Config<CoverageWorkerOptions & PlaywrightWorkerOptions & Playwrigh
|
||||||
['html', { open: 'on-failure' }]
|
['html', { open: 'on-failure' }]
|
||||||
],
|
],
|
||||||
projects: [],
|
projects: [],
|
||||||
use: {},
|
use: {
|
||||||
|
connectOptions: mode === 'service' ? {
|
||||||
|
wsEndpoint: 'ws://localhost:3333/',
|
||||||
|
} : undefined,
|
||||||
|
},
|
||||||
|
webServer: mode === 'service' ? {
|
||||||
|
command: 'npx playwright run-server --port=3333',
|
||||||
|
port: 3333,
|
||||||
|
reuseExistingServer: !process.env.CI,
|
||||||
|
} : undefined,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (mode === 'service') {
|
if (mode === 'service2') {
|
||||||
config.webServer = {
|
config.webServer = {
|
||||||
command: 'npx playwright experimental-grid-server --auth-token=mysecret --address=http://localhost:3333 --port=3333',
|
command: 'npx playwright experimental-grid-server --auth-token=mysecret --address=http://localhost:3333 --port=3333',
|
||||||
port: 3333,
|
port: 3333,
|
||||||
reuseExistingServer: true,
|
reuseExistingServer: !process.env.CI,
|
||||||
env: {
|
env: {
|
||||||
PWTEST_UNSAFE_GRID_VERSION: '1',
|
PWTEST_UNSAFE_GRID_VERSION: '1',
|
||||||
},
|
},
|
||||||
|
|
@ -106,17 +115,6 @@ if (mode === 'service') {
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode === 'service2') {
|
|
||||||
config.webServer = {
|
|
||||||
command: 'npx playwright run-server --port=3333',
|
|
||||||
port: 3333,
|
|
||||||
reuseExistingServer: true,
|
|
||||||
};
|
|
||||||
config.use.connectOptions = {
|
|
||||||
wsEndpoint: 'ws://localhost:3333/',
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const browserNames = ['chromium', 'webkit', 'firefox'] as BrowserName[];
|
const browserNames = ['chromium', 'webkit', 'firefox'] as BrowserName[];
|
||||||
for (const browserName of browserNames) {
|
for (const browserName of browserNames) {
|
||||||
const executablePath = getExecutablePath(browserName);
|
const executablePath = getExecutablePath(browserName);
|
||||||
|
|
@ -125,6 +123,8 @@ for (const browserName of browserNames) {
|
||||||
const devtools = process.env.DEVTOOLS === '1';
|
const devtools = process.env.DEVTOOLS === '1';
|
||||||
const testIgnore: RegExp[] = browserNames.filter(b => b !== browserName).map(b => new RegExp(b));
|
const testIgnore: RegExp[] = browserNames.filter(b => b !== browserName).map(b => new RegExp(b));
|
||||||
for (const folder of ['library', 'page']) {
|
for (const folder of ['library', 'page']) {
|
||||||
|
if (mode === 'service' && folder === 'library')
|
||||||
|
continue;
|
||||||
config.projects.push({
|
config.projects.push({
|
||||||
name: browserName,
|
name: browserName,
|
||||||
testDir: path.join(testDir, folder),
|
testDir: path.join(testDir, folder),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue