-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Karma is not able to run test cases on phantomJS #558
Comments
Same for me, worked fine yesterday at office. Should check karma version there. |
Just ran into this issue this morning when I updated NodeJS. My Karma version is 0.8.5 When using version 0.8.17 of Node (was my previous version) I have no problems.
Here is an example of it failing with debug logging using NodeJS version 0.10.8
This works fine with Firefox and Chrome as the browsers. Is there anything else I can provide for further debugging? EDIT: It appears it also works fine with NodeJS version 0.10.4 so somewhere between 0.10.4 and 0.10.8 it breaks. |
@TheDude05 you're right, i also updated to 0.10.8 today. Node 0.10.7 had a serious bug on NPM (isaacs/npm#3443), so didn't tested with it, but i'm sure it works on 0.10.6, which is the version i had yesterday working at my office. Meanwhile, here is Node 0.10.6. |
Same for me. Upgraded from node 0.10.7 to 0.10.8 (Ubuntu 12.04.2 LTS) |
Confirmed that it works fine with Node 0.10.7. It appears the latest 0.10.8 is the only version that causes problems |
Yeah we upgraded to 0.10.8 and have the same problem. |
This is the cause of breakage on 0.10.8/9: socketio/socket.io#1242 (comment) |
A quick fix is to change to the xhr-polling transport here: https://github.com/karma-runner/karma/blob/master/lib/server.js#L43 Ideally karma should expose the socket.io transport through user configuration. Or just switch to sockjs which uses a saner websocket parser through faye-websocket. |
I can confirm it doesn't work in 0.10.9. Since I am in OSX, I used this to move to 0.10.6: http://andrestorres.me/Programming/2012/04/27/switching-between-node-versions-with-brew/ |
Same issue. Ubuntu 12.04, nodejs 0.10.9, karma 0.8.5 |
Same issue. I temporarily resolved it using uggedal's suggestion - I removed 'websocket' from the list of acceptable transports in https://github.com/karma-runner/karma/blob/master/lib/server.js#L43 |
👍 |
Confirmed this still seems to be broken in 0.10.10 (despite the above-linked socket.io issue having been fixed in 0.10.10?). The workaround (removing 'webdriver') does work. |
👍 same issue Mac OS X 10.8.3 Downgrading to node 0.10.6 solved the problem:
|
👍 |
Same issue: Ubuntu 12.04, node 0.10.10 and karma 0.8.5. |
Same issue: OSX 10.8, works on node 0.10.7 but not on 0.10.8 |
Same issue: Linux Mint 15, node 0.10.10, karma 0.8.5 |
Same issue, workaround specified above does not work for me. Windows 7 x64 |
@tcrosen Downgrade to Node 0.8 by the moment, at least works there |
Same issue, and workaround is not working (unable to downgrade node). |
This is now a major issue at work, putting our continued use of Karma in jeopardy. |
@ernestokarim easier to just run in Chrome and deal with an extra browser window until this is fixed. |
@tcrosen That's fine for my dev machine, but our build servers are headless—no browsers but phantomjs. |
Any idea if/when this might get addressed so that no patching/work arounds/downgrades/etc. are no longer required? Had hoped 0.10.10 would have taken care of it, but we are still seeing it. |
As per my previous comment: the bug is in socket.io. Not Karma nor Node.js. |
So supposedly this is fixed in Node 0.10.10 but it was still busted for me after upgrading node. I tried upgrading socket.io to 0.9.15 but doesn't seem like that does it either. Removing 'websocket' from server.js fixes it for me, but I'd love to see karma@canary + karma-phantomjs-launcher work in the npm version. Any ideas?
|
Hi, i'm not able execute all of the test case because of this error(skip few of the test case while executing.) how to debug this error |
Hey, guys how can i debug the jasmine unit test case to trace error.. Please suggest me the root cause of this. |
One scenario I have found that is reproducable is when a developer checks in a file that depends on a file that is not checked into source. The tests fail when they try to find that file. So in terms of AMD / requirejs: moduleA.js would have this: then a test would define(['moduleA'], function(a) { describe .. jasmine test stuff.... moduleB does not exist so then error Running "karma:common" (karma) task� WARN [web-server]: �404: /base/src/moduleB.js WARN [PhantomJS 1.9.8 (Linux 0.0.0)]: �Disconnected (1 times), because no message in 10000 ms. |
Hey Hi....I have also faced the same issue...just anywhere in your test cases you might have used "SpyOn(window, 'location')" and immediate after that u have not called any jasmine matcher like "toHaveBeenCalled" that results into reloading issue.....also check that all dependencies are spelled and injected properly....I am sure you'll get the solution...! |
@VikrantGodse thanks, its working. |
Same issue here... Node: 4.2.2 This is how we run it karma start "web/js2/test/karma.conf.js" --no-colors --single-run --log-level info --reporters dots
19 11 2015 15:22:07.682:INFO [karma]: Karma v0.13.15 server started at http://localhost:9877/
19 11 2015 15:22:07.695:INFO [launcher]: Starting browser PhantomJS
19 11 2015 15:22:27.706:WARN [launcher]: PhantomJS have not captured in 20000 ms, killing.
19 11 2015 15:22:27.722:INFO [launcher]: Trying to start PhantomJS again (1/2).
19 11 2015 15:22:47.729:WARN [launcher]: PhantomJS have not captured in 20000 ms, killing.
19 11 2015 15:22:47.739:INFO [launcher]: Trying to start PhantomJS again (2/2).
19 11 2015 15:23:07.743:WARN [launcher]: PhantomJS have not captured in 20000 ms, killing.
19 11 2015 15:23:07.749:ERROR [launcher]: PhantomJS failed 2 times (timeout). Giving up. Also tried with longer timeouts of 2 minutes, but it just doesn't work. Running phantomjs manually like this seems to work since it just gives me the node_modules/phantomjs/bin/phantomjs
phantomjs> |
I got an issue with phantomjs/ karmajs: INFO [karma]: Karma v0.12.37 server started at http://localhost:9876/ node --version v0.12.7 |
Same here 03 12 2015 14:56:09.385:WARN [karma]: No captured browser, open http://localhost:9876/ 03 12 2015 14:56:11.005:INFO [launcher]: Trying to start PhantomJS again (1/2). 03 12 2015 14:56:12.387:INFO [launcher]: Trying to start PhantomJS again (2/2). 03 12 2015 14:56:13.371:ERROR [launcher]: PhantomJS failed 2 times (cannot start). Giving up. Karma v0.13.10 |
I have tried adding lots of options to this and found that when phantomjs does this it is a problem in the code. Unfortunately finding out where is a bit more difficult, you have to set the logLevel to config.DEBUG and then run in verbose debugging mode. It usually spits out more info there. I recommend running jshint / jslint or eslint on both your code AND your tests and looking for any undefined variables or other syntax errors. Things like extra commas and missing semicolons can cause issues in phantomjs/karma. Make sure any async code is coded correctly. Lastly, make sure you do not have an it with no expects in it if you are using jasmine. We found that to be problematic. Ultimately though one of the tests is bad. |
I recently started running into this issue as well: https://ci.appveyor.com/project/Exceptionless/exceptionless-ui/build/2.2.625 |
How to configure karma_start.js to disable web security and local to remote url access using phantom launcher? |
hareesh@hareesh-VPCEA12EN:~/Desktop/pstnwebapp/test$ gulp test i ran yo generator & test with gulp i got above error please send solution |
So, i've been using ES6 in my code ( function arrows, const, and let) and it is those lines that karma actually breaks on. It looks like you need another preprocessor to transpile the ES6 before karma can run properly. This module will probably fix the errors for you. https://github.com/babel/karma-babel-preprocessor I'm in the process of installing now. Will update once that is finished. Also, setting "logLevel: config.DEBUG," in your karma.confg.js and running grunt test with a "-v" flag also helped me figure out what lines it was really breaking on. UPDATE: Everything works now, I got karma-babel-preprocessor to transpile my ES6 code before karma ran its tests. Also, double check that your test files are actually loaded as well in "files: [ ]". After I got the errors to subside, it took me a second to figure out why it kept running 0 of 0 tests. |
I solved this issue by deleting the PhantomJS 2.1.1 on Linux |
I solved this issue by reinstalling node_modules
|
@antonyh sounds awfully irrational though, sounds like Microsoft :( good software shouldn't magically fix itself upon restart or reinstall. |
I tried to change config by increasing browserNoActivityTimeout and browserDisconnectTimeout,etc. but phantomjs disconnection errors were still there. Then enable swap space worked, as this answer said: https://stackoverflow.com/a/32444643 shell script for automation
Wish it can save your time |
I've got weird problem: run single test iteration works, but in continous mode doesn't, that means after starting browser PhantomJS, last log is Connected on socket ... and any test don't run. |
Hello everyone, I ran into this same (frustrating) issue and discovered the problem was in the karma config. Since I was using gulp to run karma / PhantomJS. When I changed singleRun: false -> true it started working for me again:
You can also change this parameter directly inside of the karma config as well:
|
I've just hit this - works fine on my local machines but won't run on the Visual Studio Online CI server. It used to work fine but has recently just stopped...
I've already looked at a similar article on SO in relation to TeamCity (http://stackoverflow.com/questions/40382241/teamcity-phantomjs-have-not-captured-in-60000-ms-killing) but none of the suggestions there helped me - If there is a version conflict of some kind I'm not sure what I can do about it as it is a cloud server. To complicate matters, trying using Chrome and Firefox results in similar errors, so Karma won't seem to run at all. My gulp task looks like this...
|
I fixed this by fixing karma version at 1.3.0 (1.3.0 instead of ^1.3.0) There must be a bug in 1.5.0, which it was using before on the CI server (my local copy is 1.3.0). |
If someone facing this problem in angular/cli, I've fixed this problem by uncommenting this lines in polyfill.ts: |
This issue accumulated a lot of different problems and is not actionable now. It has not been active for 2.5 years and PhantomJS has been archived two years ago. If you still experience issues with PhantomJS consider migrating to Chrome Headless or Firefox Headless. |
I have been trying to get Karma to run tests on PhantomJS for the last couple of hours and seem to be stuck at it. I had my entire suit run tests in Chrome and it ran without a quirk. on trying to run it with Karma, it would just not run.
I was running phantomjs 1.9 and then i reverted to 1.8. i tried installing it from the distributed binary from the phantomjs site and i also tried to install it through npm. But i had no avail in any of the combinations. I am on a 64bit Ubuntu machine.
I am pretty sure my configurations are correct and i checked phantomjs which again seems to be working.
Am i missing something here. or is this some bizarre bug.
I am attaching my debug logs below.
The text was updated successfully, but these errors were encountered: