Testacular does not launch Chrome browser

When I run testacular with the browser settings on "Firefox", a new Firefox browser opens. I can open the console there and see my messages "console.log", etc.

When I run testacular with "browsers" set to "Chrome" or "ChromeCanary", the new browser does not open. The tests run correctly, but I do not see the console (because I do not have a browser).

I have CHROME_PATH installed in my Windows settings (and CHROME_CANARY_PATH too), I do not receive error messages related to launching the browser, and, as I said, my tests work correctly.

Any ideas why my browser doesn't open?

Answered by Vojta strong>. There is an error in the Chrome browser: http://code.google.com/p/chromium/issues/detail?id=151836 Chrome works, but it does not display the user interface.

+4
source share
1 answer

It is possible that the Vojta fix mentioned above (setting the window to maximize) solved your problem, but it did not solve it for me now, after 4 months.

My first tip is to find out exactly what the launcher uses to try to start Chrome:

karma start <yourconfig> --log-level debug 

On my system, I found two problems with karma (Testacular) version 0.8.4, one of which was enough to prevent Chrome from opening on my Windows 7 64 with Chrome 26:

1) Getting the command line is shorter and specified in Chrome

Firstly, there is something about the launch command, which in the context of its call should work, but does not work. It works if I insert it into the console myself, but not when Karma launches it. It may be too long.

To fix this

  • Put Chrome in your Windows PATH environment variable.
  • Set the Windows environment variable CHROME_BIN to "chrome.exe" only.

Now the command line will start with chrome.exe, and not the full path to it. Note that this also solves another problem (as Joe points out below) that the default path for Chrome, which Karama uses dots somewhere in your user directory, and not in your program files. Therefore, by setting this environment variable, you will force Karma to use it instead.

2) Commit data-data-dir

Next, using try-and-error, I found that the launcher command uses the equal sign after one of its parameters, which also causes Chrome to start incorrectly. I can’t explain why. But the fix is ​​easy:

  • Find the chrome.js file and change

'--user-data-dir=' + this._tempDir,

to

'--user-data-dir ' + this._tempDir,

If this helps other people, let me know, I will send a pull request. But at the moment I am in that "no one mentions this, so maybe this is just something strange in my system" ...

+3
source

Source: https://habr.com/ru/post/1447896/


All Articles