Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions tests/mcp/cli-core.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -203,19 +206,19 @@ 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');
const { inlineSnapshot } = await cli('snapshot');
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');
Expand Down
Loading