fix: wait for initialization to complete before listing tools (#886)

This commit is contained in:
Yury Semikhatsky
2025-08-13 17:29:10 -07:00
committed by GitHub
parent 73adb0fdf0
commit 12942b81d6
3 changed files with 15 additions and 1 deletions

View File

@@ -50,7 +50,7 @@ for (const mode of ['default', 'proxy']) {
});
test('check that trace is saved in workspace', async ({ startClient, server, mcpMode }, testInfo) => {
test('check that trace is saved in workspace', async ({ startClient, server }, testInfo) => {
const rootPath = testInfo.outputPath('workspace');
const { client } = await startClient({
args: ['--save-trace', ...extraArgs],
@@ -73,5 +73,15 @@ for (const mode of ['default', 'proxy']) {
const [file] = await fs.promises.readdir(path.join(rootPath, '.playwright-mcp'));
expect(file).toContain('traces');
});
test('should list all tools when listRoots is slow', async ({ startClient, server }, testInfo) => {
const { client } = await startClient({
clientName: 'Visual Studio Code', // Simulate VS Code client, roots only work with it
roots: [],
rootsResponseDelay: 1000,
});
const tools = await client.listTools();
expect(tools.tools.length).toBeGreaterThan(20);
});
});
}