Testcafe: Start browser in a clean/empty profile when running locally

Created on 18 Jul 2017  路  4Comments  路  Source: DevExpress/testcafe

Are you requesting a feature or reporting a bug?

It depends, although this one is more of a feature request I think...

What is the current behavior?

When running tests locally, it will start browsers using the current user profile. It might also have some localStorage present and leave some history/other things behind. To make sure the browser is as clean as possible, we now start (for example) Chrome with a lot of flags: chrome --enable-automation --start-maximized --disable-default-apps --disable-translate --disable-extensions --disable-background-networking --safebrowser-disable-auto-update --disable-sync --no-first-run --no-default-browser-check. This doesn't look real nice, and for some reason, setting --user-data-dir doesn't seem to work when running from TestCafe.

What is the expected behavior?

I would expect the browser to be run from a clean profile, for example what happens when working with SeleniumWebdriver. It will start Chrome with an empty profile (no extensions, bookmarks etc), shows the automation message etc.
The request also applies to other browsers such as Firefox.

For chrome there is alo a launcher util setting lots of these flags, might be interesting to use instead of directly calling chrome? https://github.com/GoogleChrome/lighthouse

Specify your

  • operating system: Windows 10
  • testcafe version: 0.15
  • node.js version: 8.1.4
Auto-locked browser natives enhancement

Most helpful comment

Actually, you can just create an empty directory, and use it in -profile argument. Also, probably you will use some arguments to start a new instance (-no-remote -new-instance). So the result is:

mkdir /tmp/firefox-tmp-profile
firefox -no-profile -new-instance -profile /tmp/firefox-tmp-profile

All 4 comments

While we have troubles with the --private-window mode in Firefox (see #1675) you can try to run the tests with the clean Firefox user profile.

For example, here is a way how I did it on Windows:

"C:\Program Files\Mozilla Firefox\firefox.exe" -CreateProfile TestCafeUser
testcafe "firefox -P TestCafeUser" test.js

or the same for Mac OS:

/Applications/Firefox.app/Contents/MacOS/firefox -P TestCafeUser
testcafe "firefox -P TestCafeUser" test.js

More about Firefox Profiles here.

Actually, you can just create an empty directory, and use it in -profile argument. Also, probably you will use some arguments to start a new instance (-no-remote -new-instance). So the result is:

mkdir /tmp/firefox-tmp-profile
firefox -no-profile -new-instance -profile /tmp/firefox-tmp-profile

Closed in #1792

This thread has been automatically locked since it is closed and there has not been any recent activity. Please open a new issue for related bugs or feature requests. We recommend you ask TestCafe API, usage and configuration inquiries on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fnlctrl picture fnlctrl  路  3Comments

AndreyBelym picture AndreyBelym  路  3Comments

Turkirafaa picture Turkirafaa  路  3Comments

madroneropaulo picture madroneropaulo  路  3Comments

Lukas-Kullmann picture Lukas-Kullmann  路  3Comments