@@ -23,65 +23,57 @@ import { createHash } from '../src/utils/guid.js';
23
23
24
24
const p = process . platform === 'win32' ? 'c:\\non\\existent\\folder' : '/non/existent/folder' ;
25
25
26
- for ( const mode of [ 'default' , 'proxy' ] ) {
27
- const extraArgs = mode === 'proxy' ? [ '--connect-tool' ] : [ ] ;
28
-
29
- test . describe ( `${ mode } mode` , ( ) => {
30
- test ( 'should use separate user data by root path' , async ( { startClient, server } , testInfo ) => {
31
- const { client } = await startClient ( {
32
- args : extraArgs ,
33
- clientName : 'Visual Studio Code' , // Simulate VS Code client, roots only work with it
34
- roots : [
35
- {
36
- name : 'test' ,
37
- uri : 'file://' + p . replace ( / \\ / g, '/' ) ,
38
- }
39
- ] ,
40
- } ) ;
41
-
42
- await client . callTool ( {
43
- name : 'browser_navigate' ,
44
- arguments : { url : server . HELLO_WORLD } ,
45
- } ) ;
26
+ test ( 'should use separate user data by root path' , async ( { startClient, server } , testInfo ) => {
27
+ const { client } = await startClient ( {
28
+ clientName : 'Visual Studio Code' ,
29
+ roots : [
30
+ {
31
+ name : 'test' ,
32
+ uri : 'file://' + p . replace ( / \\ / g, '/' ) ,
33
+ }
34
+ ] ,
35
+ } ) ;
46
36
47
- const hash = createHash ( p ) ;
48
- const [ file ] = await fs . promises . readdir ( testInfo . outputPath ( 'ms-playwright' ) ) ;
49
- expect ( file ) . toContain ( hash ) ;
50
- } ) ;
37
+ await client . callTool ( {
38
+ name : 'browser_navigate' ,
39
+ arguments : { url : server . HELLO_WORLD } ,
40
+ } ) ;
51
41
42
+ const hash = createHash ( p ) ;
43
+ const [ file ] = await fs . promises . readdir ( testInfo . outputPath ( 'ms-playwright' ) ) ;
44
+ expect ( file ) . toContain ( hash ) ;
45
+ } ) ;
52
46
53
- test ( 'check that trace is saved in workspace' , async ( { startClient, server } , testInfo ) => {
54
- const rootPath = testInfo . outputPath ( 'workspace' ) ;
55
- const { client } = await startClient ( {
56
- args : [ '--save-trace' , ... extraArgs ] ,
57
- clientName : 'Visual Studio Code - Insiders' , // Simulate VS Code client, roots only work with it
58
- roots : [
59
- {
60
- name : 'workspace' ,
61
- uri : pathToFileURL ( rootPath ) . toString ( ) ,
62
- } ,
63
- ] ,
64
- } ) ;
47
+ test ( 'check that trace is saved in workspace' , async ( { startClient, server } , testInfo ) => {
48
+ const rootPath = testInfo . outputPath ( 'workspace' ) ;
49
+ const { client } = await startClient ( {
50
+ args : [ '--save-trace' ] ,
51
+ clientName : 'My client' ,
52
+ roots : [
53
+ {
54
+ name : 'workspace' ,
55
+ uri : pathToFileURL ( rootPath ) . toString ( ) ,
56
+ } ,
57
+ ] ,
58
+ } ) ;
65
59
66
- expect ( await client . callTool ( {
67
- name : 'browser_navigate' ,
68
- arguments : { url : server . HELLO_WORLD } ,
69
- } ) ) . toHaveResponse ( {
70
- code : expect . stringContaining ( `page.goto('http://localhost` ) ,
71
- } ) ;
60
+ expect ( await client . callTool ( {
61
+ name : 'browser_navigate' ,
62
+ arguments : { url : server . HELLO_WORLD } ,
63
+ } ) ) . toHaveResponse ( {
64
+ code : expect . stringContaining ( `page.goto('http://localhost` ) ,
65
+ } ) ;
72
66
73
- const [ file ] = await fs . promises . readdir ( path . join ( rootPath , '.playwright-mcp' ) ) ;
74
- expect ( file ) . toContain ( 'traces' ) ;
75
- } ) ;
67
+ const [ file ] = await fs . promises . readdir ( path . join ( rootPath , '.playwright-mcp' ) ) ;
68
+ expect ( file ) . toContain ( 'traces' ) ;
69
+ } ) ;
76
70
77
- test ( 'should list all tools when listRoots is slow' , async ( { startClient, server } , testInfo ) => {
78
- const { client } = await startClient ( {
79
- clientName : 'Visual Studio Code' , // Simulate VS Code client, roots only work with it
80
- roots : [ ] ,
81
- rootsResponseDelay : 1000 ,
82
- } ) ;
83
- const tools = await client . listTools ( ) ;
84
- expect ( tools . tools . length ) . toBeGreaterThan ( 20 ) ;
85
- } ) ;
71
+ test ( 'should list all tools when listRoots is slow' , async ( { startClient, server } , testInfo ) => {
72
+ const { client } = await startClient ( {
73
+ clientName : 'Another custom client' ,
74
+ roots : [ ] ,
75
+ rootsResponseDelay : 1000 ,
86
76
} ) ;
87
- }
77
+ const tools = await client . listTools ( ) ;
78
+ expect ( tools . tools . length ) . toBeGreaterThan ( 20 ) ;
79
+ } ) ;
0 commit comments