@@ -173,3 +173,40 @@ test('browser_get_config returns merged config from file, env and cli', async ({
173173 // From CLI arg (--isolated).
174174 expect ( config . browser . isolated ) . toBe ( true ) ;
175175} ) ;
176+
177+ test . describe ( 'chromiumSandbox' , ( ) => {
178+ test . skip ( ( { mcpBrowser } ) => mcpBrowser !== 'chrome' , 'Channel-agnostic tests.' ) ;
179+
180+ test ( 'config file value is respected' , { annotation : { type : 'issue' , description : 'https://github.com/microsoft/playwright-mcp/issues/1716' } } , async ( { startClient } ) => {
181+ const { client } = await startClient ( {
182+ config : {
183+ capabilities : [ 'config' ] ,
184+ browser : { launchOptions : { chromiumSandbox : true } } ,
185+ } ,
186+ } ) ;
187+ const config = JSON . parse ( parseResponse ( await client . callTool ( { name : 'browser_get_config' } ) ) . result ) ;
188+ expect ( config . browser . launchOptions . chromiumSandbox ) . toBe ( true ) ;
189+ } ) ;
190+
191+ test ( '--no-sandbox overrides config file value' , async ( { startClient } ) => {
192+ const { client } = await startClient ( {
193+ config : {
194+ capabilities : [ 'config' ] ,
195+ browser : { launchOptions : { chromiumSandbox : true } } ,
196+ } ,
197+ args : [ '--no-sandbox' ] ,
198+ } ) ;
199+ const config = JSON . parse ( parseResponse ( await client . callTool ( { name : 'browser_get_config' } ) ) . result ) ;
200+ expect ( config . browser . launchOptions . chromiumSandbox ) . toBe ( false ) ;
201+ } ) ;
202+
203+ test ( '--sandbox enables the sandbox' , async ( { startClient } ) => {
204+ const { client } = await startClient ( {
205+ config : { capabilities : [ 'config' ] } ,
206+ args : [ '--browser=chromium' , '--sandbox' ] ,
207+ } ) ;
208+ const config = JSON . parse ( parseResponse ( await client . callTool ( { name : 'browser_get_config' } ) ) . result ) ;
209+ expect ( config . browser . launchOptions . channel ) . toBe ( 'chrome-for-testing' ) ;
210+ expect ( config . browser . launchOptions . chromiumSandbox ) . toBe ( true ) ;
211+ } ) ;
212+ } ) ;
0 commit comments