Karma cannot connect to Chrome in Windows 7 - google-chrome

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.

Related

TFS (vNext) + Karma + Chrome : Chrome have not captured in 60000 ms, killing

I am trying to build our team's UI through TFS 2015(vNext) on premises builds.
I am using Grunt build step in vNext to call a gruntjs file which will build all the grunt tasks.
Currently,the build is failing because of the task is not able to Start chrome and is timing out "Chrome have not captured in 60000 ms, killing." I see it is able to start chrome for some grunt tasks but fails for some. When I run the grunt command directly calling the gruntjs file from cmdline or powershell console on the build server, it works perfectly fine but it fails from the vNext builds.
I rolled back the chrome version to "51.0.2704.103 m" from "52.0.2743.116 m" and tried but still no success.
I went through the links which discuss the same issue. But I am not sure if this is a chrome issue as it works for some grunt tasks.
I am stuck with this since past week and on the verge of giving up, any help will be really great.
Thanks
ERROR
[32m31 08 2016 11:27:53.800:INFO [karma]: [39mKarma v0.13.22 server started at http://localhost:8888/
[32m31 08 2016 11:27:53.815:INFO [launcher]: [39mStarting browser Chrome
[33m31 08 2016 11:28:49.663:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:28:49.757:INFO [launcher]: [39mTrying to start Chrome again (1/2).
[33m31 08 2016 11:28:53.834:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:28:53.912:INFO [launcher]: [39mTrying to start Chrome again (1/2).
[33m31 08 2016 11:29:49.779:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:29:49.842:INFO [launcher]: [39mTrying to start Chrome again (2/2).
[33m31 08 2016 11:29:53.931:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[32m31 08 2016 11:29:53.993:INFO [launcher]: [39mTrying to start Chrome again (2/2).
[33m31 08 2016 11:30:49.852:WARN [launcher]: [39mChrome have not captured in 60000 ms, killing.
[31m31 08 2016 11:30:49.930:ERROR [launcher]: [39mChrome failed 2 times (timeout). Giving up.
[33mWarning: Task "karma:ci" failed. Use --force to continue.[39m
[31mAborted due to warnings.[39m
[33mWarning: Use --force to continue.[39m
[31mAborted due to warnings.[39m
Grunt failed with error: C:\Users\user1\AppData\Roaming\npm\grunt.cmd failed with return code: 6
this worked for me:
1) install puppeteer
npm install puppeteer --save-dev
2) add this code to karma conf at the very top of your module exports function:
const puppeteer = require('puppeteer');
process.env.CHROME_BIN = puppeteer.executablePath();
3) disable chrome sandbox:
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}
I can reproduce your issue and fixed it by launching Chrome with "nosandbox".
Use following configuration in your karma project.conf.js:
browsers: ['ChromeNoSandbox'],
customLaunchers: {
ChromeNoSandbox: {
base: 'Chrome',
flags: ['--no-sandbox']
}
}

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 + Chrome not working after last auto-update of 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.

Running "karma:unit" (karma) task WARN [reporter]: Can not load "html", it is not registered! Perhaps you are missing some plugin?

I'm getting following warn when I ran grunt test and doesn't give me the expected result, which is writing the progress of unit tests.
error:-
Running "karma:unit" (karma) task
WARN [reporter]: Can not load "html", it is not registered!
Perhaps you are missing some plugin?
INFO [karma]: Karma v0.12.15 server started at http://localhost:8080/
INFO [launcher]: Starting browser Chrome
WARN [watcher]: Pattern "F:/AngularExamples/TestingAngular/test/mock/**/*.js" do
es not match any file.
INFO [Chrome 34.0.1847 (Windows 7)]: Connected on socket Mxn9RZeJcSW1gjL_e3d2 wi
th id 36948068
Chrome 34.0.1847 (Windows 7): Executed 1 of 1 SUCCESS (0.04 secs / 0.037 secs)
Done, without errors.
html report plugin integration in karma.config.js :-
reporters: ['progress', 'html'],
// the default configuration
htmlReporter: {
outputDir: 'karma_html',
templatePath: __dirname+'/jasmine_template.html'
},
can someone point me the cause?
First, make sure it has been installed - there should be a karma-html-reporter directory in node_modules in the directory from which you are running the tests. If not run:
npm install karma-html-reporter
Then confirm you have 'karma-html-reporter' in plugins in the conf, i.e:
plugins: [
'karma-teamcity-reporter',
'karma-jasmine',
'karma-coverage',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-html-reporter'
]

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.