Run the cypress test in incognito mode

50 Views Asked by At

i trying to configure github action, and i need to run the cypress test in incognito mode when I run it through a command in the terminal.

I try npx cypress run --spec "path/to/your/test-file.js" --browser chrome --config chromeWebSecurity=false, i try add this code in cypress config:

e2e: {
    setupNodeEvents(on, config) {
      // implement node event listeners here
      on('before:browser:launch', (browser = {},launchOptions) => {
        if (browser.family === 'chrome' && browser.name !== 'electron')
        launchOptions.args.push("--incognito");
        return launchOptions
      })
    }

But this helps me only when i run in with UI.

I also try npx cypress run --incognito "Path" , but it end with error: unknown option: --incognito

None of these options helped me run my test in incognito mode via a terminal command.

0

There are 0 best solutions below