Closed Victorberfeld closed 2 years ago
@Victorberfeld you should be able to remove any browser settings flags by using a before:browser:launch
event listener and filtering out any unwanted flags:
on('before:browser:launch', (browser, options) => {
// options.args contains the browser flags passed in by Cypress
options.args = options.args.filter(flag => {
if (flag === '--use-fake-ui-for-media-stream') {
return false
}
if (flag === 'some-other-flag-value') {
return false
}
return true
})
return options;
})
You can stack as many if
statements as you need to inside the filter function. That should let you add/remove whatever you need to before using cypress-browser-permission
Hi,
I want to delete the flags: 1). "--use-fake-ui-for-media-stream" 2). "--use-fake-device-for-media-stream" 3). "--use-file-for-fake-video-capture=path/to/file.y4m" And will push in the browser - ['--allow-file-access-from-files']. I use with plugin (cypressBrowserPermissionsPlugin) and used with on('before:browser:launch') function. The plugin override the function and this not work for me.
desired result: I want to delete the flags from browser and to set all permissions that I declared into Cypress.Json.