Skip to content

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

fix(mcp): handle non-deterministic contextmenu/mouseup order in right… (#39416)

Yury Semikhatsky522c2be980f6
diff --git a/tests/mcp/mouse.spec.ts b/tests/mcp/mouse.spec.ts
index 7a660bd2c6..a5ce3518dd 100644
--- a/tests/mcp/mouse.spec.ts
+++ b/tests/mcp/mouse.spec.ts
@@ -78,7 +78,7 @@ test('browser_mouse_click_xy (right button)', async ({ client }) => {
arguments: { x: 100, y: 100, button: 'right' },
})).toHaveResponse({
code: expect.stringContaining(`await page.mouse.click(100, 100, {\n button: 'right'\n});`),
- snapshot: expect.stringMatching(/mousemove 100 100.*mousedown button:2.*contextmenu button:2.*mouseup button:2/s),
+ snapshot: expect.stringMatching(/mousemove 100 100.*mousedown button:2(?=.*mouseup button:2)(?=.*contextmenu button:2)/s),
});
});