mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-25 07:52:27 +08:00
79 lines
2.5 KiB
TypeScript
79 lines
2.5 KiB
TypeScript
/**
|
|
* Copyright (c) Microsoft Corporation.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import { test, expect } from './fixtures.js';
|
|
|
|
test('test snapshot tool list', async ({ client }) => {
|
|
const { tools } = await client.listTools();
|
|
expect(new Set(tools.map(t => t.name))).toEqual(new Set([
|
|
'browser_click',
|
|
'browser_console_messages',
|
|
'browser_drag',
|
|
'browser_evaluate',
|
|
'browser_file_upload',
|
|
'browser_handle_dialog',
|
|
'browser_hover',
|
|
'browser_select_option',
|
|
'browser_type',
|
|
'browser_close',
|
|
'browser_install',
|
|
'browser_navigate_back',
|
|
'browser_navigate_forward',
|
|
'browser_navigate',
|
|
'browser_network_requests',
|
|
'browser_press_key',
|
|
'browser_resize',
|
|
'browser_snapshot',
|
|
'browser_tab_close',
|
|
'browser_tab_list',
|
|
'browser_tab_new',
|
|
'browser_tab_select',
|
|
'browser_take_screenshot',
|
|
'browser_wait_for',
|
|
]));
|
|
});
|
|
|
|
test('test capabilities (pdf)', async ({ startClient }) => {
|
|
const { client } = await startClient({
|
|
args: ['--caps=pdf'],
|
|
});
|
|
const { tools } = await client.listTools();
|
|
const toolNames = tools.map(t => t.name);
|
|
expect(toolNames).toContain('browser_pdf_save');
|
|
});
|
|
|
|
test('test capabilities (vision)', async ({ startClient }) => {
|
|
const { client } = await startClient({
|
|
args: ['--caps=vision'],
|
|
});
|
|
const { tools } = await client.listTools();
|
|
const toolNames = tools.map(t => t.name);
|
|
expect(toolNames).toContain('browser_mouse_move_xy');
|
|
expect(toolNames).toContain('browser_mouse_click_xy');
|
|
expect(toolNames).toContain('browser_mouse_drag_xy');
|
|
});
|
|
|
|
test('support for legacy --vision option', async ({ startClient }) => {
|
|
const { client } = await startClient({
|
|
args: ['--vision'],
|
|
});
|
|
const { tools } = await client.listTools();
|
|
const toolNames = tools.map(t => t.name);
|
|
expect(toolNames).toContain('browser_mouse_move_xy');
|
|
expect(toolNames).toContain('browser_mouse_click_xy');
|
|
expect(toolNames).toContain('browser_mouse_drag_xy');
|
|
});
|