Split up playwright suites into steps

This commit is contained in:
Daniel Imms
2023-09-08 13:09:47 -07:00
parent 328e97336b
commit 298c5b2041
2 changed files with 21 additions and 7 deletions
+6 -2
View File
@@ -259,8 +259,12 @@ jobs:
ls -R
- name: Build demo
run: yarn build-demo
- name: Integration tests
run: yarn test-playwright-${{ matrix.browser }} --forbid-only
- name: Integration tests (core)
run: yarn test-playwright-${{ matrix.browser }} --forbid-only --suite=core
- name: Integration tests (xterm-addon-canvas)
run: yarn test-playwright-${{ matrix.browser }} --forbid-only --suite=xterm-addon-canvas
- name: Integration tests (xterm-addon-webgl)
run: yarn test-playwright-${{ matrix.browser }} --forbid-only --suite=xterm-addon-webgl
test-api:
needs: build
+15 -5
View File
@@ -7,14 +7,26 @@
const cp = require('child_process');
const path = require('path');
const { setTimeout } = require('timers/promises');
const configs = [
let argv = process.argv.slice(2);
let suiteFilter = undefined;
while (argv.some(e => e.startsWith('--suite='))) {
const i = argv.findIndex(e => e.startsWith('--suite='));
const match = argv[i].match(/--suite=(?<suitename>.+)/)
suiteFilter = match?.groups?.suitename ?? undefined;
argv.splice(i, 1);
}
let configs = [
{ name: 'core', path: 'out-test/playwright/playwright.config.js' },
{ name: 'xterm-addon-canvas', path: 'addons/xterm-addon-canvas/out-test/playwright.config.js' },
{ name: 'xterm-addon-webgl', path: 'addons/xterm-addon-webgl/out-test/playwright.config.js' }
];
if (suiteFilter) {
configs = configs.filter(e => e.name === suiteFilter);
}
function npmBinScript(script) {
return path.resolve(__dirname, `../node_modules/.bin/` + (process.platform === 'win32' ?
`${script}.cmd` : script));
@@ -23,7 +35,7 @@ function npmBinScript(script) {
async function run() {
for (const config of configs) {
const command = npmBinScript('playwright');
const args = ['test', '-c', config.path, ...process.argv.slice(2)];
const args = ['test', '-c', config.path, ...argv.slice(2)];
console.log(`Running suite \x1b[1;34m${config.name}...\x1b[0m`);
console.log(`\n\x1b[32m${command}\x1b[0m`, args);
const run = cp.spawnSync(command, args, {
@@ -34,8 +46,6 @@ async function run() {
if (run.status) {
process.exit(run.status);
}
// Space out test runs to ensure servers don't step on each other
await setTimeout(1000);
}
}
run();