Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test(mcp): de-flake webkit dashboard CLI tests (#41649)

Yury Semikhatskyd6bc3acaa88d
diff --git a/tests/mcp/annotate.spec.ts b/tests/mcp/annotate.spec.ts
index db69c71b43..b63eb702ab 100644
--- a/tests/mcp/annotate.spec.ts
+++ b/tests/mcp/annotate.spec.ts
@@ -228,6 +228,7 @@ test('user-initiated annotate downloads zip with feedback.md', async ({ connectT
});
test('should capture annotations via show --annotate', async ({ connectToDashboard, cli, server }) => {
+ test.slow();
await cli('open', server.EMPTY_PAGE);
const bindTitle = `--playwright-internal--${crypto.randomUUID()}`;
await cli('show', { bindTitle });
diff --git a/tests/mcp/cli-killall.spec.ts b/tests/mcp/cli-killall.spec.ts
index 2fb812ab0f..43b17bd152 100644
--- a/tests/mcp/cli-killall.spec.ts
+++ b/tests/mcp/cli-killall.spec.ts
@@ -44,11 +44,16 @@ test('kill-all kills filtered dashboard pid', async ({ cli }) => {
expect(dashboardPid).toBeDefined();
await expect.poll(() => isAlive(dashboardPid)).toBe(true);
- const { output } = await cli('kill-all', {
- env: { PWTEST_KILL_ALL_PID_FILTER_FOR_TEST: String(dashboardPid) },
- });
- expect(output).toContain(`Killed daemon process ${dashboardPid}`);
- expect(output).toContain('Killed 1 daemon process.');
+ // kill-all discovers daemons via `execSync('ps auxww')` and treats any failure
+ // (including a swallowed spawn error under load) as "no processes found", so a
+ // single call can miss a live daemon. Retry until it observes and kills it.
+ await expect(async () => {
+ const { output } = await cli('kill-all', {
+ env: { PWTEST_KILL_ALL_PID_FILTER_FOR_TEST: String(dashboardPid) },
+ });
+ expect(output).toContain(`Killed daemon process ${dashboardPid}`);
+ expect(output).toContain('Killed 1 daemon process.');
+ }).toPass();
await expect.poll(() => isAlive(dashboardPid)).toBe(false);
});