Skip to content
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

Unit tests in node-webkit #66

Closed
pirog opened this issue Aug 23, 2014 · 15 comments
Closed

Unit tests in node-webkit #66

pirog opened this issue Aug 23, 2014 · 15 comments

Comments

@pirog
Copy link
Owner

pirog commented Aug 23, 2014

nwjs/nw.js#2229

@pirog pirog added this to the Unstable 2 (0.2.0) milestone Aug 23, 2014
pirog referenced this issue in pirog/kalabox Aug 29, 2014
pirog referenced this issue in pirog/kalabox Aug 30, 2014
@pirog
Copy link
Owner Author

pirog commented Aug 30, 2014

@mikemilano im messing around with trying to get the nw-launcher to play nice with travis. might be close to getting somewhere but will update later.

pirog referenced this issue in pirog/kalabox Aug 30, 2014
@mikemilano
Copy link
Contributor

Ok, to move the relative info here, outstanding on my end is e2e testing with protractor.

1 small change to protractor makes it work. I forked it here: https://github.com/mikemilano/protractor If you want, we can fork it to the kalabox account and I'll fix it there.

Here's the issue: angular/protractor#1266 .. I was going to give it a day to see if they are interested in supporting node-webkit, or if we have to stay with our own.

The last TODO will be to establish a way to build the test/support directory that the e2e testing depends on.

Right now, test/support looks like this:

support/
├── chromedriver
└── node-webkit.app -> ../../node_modules/nodewebkit/nodewebkit/node-webkit.app

chromedriver is the node-webkit version.

I am running e2e testing successfully from the test directory with the forked version of protractor in the node_modules directory.

$ ../node_modules/protractor/bin/protractor protractor.conf.js 
Warning: pattern ./e2e/**/*.spec.js did not match any files.
Using ChromeDriver directly...
.

Finished in 1.153 seconds
1 test, 1 assertion, 0 failures

@pirog
Copy link
Owner Author

pirog commented Aug 30, 2014

yeah lets fork it into kalabox for now and use that, always easy to swap it back if they add nw support... similar to what we did with grunt-contrib-compress (need to switch that back to the new version still too).

after trolling through karma's launcher abstraction for the last hour and looking at some other things... i think we need to get travis to launch a display and tell karma-nodewebkit-launcher to use that display.

Basically a little of this:

before_install:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"

A little of that:

sudo xvfb-run --server-args='-screen 0, 1024x768x24' node-webkit-v0.9.2-linux-x64/nw 

With insight from this: nwjs/nw.js#769

and usage of this: ENV_CMD in Karma

@pirog
Copy link
Owner Author

pirog commented Aug 30, 2014

WAAAAY easier: This seems to do the trick

before_install:
  - "export DISPLAY=:99.0"
  - "sh -e /etc/init.d/xvfb start"
script 
 - DISPLAY=:99.0 grunt test

@pirog
Copy link
Owner Author

pirog commented Aug 30, 2014

I also forked https://github.com/kalabox/karma-nodewebkit-launcher to use for now pending resolution of nDmitry/karma-nodewebkit-launcher#1

@pirog
Copy link
Owner Author

pirog commented Aug 30, 2014

OK. build is fixed and works with nw now. So all we have left now for this issue is the protractor support i think. confirm/deny?

@mikemilano
Copy link
Contributor

confirmed. If you agree, we should probably just use a fork of protractor and move on.

@pirog
Copy link
Owner Author

pirog commented Aug 30, 2014

Yes! Def fork.

We should def PR our fork into the canonical repo as well but until they
accept let's use our fork. Can always swap later.

On Saturday, August 30, 2014, Mike Milano [email protected] wrote:

confirmed. If you agree, we should probably just us a fork of protractor
and move on.


Reply to this email directly or view it on GitHub
kalabox/kalabox#66 (comment).

Cheers,

Mike Pirog
Kalamuna
www.kalamuna.com

@mikemilano
Copy link
Contributor

Ok, it's been forked and a PR has been made from the kalabox/protractor repo.

package.json has been updated to use this fork. Now it's onto setting up and testing the tests.

@pirog
Copy link
Owner Author

pirog commented Sep 1, 2014

OMFG @mikemilano can we close this issue now?
i leave it in your hands!

@mikemilano
Copy link
Contributor

🔨 Let's do it!

@joneshf
Copy link

joneshf commented Sep 5, 2014

WAAAAY easier: This seems to do the trick

script

  • DISPLAY=:99.0 grunt test

Completely unrelated to your repo, but this helped immensely in getting my node-webkit test suite for a different repo to run on travis. You should make this information more well known: node-webkit wiki, wiki here, twitter, blog, website, whatever. I'm sure there's others that would like to use node-webkit on travis but just don't have the time to figure out what needs to be set up.

Thanks much!

@pirog
Copy link
Owner Author

pirog commented Sep 6, 2014

Great!

I was actually thinking the other night that we might want to just spin out
a "node-webkit-angular-testing-seed" repo before we get too out of control
with our specific app. what do you think @mikemilano?

On Fri, Sep 5, 2014 at 4:21 PM, Hardy Jones [email protected]
wrote:

WAAAAY easier: This seems to do the trick

script

  • DISPLAY=:99.0 grunt test

    Completely unrelated to your repo, but this helped immensely in getting
    my node-webkit test suite for a different repo to run on travis. You should
    make this information more well known: node-webkit wiki, wiki here,
    twitter, blog, website, whatever. I'm sure there's others that would like
    to use node-webkit on travis but just don't have the time to figure out
    what needs to be set up.

Thanks much!


Reply to this email directly or view it on GitHub
kalabox/kalabox#66 (comment).

Cheers,

Mike Pirog
Kalamuna
www.kalamuna.com

@michahell
Copy link

So if i read correctly you guys got

  1. node-webkit playing nice on travis, and
  2. unit testing to work.

May i ask what you guys use for unit testing? i'm building an AngularJS app and while setting up tests using Karma + Jasmine works great, i'm running into the issue of require('somemodule') not being understood by Jasmine / Karma :(

Also, 'node-webkit-angular-testing-seed', WAT? yes please!
So everyone can see how to (properly) unit test node-webkit apps :)

@DinisCruz
Copy link

@michahell I use mocha, see https://github.com/o2platform/node-webkit-repl/tree/master/tests/src for examples

In OSX it runs ok out of the box.

Here is how I got it to run on docker/linux: nwjs/nw.js#1966 (comment) and nwjs/nw.js#1966 (comment)

reynoldsalec pushed a commit that referenced this issue May 24, 2016
Change drush 8 into 8.0.0 branch / tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants