From 84664d4b0937a03296f424293725a7083d459d92 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Mon, 12 May 2025 09:45:09 +0200 Subject: [PATCH] test: unflake 'should throw connection error and allow re-connecting' (#398) Fixes https://github.com/microsoft/playwright-mcp/actions/runs/14940263450/job/41976152764#step:8:315 --- tests/fixtures.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/fixtures.ts b/tests/fixtures.ts index ab33940..87a5aa5 100644 --- a/tests/fixtures.ts +++ b/tests/fixtures.ts @@ -120,7 +120,12 @@ export const test = baseTest.extend( }); return `http://localhost:${port}`; }); - browserProcess?.kill(); + await new Promise(resolve => { + if (!browserProcess) + return resolve(); + browserProcess.on('exit', () => resolve()); + browserProcess.kill(); + }); }, mcpHeadless: async ({ headless }, use) => {