xolvio / meteor-rtd-example-project

A template project to use for creating a meteor app with unit and webdriver testing
91 stars 27 forks source link

Running acceptance tests fails #15

Closed stou closed 11 years ago

stou commented 11 years ago

I am trying to run the example project from: git@github.com:xolvio/real-time-development-with-meteor.git

However, I cannot get the Acceptance tests to run. I suspect the problem is that the selenium-webdriver cannot create a session. I fails when I try using http://localhost:4444/wd/hub/static/resource/hub.html

Here is some environment info and output of the testrun.

[stou$ real-time-development-with-meteor]$ phantomjs --version 1.9.1 [stou$ real-time-development-with-meteor]$ grunt --version grunt-cli v0.1.9 [stou$ real-time-development-with-meteor]$ cd test/rtd [stou$ rtd]$ grunt --debug [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/Gruntfile.js [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/Gruntfile.js Launching Selenium-server on port 4444 Launching Karma listener on port 9876 Launching Karma runner on port 9100 Launching Meteor on port 3000 Launching Mirror on port 8000 [D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-contrib-watch/tasks/watch.js Waiting...[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Failures:

1) Leaderboard functionality increases a players score by 5 when the increment button is clicked Message: timeout: timed out after 10000 msec waiting for App didn't reset Stacktrace: undefined

Finished in 12.313 seconds 1 test, 1 assertion, 1 failure, 0 skipped

Error: Command failed: Fatal error: Command failed:

Completed in 26.485s at Tue Jul 02 2013 23:12:53 GMT+0200 (CEST) - Waiting...

xolvio commented 11 years ago

I just updated RTD with a fix for the issues above (hopefully). Please get the latest and let me know how you get on

Zev23 commented 11 years ago

Tried with latest RTD... getting different problem and becoming unstable. I'm using Ubuntu12.04.2 in VirtualBox. After running grunt, my disk IO/CPU/Mem all shoot up to 100% It runs about 220-350 node process after launch.

One thing I want to bring up is npm must be 1.2.X. The new 1.3.X will have problem when grunt is using underscore.string@2.2.0-rc because the version number is not in X.Y.Z.

[[DEBUG LOG]] Running "bgShell:killAll" (bgShell) task

Running "downloadAndOrStartSelenium" task

Downloading http://chromedriver.googlecode.com/files/chromedriver2_linux64_0.8.zip ...............................................

Downloading http://selenium.googlecode.com/files/selenium-server-standalone-2.33.0.jar ................................................................................ ................................................................................ ..........................................................

Running "unzip:chromeDriver" (unzip) task File "/home/usr/real-time-development-with-meteor/test/rtd/../../test/rtd/lib/bin/" created.

Running "chmod" task

Running "bgShell:synchronizeMirrorApp" (bgShell) task

Running "bgShell:instrumentCode" (bgShell) task . Processed [3] files in 0 secs

Running "bgShell:startMirrorApp" (bgShell) task

Running "bgShell:startKarma" (bgShell) task

Running "bgShell:startApp" (bgShell) task

Running "outputPorts" task Launching Selenium-server on port 4444 Launching Karma listener on port 9876 Launching Karma runner on port 9100 Launching Meteor on port 3000 Launching Mirror on port 8000

Running "watch" task Waiting...[[[[[ ~/real-time-development-with-meteor/build/mirror_app ]]]]]

[[[[[ ~/real-time-development-with-meteor/app ]]]]]

=> Meteor 0.6.4 is available. Update this project with 'meteor update'. => Meteor 0.6.4 is available. Update this project with 'meteor update'. Initializing mongo database... this may take a moment. Initializing mongo database... this may take a moment. => Meteor server running on: http://localhost:3000/ istanbul-middleware-port: updating npm dependencies -- istanbul, path, url, archiver... => Meteor server running on: http://localhost:8000/ OK

File "../../app/client/leaderboard.js" changed. => Exited with code: 1 Failed to receive keepalive! Exiting. Running "bgShell:karmaRun" (bgShell) task

  • - - Running unit tests - - - No captured browser, open http://localhost:9876/ Error: Command failed: Fatal error: Command failed:

Completed in 69.310s at Thu Jul 04 2013 20:43:26 GMT+0800 (MYT) - Waiting...=> Meteor server restarted=> Meteor server restarted Failed to receive keepalive! Exiting. => Exited with code: 1 OK

File "../../app/client/leaderboard.js" changed. Running "bgShell:karmaRun" (bgShell) task

  • - - Running unit tests - - - ........... Chrome 27.0 (Windows): Executed 11 of 11 SUCCESS (3.59 secs / 0.031 secs) ........... Chrome 27.0 (Windows): Executed 11 of 11 SUCCESS (3.59 secs / 0.031 secs)

Running "bgShell:synchronizeMirrorApp" (bgShell) task

Running "bgShell:instrumentCode" (bgShell) task => Meteor server restarted Failed to receive keepalive! Exiting. . Processed [3] files in 5 secs

Running "bgShell:runTests" (bgShell) task

Running "postLatestUnitCoverage" task => Meteor server restarted (x2) Running "bgShell:killReports" (bgShell) task

Running "bgShell:runCoverageCheck" (bgShell) task

Failures:

1) Test coverage checker checks the coverage results against the thresholds Message: timeout: timed out after 750 msec waiting for Webdriver did not initialize. You may need to restart RTD

Finished in 2.203 seconds 1 test, 1 assertion, 1 failure, 0 skipped

Error: Command failed: Fatal error: Command failed:

Completed in 373.127s at Thu Jul 04 2013 20:52:46 GMT+0800 (MYT) - Waiting...

xolvio commented 11 years ago

This seems to be a problem with the latest phantom release. You can change to use chrome by changing karma.conf.js in the meantime. I'll update the main project until this is fixed

lc3t35 commented 11 years ago

on MacOS 10.8.4, it works fine with phantomjs1.9.0 instead of 1.9.1-1 (last)

stou commented 11 years ago

Still not working for me. I installed node using homebrew also had to install phantomjs through using brew, then the unittests run. tried installing phantomjs from npm, then the unittests does not run.

The app runs fine in in the browser on localhost:3000

I upgraded the demo project to meteor 0.6.4, and tried both PhantomJS, Chrome, and Safari in karma.conf.js, but still not running acceptance tests.

Upgrading karma to use karma@canary does not work either.

@lc3t35 what version of node and karma are you using?

Should I avoid node from homebrew?

stou commented 11 years ago

Just tried installing node using the installer from nodejs.org and using phantomjs@1.9.0-6 from npm. Still no luck.

stou commented 11 years ago

Tried to install node from the pkg from nodejs.org and using phantomjs 1.9.0-0 from npm

I seems that Chrome must be in /Applications (and not in a subfolder as I had).

By moving Chrome to reside in /Applications i now got a different error (After the error grunt crashes, and I am back in the terminal):

[stou$ rtd]$ grunt --debug
Running "bgShell:killAll" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "downloadAndOrStartSelenium" task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/Gruntfile.js

Running "bgShell:synchronizeMirrorApp" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "bgShell:instrumentCode" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee
.
Processed [3] files in 0 secs

Running "bgShell:startMirrorApp" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "bgShell:startKarma" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "bgShell:startApp" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "outputPorts" task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/Gruntfile.js
Launching Selenium-server on port 4444
Launching Karma listener on port 9876
Launching Karma runner on port 9100
Launching Meteor on port 3000
Launching Mirror on port 8000

Running "watch" task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-contrib-watch/tasks/watch.js
Waiting...[[[[[ ~/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/build/mirror_app ]]]]]

[[[[[ ~/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/app ]]]]]

=> Meteor server running on: http://localhost:3000/
=> Meteor server running on: http://localhost:8000/
OK
>> File "../../app/models/Players.js" changed.
=> Meteor server restartedRunning "bgShell:karmaRun" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

- - - Running unit tests - - -
...........
Chrome 27.0 (Mac): Executed 11 of 11 SUCCESS (0.241 secs / 0.031 secs)
...........
Chrome 27.0 (Mac): Executed 11 of 11 SUCCESS (0.241 secs / 0.031 secs)

Running "bgShell:synchronizeMirrorApp" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "bgShell:instrumentCode" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee
.
Processed [3] files in 0 secs

Running "bgShell:runTests" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee
- - - Running acceptance tests - - -
=> Meteor server restarted.

Finished in 9.505 seconds
1 test, 4 assertions, 0 failures, 0 skipped

Running "postLatestUnitCoverage" task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/Gruntfile.js

Running "bgShell:killReports" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee

Running "bgShell:runCoverageCheck" (bgShell) task
[D] Task source: /Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/node_modules/grunt-bg-shell/tasks/bg-shell.coffee
- - - Running coverage tests - - -

>> TypeError: Cannot read property 'start' of undefined
>>     at tmp (/Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/lib/istanbul-middleware-port/.npm/node_modules/istanbul/lib/object-utils.js:58:44)
>>     at Array.forEach (native)
>>     at Object.addDerivedInfoForFile (/Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/lib/istanbul-middleware-port/.npm/node_modules/istanbul/lib/object-utils.js:57:37)
>>     at Object.Collector.fileCoverageFor (/Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/lib/istanbul-middleware-port/.npm/node_modules/istanbul/lib/collector.js:93:15)
>>     at app/packages/istanbul-middleware-port/core.js:143:86
>>     at Array.forEach (native)
>>     at getTreeSummary (app/packages/istanbul-middleware-port/core.js:142:23)
>>     at Object.core.render (app/packages/istanbul-middleware-port/core.js:186:19)
>>     at app.get.origUrl (app/packages/istanbul-middleware-port/handlers.js:31:14)
>>     at Object.<anonymous> (app/packages/istanbul-middleware-port/express-shim.js:16:13)
>> Error: Can't render headers after they are sent to the client.
>>     at ServerResponse.OutgoingMessage._renderHeaders (http.js:687:11)
>>     at ServerResponse.res._renderHeaders (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/patch.js:69:27)
>>     at ServerResponse.writeHead (http.js:1031:20)
>>     at ServerResponse.res.writeHead (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/patch.js:75:22)
>>     at ServerResponse.Meteor.RRouter.add.res.setHeader (app/packages/istanbul-middleware-port/express-shim.js:7:21)
>>     at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:147:13)
>>     at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:187:11)
>>     at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:187:11)
>>     at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:195:7)
>>     at multipart (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/middleware/multipart.js:64:37)
Fatal error: TypeError: Cannot read property 'start' of undefined
    at tmp (/Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/lib/istanbul-middleware-port/.npm/node_modules/istanbul/lib/object-utils.js:58:44)
    at Array.forEach (native)
    at Object.addDerivedInfoForFile (/Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/lib/istanbul-middleware-port/.npm/node_modules/istanbul/lib/object-utils.js:57:37)
    at Object.Collector.fileCoverageFor (/Users/stou/Documents/programming/meteor/experiments/rtd/real-time-development-with-meteor/test/rtd/lib/istanbul-middleware-port/.npm/node_modules/istanbul/lib/collector.js:93:15)
    at app/packages/istanbul-middleware-port/core.js:143:86
    at Array.forEach (native)
    at getTreeSummary (app/packages/istanbul-middleware-port/core.js:142:23)
    at Object.core.render (app/packages/istanbul-middleware-port/core.js:186:19)
    at app.get.origUrl (app/packages/istanbul-middleware-port/handlers.js:31:14)
    at Object.<anonymous> (app/packages/istanbul-middleware-port/express-shim.js:16:13)
