Compare commits
8 Commits
copilot/fi
...
copilot/fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
47a73de357 | ||
|
|
d9d5e3f7ed | ||
|
|
0c8a2c9c70 | ||
|
|
ce1652d7af | ||
|
|
269d8d8a4d | ||
|
|
2acdc66c27 | ||
|
|
723ad2a9a6 | ||
|
|
9f8441daa5 |
@@ -99,7 +99,13 @@ Click <code>Save</code>.
|
||||
<details>
|
||||
<summary>VS Code</summary>
|
||||
|
||||
You can also install the Playwright MCP server using the VS Code CLI:
|
||||
#### Click the button to install:
|
||||
|
||||
[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522%2540playwright%252Fmcp%2540latest%2522%255D%257D)
|
||||
|
||||
#### Or install manually:
|
||||
|
||||
Follow the MCP install [guide](https://code.visualstudio.com/docs/copilot/chat/mcp-servers#_add-an-mcp-server), use the standard config above. You can also install the Playwright MCP server using the VS Code CLI:
|
||||
|
||||
```bash
|
||||
# For VS Code
|
||||
|
||||
@@ -49,3 +49,24 @@ test('browser_evaluate (element)', async ({ client, server }) => {
|
||||
},
|
||||
})).toContainTextContent(`- Result: "red"`);
|
||||
});
|
||||
|
||||
test('browser_evaluate (error)', async ({ client, server }) => {
|
||||
expect(await client.callTool({
|
||||
name: 'browser_navigate',
|
||||
arguments: { url: server.HELLO_WORLD },
|
||||
})).toContainTextContent(`- Page Title: Title`);
|
||||
|
||||
// Test with a bogus expression that will cause a JavaScript error
|
||||
const result = await client.callTool({
|
||||
name: 'browser_evaluate',
|
||||
arguments: {
|
||||
function: '() => { undefinedVariable.nonExistentMethod(); }',
|
||||
},
|
||||
});
|
||||
|
||||
// Check that error MCP response is returned
|
||||
expect(result.isError).toBe(true);
|
||||
|
||||
// Check that JavaScript error details are contained in the response
|
||||
expect(result.content?.[0].text).toContain('undefinedVariable is not defined');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user