Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
chore(test): fix ct tests not cleaning up dev server on test timeout (#37376)
Adam Gastineaue60d3e32665f
diff --git a/tests/components/test-all.spec.js b/tests/components/test-all.spec.jsindex 98fba8d9a2..b67bb1b9e7 100644--- a/tests/components/test-all.spec.js+++ b/tests/components/test-all.spec.js@@ -4,6 +4,8 @@ const { spawn } = require('child_process');const fs = require('fs');const path = require('path');+let activeChild = undefined;+for (const dir of fs.readdirSync(__dirname)) {const folder = path.join(__dirname, dir);if (!fs.statSync(folder).isDirectory())@@ -22,10 +24,18 @@ for (const dir of fs.readdirSync(__dirname)) {test(project, async () => {await run('npx', ['playwright', 'test', '--project=' + project, '--reporter=list'], folder);});- }+ }});}+test.afterEach(async () => {+ // Make sure to kill server even if timeout occurs+ if (activeChild) {+ activeChild.kill();+ activeChild = undefined;+ }+});+async function run(command, args, folder) {const child = spawn(command, args, {cwd: folder,@@ -33,9 +43,11 @@ async function run(command, args, folder) {shell: true,env: process.env});+ activeChild = child;child.stdout.on('data', data => process.stdout.write(data));child.stderr.on('data', data => process.stdout.write(data));process.on('exit', () => {+ activeChild = undefined;child.kill();});const code = await new Promise(f => child.on('close', f));