@@ -20,6 +20,7 @@ beforeEach(() => {
2020test ( 'scoped Linux tool provider handles input discovery and command execution' , async ( ) => {
2121 const commands : Array < [ string , string [ ] ] > = [ ] ;
2222 const provider = createLocalLinuxToolProvider ( {
23+ host : { env : { ...process . env , XDG_SESSION_TYPE : 'x11' } , cwd : process . cwd ( ) } ,
2324 whichCommand : async ( cmd ) => cmd === 'xdotool' ,
2425 runCommand : async ( cmd , args ) => {
2526 commands . push ( [ cmd , args ] ) ;
@@ -42,6 +43,7 @@ test('scoped Linux tool provider handles input discovery and command execution',
4243test ( 'xdotool press skips the --sync move when the pointer already sits on the target' , async ( ) => {
4344 const commands : Array < [ string , string [ ] ] > = [ ] ;
4445 const provider = createLocalLinuxToolProvider ( {
46+ host : { env : { ...process . env , XDG_SESSION_TYPE : 'x11' } , cwd : process . cwd ( ) } ,
4547 whichCommand : async ( cmd ) => cmd === 'xdotool' ,
4648 runCommand : async ( cmd , args ) => {
4749 commands . push ( [ cmd , args ] ) ;
@@ -64,6 +66,7 @@ test('xdotool press skips the --sync move when the pointer already sits on the t
6466test ( 'scoped Linux input provider handles semantic input without host tool discovery' , async ( ) => {
6567 const inputCalls : Array < [ string , string , string , string ] > = [ ] ;
6668 const provider = createLocalLinuxToolProvider ( {
69+ host : { env : { ...process . env , XDG_SESSION_TYPE : 'x11' } , cwd : process . cwd ( ) } ,
6770 whichCommand : async ( cmd ) => {
6871 throw new Error ( `unexpected input discovery: ${ cmd } ` ) ;
6972 } ,
@@ -92,10 +95,18 @@ test('scoped Linux input provider handles semantic input without host tool disco
9295
9396test ( 'Linux tool provider scopes do not share cached input tool resolution' , async ( ) => {
9497 const providerA = createLocalLinuxToolProvider ( {
98+ host : {
99+ env : { ...process . env , XDG_SESSION_TYPE : 'x11' , WAYLAND_DISPLAY : '' } ,
100+ cwd : process . cwd ( ) ,
101+ } ,
95102 whichCommand : async ( cmd ) => cmd === 'xdotool' ,
96103 runCommand : async ( ) => ( { exitCode : 0 , stdout : '' , stderr : '' } ) ,
97104 } ) ;
98105 const providerB = createLocalLinuxToolProvider ( {
106+ host : {
107+ env : { ...process . env , XDG_SESSION_TYPE : 'wayland' , WAYLAND_DISPLAY : 'wayland-0' } ,
108+ cwd : process . cwd ( ) ,
109+ } ,
99110 whichCommand : async ( cmd ) => cmd === 'ydotool' ,
100111 runCommand : async ( ) => ( { exitCode : 0 , stdout : '' , stderr : '' } ) ,
101112 } ) ;
@@ -110,6 +121,10 @@ test('Linux tool provider scopes do not share cached input tool resolution', asy
110121
111122 await withLinuxToolProvider (
112123 createLocalLinuxToolProvider ( {
124+ host : {
125+ env : { ...process . env , XDG_SESSION_TYPE : 'wayland' , WAYLAND_DISPLAY : 'wayland-0' } ,
126+ cwd : process . cwd ( ) ,
127+ } ,
113128 ...providerB ,
114129 runCommand : async ( cmd , args ) => {
115130 commands . push ( [ cmd , args ] ) ;
@@ -130,6 +145,7 @@ test('Linux tool provider scopes do not share cached input tool resolution', asy
130145test ( 'local Linux desktop provider translates semantic lifecycle calls to host tools' , async ( ) => {
131146 const commands : Array < [ string , string [ ] , boolean | undefined ] > = [ ] ;
132147 const provider = createLocalLinuxToolProvider ( {
148+ host : { env : { ...process . env , XDG_SESSION_TYPE : 'x11' } , cwd : process . cwd ( ) } ,
133149 whichCommand : async ( cmd ) => cmd === 'wmctrl' ,
134150 runCommand : async ( cmd , args , options ) => {
135151 commands . push ( [ cmd , args , options ?. allowFailure ] ) ;
@@ -151,6 +167,7 @@ test('local Linux desktop provider translates semantic lifecycle calls to host t
151167test ( 'local Linux desktop provider falls back to pkill when wmctrl is unavailable' , async ( ) => {
152168 const commands : Array < [ string , string [ ] , boolean | undefined ] > = [ ] ;
153169 const provider = createLocalLinuxToolProvider ( {
170+ host : { env : { ...process . env , XDG_SESSION_TYPE : 'x11' } , cwd : process . cwd ( ) } ,
154171 whichCommand : async ( ) => false ,
155172 runCommand : async ( cmd , args , options ) => {
156173 commands . push ( [ cmd , args , options ?. allowFailure ] ) ;
@@ -166,6 +183,7 @@ test('local Linux desktop provider falls back to pkill when wmctrl is unavailabl
166183test ( 'local Linux screenshot provider translates capture to available host tool' , async ( ) => {
167184 const commands : Array < [ string , string [ ] ] > = [ ] ;
168185 const provider = createLocalLinuxToolProvider ( {
186+ host : { env : { ...process . env , XDG_SESSION_TYPE : 'x11' } , cwd : process . cwd ( ) } ,
169187 whichCommand : async ( cmd ) => cmd === 'scrot' ,
170188 runCommand : async ( cmd , args ) => {
171189 commands . push ( [ cmd , args ] ) ;
0 commit comments