Error: Can't render headers after they are sent to the client.
    at ServerResponse.OutgoingMessage._renderHeaders (http.js:687:11)
    at ServerResponse.res._renderHeaders (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/patch.js:69:27)
    at ServerResponse.writeHead (http.js:1031:20)
    at ServerResponse.res.writeHead (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/patch.js:75:22)
    at ServerResponse.Meteor.RRouter.add.res.setHeader (app/packages/istanbul-middleware-port/express-shim.js:7:21)
    at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:147:13)
    at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:187:11)
    at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:187:11)
    at next (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/proto.js:195:7)
    at multipart (/Users/stou/.meteor/tools/cc18dfef9e/lib/node_modules/connect/lib/middleware/multipart.js:64:37)

[stou$ rtd]$ 

>> { [TypeError: Cannot call method 'getText' of undefined] webdriver_promise_error_: true }
Fatal error: { [TypeError: Cannot call method 'getText' of undefined] webdriver_promise_error_: true }
xolvio commented 11 years ago

Well the good news is that it's pass the acceptance tests. However the test coverage posting seems not to work. This is a duplicate now of https://github.com/xolvio/rtd/issues/27 so let's collaborate there. I'll mark this as a duplicate/closed.

Zev23 commented 11 years ago

Downgrade to PhantomJS@1.9.0-6 has solved resource 100% issue but brings me back to the original problem in the first post:

    "timeout: timed out after 10000 msec waiting for App didn't reset"

Switching the browser setting in karma.conf.js still get the same error.

I also cannot create session in this link. No existing session too. http://localhost:4444/wd/hub/static/resource/hub.html

xolvio commented 11 years ago

Hi, the latest RTD has had some fixes to Linux. Try getting that, copying /test/rtd/rtd.conf.js to /test/rtd.conf.js and commenting out the OSX settings and uncommenting the linux ones.

I'll automate this detection soon, but let me know how you get on

lc3t35 commented 11 years ago

check the installed version with npm -g ls -> uninstall duplicated packages install packages with specific version requests as shown here : npm i -g karma@0.8.5 phantomjs@1.9.0-0 selenium-webdriver grunt-cli jasmine-node istanbul@0.1.39

Worked for me.