mirror of
https://github.com/microsoft/playwright-mcp.git
synced 2025-07-25 07:52:27 +08:00
chore: remove generate_test tool for now - it adds no value (#675)
This commit is contained in:
parent
3061d9aa56
commit
825a97d66e
16
README.md
16
README.md
@ -711,22 +711,6 @@ X Y coordinate space, based on the provided screenshot.
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Testing</b></summary>
|
||||
|
||||
<!-- NOTE: This has been generated via update-readme.js -->
|
||||
|
||||
- **browser_generate_playwright_test**
|
||||
- Title: Generate a Playwright test
|
||||
- Description: Generate a Playwright test for given scenario
|
||||
- Parameters:
|
||||
- `name` (string): The name of the test
|
||||
- `description` (string): The description of the test
|
||||
- `steps` (array): The steps of the test
|
||||
- Read-only: **true**
|
||||
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>Vision mode</b></summary>
|
||||
|
||||
|
@ -26,7 +26,6 @@ import pdf from './tools/pdf.js';
|
||||
import snapshot from './tools/snapshot.js';
|
||||
import tabs from './tools/tabs.js';
|
||||
import screenshot from './tools/screenshot.js';
|
||||
import testing from './tools/testing.js';
|
||||
import vision from './tools/vision.js';
|
||||
import wait from './tools/wait.js';
|
||||
|
||||
@ -45,7 +44,6 @@ export const snapshotTools: Tool<any>[] = [
|
||||
...screenshot,
|
||||
...snapshot,
|
||||
...tabs(true),
|
||||
...testing,
|
||||
...wait(true),
|
||||
];
|
||||
|
||||
@ -60,7 +58,6 @@ export const visionTools: Tool<any>[] = [
|
||||
...network,
|
||||
...pdf,
|
||||
...tabs(false),
|
||||
...testing,
|
||||
...vision,
|
||||
...wait(false),
|
||||
];
|
||||
|
@ -1,67 +0,0 @@
|
||||
/**
|
||||
* 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 { z } from 'zod';
|
||||
import { defineTool } from './tool.js';
|
||||
|
||||
const generateTestSchema = z.object({
|
||||
name: z.string().describe('The name of the test'),
|
||||
description: z.string().describe('The description of the test'),
|
||||
steps: z.array(z.string()).describe('The steps of the test'),
|
||||
});
|
||||
|
||||
const generateTest = defineTool({
|
||||
capability: 'testing',
|
||||
|
||||
schema: {
|
||||
name: 'browser_generate_playwright_test',
|
||||
title: 'Generate a Playwright test',
|
||||
description: 'Generate a Playwright test for given scenario',
|
||||
inputSchema: generateTestSchema,
|
||||
type: 'readOnly',
|
||||
},
|
||||
|
||||
handle: async (context, params) => {
|
||||
return {
|
||||
resultOverride: {
|
||||
content: [{
|
||||
type: 'text',
|
||||
text: instructions(params),
|
||||
}],
|
||||
},
|
||||
code: [],
|
||||
captureSnapshot: false,
|
||||
waitForNetwork: false,
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
const instructions = (params: { name: string, description: string, steps: string[] }) => [
|
||||
`## Instructions`,
|
||||
`- You are a playwright test generator.`,
|
||||
`- You are given a scenario and you need to generate a playwright test for it.`,
|
||||
'- DO NOT generate test code based on the scenario alone. DO run steps one by one using the tools provided instead.',
|
||||
'- Only after all steps are completed, emit a Playwright TypeScript test that uses @playwright/test based on message history',
|
||||
'- Save generated test file in the tests directory',
|
||||
`Test name: ${params.name}`,
|
||||
`Description: ${params.description}`,
|
||||
`Steps:`,
|
||||
...params.steps.map((step, index) => `- ${index + 1}. ${step}`),
|
||||
].join('\n');
|
||||
|
||||
export default [
|
||||
generateTest,
|
||||
];
|
@ -23,7 +23,6 @@ test('test snapshot tool list', async ({ client }) => {
|
||||
'browser_console_messages',
|
||||
'browser_drag',
|
||||
'browser_file_upload',
|
||||
'browser_generate_playwright_test',
|
||||
'browser_handle_dialog',
|
||||
'browser_hover',
|
||||
'browser_select_option',
|
||||
@ -53,7 +52,6 @@ test('test vision tool list', async ({ visionClient }) => {
|
||||
'browser_close',
|
||||
'browser_console_messages',
|
||||
'browser_file_upload',
|
||||
'browser_generate_playwright_test',
|
||||
'browser_handle_dialog',
|
||||
'browser_install',
|
||||
'browser_navigate_back',
|
||||
|
@ -33,7 +33,6 @@ import pdfTools from '../lib/tools/pdf.js';
|
||||
import snapshotTools from '../lib/tools/snapshot.js';
|
||||
import tabsTools from '../lib/tools/tabs.js';
|
||||
import screenshotTools from '../lib/tools/screenshot.js';
|
||||
import testTools from '../lib/tools/testing.js';
|
||||
import visionTools from '../lib/tools/vision.js';
|
||||
import waitTools from '../lib/tools/wait.js';
|
||||
import { execSync } from 'node:child_process';
|
||||
@ -62,9 +61,6 @@ const categories = {
|
||||
'Tabs': [
|
||||
...tabsTools(true),
|
||||
],
|
||||
'Testing': [
|
||||
...testTools,
|
||||
],
|
||||
'Vision mode': [
|
||||
...visionTools,
|
||||
...keyboardTools(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user