Add Chrome Specific Features
dapperdandev opened this issue · 6 comments
Similar to the request for custom arguments, should be able to utilize chrome specific features per documentation here.
I.e., Some kind of configuration that allows us to add custom chrome features to the options list
TestCafe: Run Test(s) in Chrome -- testcafe chrome tests/...
TestCafe: Run Test(s) in Chrome headless -- testcafe chrome:headless tests/...
TestCafe: RUn Tests(s) in Chrome incognito -- testcafe "chrome --incognito" tests/...
As far as I know, it's not possible to add custom items in the VS Code UI elements (like menus) via the extension's code. All extension items must be declared in the package.json file.
So, the only option I see is to setup arguments for each browser only once (in config) and they will be applied to this browser always.
@romanresh: You've already added custom items. Currently, when I right-click in my code, these options are displayed:
TestCafe: Repeat Previous Test Run
TestCafe: Run Test(s) in Chrome
TestCafe: Run Test(s) in Edge
TestCafe: Run Test(s) in Firefox
TestCafe: Run Test(s) in IE
So it would just be adding those two options in my previous comment:
TestCafe: Run Test(s) in Chrome headless
TestCafe: RUn Tests(s) in Chrome incognito
However, I'd be happy if I can make it work via the config route, but my efforts have failed.
"testcafeTestRunner.customArguments": "\"chrome --incognito\""
Hi, @djbreen7. I meant, it's not possible to add custom items in the context (and other) menu dynamically. These 5 items are hard-coded in the extension's package.json file.
The customArguments option doesn't work because its value is just added to the end of command line while test is running. While the "headless" parameter should be added to the browser name (chrome:headless). I think, the only solution is to add the special options in the configuration for each browser. Like testcafeTestRunner.chromeOptions, testcafeTestRunner.firefoxOptions, etc.
Also, I've not found the mentioning of the incognito option in the TestCafe documentation: http://devexpress.github.io/testcafe/documentation/using-testcafe/common-concepts/browser-support.html. As far as I know, TestCafe always clears browser cookies before test execution. So, there is no difference between incognito and standard mode while a test is running. Why do you want to force the incognito mode?
@romanresh: Okay. I'm tracking with you now.
The reason I want to force incognito mode is because it disables extensions. Some extensions, specifically Augury, throw console errors causing test cases to fail that have nothing to do with the app being tested. There's a thread here about it.
I could also skip-js-errors, but I do want my tests to fail in cases of app-related js errors, so incognito and headless seem to be the best options at this point in time.
@djbreen7 Just for you info, starting from the 0.18.0
version TestCafe runs tests in browsers (Chrome and Firefox) with a clean profile by default. So, it should be run without extensions. The 0.18.0
version will be released soon (in a few days), but the 0.18.0-alpha2
version is already available.
@AlexanderMoskovkin: Great! Thanks for jumping in.