Run Test Cafe using Chrome incognito mode

32 views Asked by At

I am trying to get a test café script to execute using chrome incognito mode. Can this be done? I cannot seem to find any documentation on it. I feel like this should be a flag in the config file if not a command line parameter.

1

There are 1 answers

0
Pavel Morozov On

The incognito argument causes the browser to launch directly in incognito mode.

To conduct tests in incognito mode of google-chrome, you need to pass arguments for the specified browser and write them right after the browser alias. Enclose the browser call and its arguments with quotes as follows:


Using the CLI:

  • Use single quotes in *NIX shell or Microsoft PowerShell - testcafe 'chrome --incognito' test.js
  • Use double quotes in cmd.exe - testcafe "chrome --incognito" test.js

Using the Test Runner API:

await runner
.browsers('chrome --incognito')
.src('./tests/')
.run();