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): bump firefox action timeout for flaky dialog cli tests (#42088)

microsoft-playwright-automation[bot]9a065d6e459d
diff --git a/tests/mcp/cli-core.spec.ts b/tests/mcp/cli-core.spec.ts
index 00dc045122..cf909bb2c3 100644
--- a/tests/mcp/cli-core.spec.ts
+++ b/tests/mcp/cli-core.spec.ts
@@ -192,9 +192,12 @@ test('eval <ref>', async ({ cli, server }) => {
expect(output).toContain('"BUTTON"');
});
-test('dialog-accept', async ({ cli, server }) => {
+// Firefox can deliver Page.dialogOpened after the default 5s action timeout
+// (seen after the FF 153 roll, especially on Windows), so the click loses the
+// modal race and the response never includes the dialog. Keep the race open longer.
+test('dialog-accept', async ({ cli, server, mcpBrowser }) => {
server.setContent('/', `<button onclick="alert('MyAlert')">Button</button>`, 'text/html');
- await cli('open', server.PREFIX);
+ await cli('open', server.PREFIX, { env: { PLAYWRIGHT_MCP_TIMEOUT_ACTION: mcpBrowser === 'firefox' ? '30000' : '' } });
const { output } = await cli('click', 'e2');
expect(output).toContain('MyAlert');
expect(output).toContain('["alert" dialog with message "MyAlert"]: can be handled by dialog-accept or dialog-dismiss');
@@ -203,9 +206,9 @@ test('dialog-accept', async ({ cli, server }) => {
expect(inlineSnapshot).not.toContain('MyAlert');
});
-test('dialog-dismiss', async ({ cli, server }) => {
+test('dialog-dismiss', async ({ cli, server, mcpBrowser }) => {
server.setContent('/', `<button onclick="alert('MyAlert')">Button</button>`, 'text/html');
- await cli('open', server.PREFIX);
+ await cli('open', server.PREFIX, { env: { PLAYWRIGHT_MCP_TIMEOUT_ACTION: mcpBrowser === 'firefox' ? '30000' : '' } });
const { output } = await cli('click', 'e2');
expect(output).toContain('MyAlert');
await cli('dialog-dismiss');
@@ -213,9 +216,9 @@ test('dialog-dismiss', async ({ cli, server }) => {
expect(inlineSnapshot).not.toContain('MyAlert');
});
-test('dialog-accept <prompt>', async ({ cli, server }) => {
+test('dialog-accept <prompt>', async ({ cli, server, mcpBrowser }) => {
server.setContent('/', `<button onclick="document.body.textContent = prompt('MyAlert')">Button</button>`, 'text/html');
- await cli('open', server.PREFIX);
+ await cli('open', server.PREFIX, { env: { PLAYWRIGHT_MCP_TIMEOUT_ACTION: mcpBrowser === 'firefox' ? '30000' : '' } });
await cli('click', 'e2');
await cli('dialog-accept', 'my reply');
const { inlineSnapshot } = await cli('snapshot');