diff --git a/tests/mcp/cli-core.spec.ts b/tests/mcp/cli-core.spec.ts index 00dc045122414..cf909bb2c331f 100644 --- a/tests/mcp/cli-core.spec.ts +++ b/tests/mcp/cli-core.spec.ts @@ -192,9 +192,12 @@ test('eval ', 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('/', ``, '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('/', ``, '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 ', async ({ cli, server }) => { +test('dialog-accept ', async ({ cli, server, mcpBrowser }) => { server.setContent('/', ``, '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');