karma + Chrome not working after last auto-update of Chrome - google-chrome

We use jenkins with a number of jenkins slave nodes running on Windows 7. Through jenkins we kick off karma tests to be run on the slave node to run our jasmine tests on the actual browsers. Suddenly last week after Chrome auto-updated to version "38.0.2125.104 m" this stopped working (karma unable to capture the browser). Here are our logs:
[INFO] --- maven-karma-plugin:1.8:start (default-cli) # module-translation ---
[INFO] Executing Karma Test Suite ...
[INFO] cmd /C karma start C:\dev\util\jenkinsMaster\workspace\ci_module_translation_browser\translation\target\test-classes\frontend\thirdParty\js\com\verisk\underwriting\config\karma-config-module\1.0.3\karma-config-module-1.0.3.js --browsers Chrome --single-run
INFO [karma]: Karma v0.12.5 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (1/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
INFO [launcher]: Trying to start Chrome again (2/2).
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
When running locally, the same command (using the karma-maven-plugin) works just fine. The karma plugin just runs the karma executable installed separately (which also works when run locally). Additionally, other browsers work when kicked off from jenkins. They have been working for quite some time now, along with Chrome (until this last update from Chrome). It is only the combination of the three: jenkins + karma + Chrome that is resulting in this issue.
Since Chrome has made it as hard as possible to get an older version, this has been very hard to test or resolve. Everything seems to be pointing to the current version of Chrome as the culprit.
Has anyone else seen this or have a solution?

The fix has been merged into Chromium. The fix is now available through a regular update of Chrome. This works for version Chrome 39.0.2171.

Related

Protractor Test cases execution fails when try to run on Headless Chrome V71

I'm using protractor for my e2e tests.
Recently we updated to Chrome 71 and Webdriver 2.45 and now we constantly
get the error: "chrome not reachable" when running headless.
If we do not run headless our tests pass. Because headless tests are more consistent en faster I still want to use headless mode.
On chrome 70 and webdriver 2.44 we had no problems at all.
args: [
'--disable-gpu',
'--disable-impl-side-painting',
'--disable-gpu-sandbox',
'--disable-accelerated-2d-canvas',
'--disable-accelerated-jpeg-decoding',
'--disable-popup-blocking',
'--no-sandbox',
'--test-type=ui',
'--start-maximized',
'--window-size=1800,1000',
'--headless'
]
WebDriverError: chrome not reachable
(Session info: headless chrome=71.0.3578.80)
(Driver info: chromedriver=2.45.615355 (d5698f682d8b2742017df6c81e0bd8e6a3063189),platform=Mac OS X 10.14.1 x86_64)
Any thoughts?
The cause in our case is most likely to be this bug in either ChromeDriver or Chrome headless:
Unable to download a file when using in headless mode (selenium, chromedriver)
Some of our tests trigger file downloads, and it appears that ChromeDriver or Chrome headless freezes from that point onward, responding to any further requests with "chrome not reachable".

Karma test error after updating Chrome

This morning I ran my unit tests and everything worked as expected with some tests failing and several passing. Then I updated Chrome to version 55 and suddenly I receive the error below, and none of my tests even run:
WARN [karma]: No captured browser, open http://localhost:/
System configuration:
OS: Windows 10
IDE: VSCode 1.7.2
Karma 1.2.0
Add below lines of code to make it work .
mime: {
'text/x-typescript': ['ts', 'tsx']
}
Source: https://github.com/angular/angular-cli/issues/2125

react-native Chrome debug from device is broken? ( Runtime not ready for debugging )

Can anyone suggest things to check for that break Chrome debug on a device? Chrome debug works fine debugging an iOS simulator.
Chrome debug of iOS devices had been working fine for over a month until it stopped working a week or so ago.
I have spent days trying to get Chrome debug working again. I even started all over, with a new "AwesomeProject". No luck.
Does Chrome Debug URL stay same for debugging both device and simulators?
http://localhost:8081/debugger-ui
Using OS X 10.11.3, Xcode 7.3, iOS 9.3, and react-native 0.22
MacBook WiFi: 173.17.29.213
iPad WiFi: 173.17.29.77
I can ping iPad from MacBook.
I can run AwesomeProject on iPad and enable live reload.
I can debug fine in a simulator when jsCodeLocation set to localhost
I killed Chrome and restarted it, opened http://localhost:8081/debugger-ui
React Packager is running
I can set Xcode breakpoints
File: AppDelegate.m
jsCodeLocation = [NSURL URLWithString:#"http://173.17.29.213:8081/index.ios.bundle?platform=ios&dev=true"];
Xcode debug console displays:
2016-03-31 08:02:12.286 [error][tid:com.facebook.react.RCTBridgeQueue][RCTWebSocketExecutor.m:85] Runtime is not ready for debugging.
- Make sure Packager server is running.
- Make sure Chrome is running and not paused on a breakpoint or exception and try reloading again.
2016-03-31 08:02:12.319 [error][tid:main][RCTWebSocketExecutor.m:132] WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"
2016-03-31 08:02:12.513 [fatal][tid:main] Runtime is not ready for debugging. Make sure Packager server is running.
2016-03-31 08:02:36.032 [error][tid:main][RCTWebSocketExecutor.m:132] WebSocket connection failed with error Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused"
2016-03-31 08:02:36.032 [error][tid:com.facebook.react.RCTBridgeQueue][RCTWebSocketExecutor.m:85] Runtime is not ready for debugging.
- Make sure Packager server is running.
- Make sure Chrome is running and not paused on a breakpoint or exception and try reloading again.
2016-03-31 08:02:36.707 [fatal][tid:main] Runtime is not ready for debugging. Make sure Packager server is running.
File: package.json
{
"name": "AwesomeProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start"
},
"dependencies": {
"react": "^0.14.8",
"react-native": "^0.22.2"
}
}
You're close, one more step and works for me at the moment after facing exact situation:
"To debug on a real device:
On iOS - open the file RCTWebSocketExecutor.m and change localhost to the IP address of your computer. Shake the device to open the development menu with the option to start debugging. [1]"
[1] https://facebook.github.io/react-native/docs/debugging.html

Karma cannot connect to Chrome in Windows 7

karma start Launches Chrome with correct URL but Chrome just sits there and spins. Also, no other url will work in that window that Karma launched.
Same behavior with Canary
Similar issue with FireFox
Opera and IE work!
if I copy/paste the URL into a functioning Chrome browser, it CONNECTS but after the original test window times out the server shuts down
For some reason I cannot launch Chrome with the user-data flag: --user-data-dir=C:\tmp\karma-7572069 -- it's the same behavior... the browser just spins and no other url works in that window
deleted all user profiles in Chrome & Firefox and re-installed them both... no go
ANY SUGGESTIONS?
After googling and pouring over umpteen similar SO issues I thought for sure it had to do with a corrupt user profile... but after wiping the Chrome user folder and re-installing etc, what else could I try?
Karma: 0.12.28
Chrome: 39.0.2171.95 m
Windows 7
debug log:
DEBUG [config]: Loading config d:\Code\test2\karma.conf.js
DEBUG [plugin]: Loading karma-* from d:\Code\test2\node_modules
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-chrome-launcher.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-firefox-launcher.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-ie-launcher.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-jasmine.
DEBUG [plugin]: Loading plugin d:\Code\test2\node_modules/karma-opera-launcher.
INFO [karma]: Karma v0.12.28 server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
DEBUG [temp-dir]: Creating temp dir at C:\tmp\karma-7572069
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\tmp\karma-7572069 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=7572069
DEBUG [watcher]: Resolved files:
d:/Code/test2/node_modules/jasmine-core/lib/jasmine-core/jasmine.js
d:/Code/test2/node_modules/karma-jasmine/lib/boot.js
d:/Code/test2/node_modules/karma-jasmine/lib/adapter.js
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\tmp\karma-7572069
INFO [launcher]: Trying to start Chrome again (1/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\tmp\karma-7572069
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\tmp\karma-7572069 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=7572069
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\tmp\karma-7572069
INFO [launcher]: Trying to start Chrome again (2/2).
DEBUG [launcher]: Restarting Chrome
DEBUG [temp-dir]: Creating temp dir at C:\tmp\karma-7572069
DEBUG [launcher]: C:\Program Files (x86)\Google\Chrome\Application\chrome.exe --user-data-dir=C:\tmp\karma-7572069 --no-default-browser-check --no-first-run --disable-default-apps --disable-popup-blocking --disable-translate http://localhost:9876/?id=7572069
WARN [launcher]: Chrome have not captured in 60000 ms, killing.
DEBUG [launcher]: Process Chrome exited with code 0
DEBUG [temp-dir]: Cleaning temp dir C:\tmp\karma-7572069
ERROR [launcher]: Chrome failed 2 times (timeout). Giving up.
DEBUG [launcher]: Disconnecting all browsers
Figured it out. My console was being run as a non-admin. Booo. Now everything works.

Karma cannot launch Chrome for Jenkins in Ubuntu 12.04

I am trying to run karma as a grunt task on a Ubuntu 12.04 machine in Jenkins CI. The issue I am running into is that karma will not open Chrome and gives the following error:
Started by GitHub push by spencerapplegate
[EnvInject] - Loading node environment variables.
Building in workspace /var/lib/jenkins/jobs/rescour-roomba master/workspace
Checkout:workspace / /var/lib/jenkins/jobs/rescour-roomba master/workspace - hudson.remoting.LocalChannel#7b41ce14
Using strategy: Default
Last Built Revision: Revision ee61ceea1b8728e90b01db04a1813284a524caed (origin/master)
Fetching changes from 1 remote Git repository
Fetching upstream changes from origin
Commencing build of Revision d3ed5ffd7c7b7a707bd9310c5bce09242e1faced (origin/master)
Checking out Revision d3ed5ffd7c7b7a707bd9310c5bce09242e1faced (origin/master)
[EnvInject] - Executing scripts and injecting environment variables after the SCM step.
[EnvInject] - Injecting as environment variables the properties content
CHROME_BIN=/opt/google/chrome/
[EnvInject] - Variables injected successfully.
[workspace] $ /bin/sh -xe /tmp/hudson5570746814297674358.sh
+ sudo npm install
+ sudo grunt buildProd
Loading "express.js" tasks...
[31mERROR[39m[31m>> [39mError: Cannot find module 'temp'
[4mRunning "clean:build" (clean) task[24m
Cleaning ".tmp"...[32mOK[39m
Cleaning "build/app"...[32mOK[39m
Cleaning "build/app-config"...[32mOK[39m
Cleaning "build/components"...[32mOK[39m
Cleaning "build/img"...[32mOK[39m
Cleaning "build/index.html"...[32mOK[39m
Cleaning "build/scripts"...[32mOK[39m
Cleaning "build/src"...[32mOK[39m
Cleaning "build/styles"...[32mOK[39m
[4mRunning "copy:local" (copy) task[24m
Created [36m370[39m directories, copied [36m2260[39m files
[4mRunning "compass:prod" (compass) task[24m
[31m[0m[32mdirectory[0m .tmp/styles/
[31m[0m[32m create[0m .tmp/styles/main.css (1.732s)
Compilation took 1.784s
[4mRunning "template:prod" (template) task[24m
[4mRunning "clean:template" (clean) task[24m
Cleaning ".tmp/index.html.template"...[32mOK[39m
[4mRunning "karma:unit" (karma) task[24m
[36m[2013-10-07 10:07:51.709] [DEBUG] config - [39mautoWatch set to false, because of singleRun
[32mINFO [karma]: [39mKarma server started at http://localhost:8079/
[32mINFO [launcher]: [39mStarting browser Chrome
[31mERROR [launcher]: [39mCannot start Chrome
[32mINFO [launcher]: [39mTrying to start Chrome again.
[31mERROR [launcher]: [39mCannot start Chrome
[32mINFO [launcher]: [39mTrying to start Chrome again.
[31mERROR [launcher]: [39mCannot start Chrome
[33mWarning: Task "karma:unit" failed. Use --force to continue.[39m
[31mAborted due to warnings.[39m
Build step 'Execute shell' marked build as failure
SSH: Current build result is [FAILURE], not going to run.
Finished: FAILURE
I have set CHROME_BIN=/opt/google/chrome and it seems like it has no issue finding the executable.
Other approaches I have taken (all unsuccessful) are:
-> Create shell script to open chrome as root with flag --user-data-dir
-> Copy all chrome files to a jenkins subdirectory /home/jenkins/opt/google/chrome
-> Change ownership of all chrome files in /opt/google/chrome to jenkins
The other oddity is that when I log into the machine as the jenkins user, chrome runs the tests fine.
Please let me know if there is any more info I need to provide. Thanks
I had the same problem. After install xvnc plugin for Jenkins (https://wiki.jenkins-ci.org/display/JENKINS/Xvnc+Plugin), problem disappeared.
For me, it was a misuse of karma start vs karma run. You need to have a karma server running, and use karma run in the jenkins job. See my question and answer here.
Edit: Lehu's answer works for both start/run.