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

Configure Travis CI to use headless Chrome for tests #894

Closed
kibertoad opened this issue Jul 8, 2017 · 18 comments
Closed

Configure Travis CI to use headless Chrome for tests #894

kibertoad opened this issue Jul 8, 2017 · 18 comments
Milestone

Comments

@kibertoad
Copy link
Contributor

See https://docs.travis-ci.com/user/gui-and-headless-browsers/#Using-the-Chrome-addon-in-the-headless-mode

Then Chrome could be used as a default engine for executing tests, PhantomJS dropped and ES6 used to write tests :).

@obiot
Copy link
Member

obiot commented Jul 9, 2017

I'm definitely for it, we had issues in the past with phantomJS not supporting few features, and if we can have a full fledge (headless) chrome, that then allow us to have ES6 test, and I'm all for it !

@kibertoad
Copy link
Contributor Author

@obiot It'd need someone with access to the Travis account for melonJS, though. From sources side the only change needed is swapping PhantomJS to ChromeHeadless in grunt file.

@obiot
Copy link
Member

obiot commented Jul 10, 2017

actually you don't, as all the magic happen in the travis.yml file. So as soon as the package.json is modified, this will be reflected "in" travis.

@obiot
Copy link
Member

obiot commented Jul 10, 2017

love the nyan cat by the way :)

10 07 2017 10:40:12.530:INFO [PhantomJS 2.1.1 (Windows 8 0.0.0)]: Connected on socket MybWDp60p6FCag5AAAAA with id 52316809
 292 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_,------,
 283 -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_|   /\_/\
 0   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-^|__( o .o)
 9   -_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-  ""  ""

     292 total   283 passed   0 failed   9 skipped

@obiot
Copy link
Member

obiot commented Jul 10, 2017

also when switching to ChromeHeadless, the following errors needs to be addressed :

Failed Tests:
 ES6 Collections test
    Map#set
       Chrome 59.0.3071 (Windows 10 0.0.0)
          1) Expected true to equal false.
             at Object.<anonymous> (tests/spec/es6-collections.js:163:22)

    Map#forEach with mutations
       Chrome 59.0.3071 (Windows 10 0.0.0)
          2) Expected undefined to equal '[1,3,0]'.
             at Object.<anonymous> (tests/spec/es6-collections.js:260:39)


 me.input
    Pointer Event
       PointerDown event triggering
          Chrome 59.0.3071 (Windows 10 0.0.0)
             3) Error: Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL.


     292 total   285 passed   3 failed   4 skipped

for the mouse input one it's pretty easy we just need to replace mousedown by pointerdown here.

for the es6 collections, it's a bit more tricky. Either we remove the corresponding test, or we modify the outdate polyfill to comply with the latest ES6 Specifications (which I personally believe is a waste of effort)

@obiot
Copy link
Member

obiot commented Jul 10, 2017

last change to autodetect the testing environment and fix the input test (so that we don't need to keep changing the test between phantomjs and chrome)

obiot added a commit that referenced this issue Jul 10, 2017
let’s see if this one works before switching to ChromeHeadless for karma
@obiot
Copy link
Member

obiot commented Jul 10, 2017

unless anyone else ( @parasyte , @agmcleod ) it's ready to fully switch to ChromeHeadless for automated testing :)

obiot referenced this issue Jul 10, 2017
…oswer

the es6 collection polyfill is outdated causing the es6 polyfill test
to fail under a es6 browser (as the polyfill has a different behaviour
compared to the latest es6 release)
obiot added a commit that referenced this issue Jul 11, 2017
obiot added a commit that referenced this issue Jul 11, 2017
obiot added a commit that referenced this issue Jul 11, 2017
obiot added a commit that referenced this issue Jul 11, 2017
obiot added a commit that referenced this issue Jul 11, 2017
@obiot
Copy link
Member

obiot commented Jul 11, 2017

enabling Chrome in Travis is way more difficult than I initially thought, so I reverted for now to PhantomJS (no more extra time for me to test today)

few results I found and tried to apply :
karma-runner/karma#1144 (comment)
https://unix.stackexchange.com/questions/176980/please-set-env-variable-chrome-bin
travis-ci/travis-ci#938

@obiot
Copy link
Member

obiot commented Jul 11, 2017

FYI I initially followed the below steps :
https://swizec.com/blog/how-to-run-javascript-tests-in-chrome-on-travis/swizec/6647

but there is a issue with the "latest" travis environement and sandboxing that prevent it from working

obiot added a commit that referenced this issue Jul 11, 2017
@obiot
Copy link
Member

obiot commented Jul 11, 2017

the missing bit was sudo: required in the travis.yml file to make it work with Sandboxing.

Chrome is starting now and karma running but 2 tests are failing under the travis environement, and the end of the log is missing, so I'm not able to see which one .....

here is copy/paste of the last lines (the 2 is for the 2 failing tests) :

292
 265
 2
 4
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
-_-_-_-_-_-

no idea though how to get the end of the log....

@obiot
Copy link
Member

obiot commented Jul 11, 2017

log problem solved

@obiot
Copy link
Member

obiot commented Jul 11, 2017

so Chrome working, but 2 tests are failing (so I left it using PhantomJS for now),

Left to do : identify the failing tests and assess the issue + solution. signing out on my side for today, I reaaaaaaaalllly have to run

@obiot
Copy link
Member

obiot commented Jul 13, 2017

interesting ...
Failed Tests:

1st issue, again with the polyfill :

ES6 Collections test
WeakMap constructor behavior
Chromium 37.0.2062 (Ubuntu 0.0.0)
Expected false to equal true.
at Object.<anonymous> (tests/spec/es6-collections.js:35:22)

2nd one is weirder though, seems like the float precision is different, leading to a slightly different value on Linux/Chromium [EDIT] fixed, bad code with cheap rounding

Shape : me.Polygon
Isometric transformation
shape should have an isometric diamond shape
Chromium 37.0.2062 (Ubuntu 0.0.0)
Expected 31 to equal 32.
at Object.<anonymous> (tests/spec/polygon-spec.js:94:41)

@obiot
Copy link
Member

obiot commented Jul 13, 2017

second issue is fixed

for the first, no idea so far on why the weakmap constructor fails on Chromium :
https://github.com/melonjs/melonJS/blob/master/tests/spec/es6-collections.js#L35

@parasyte @agmcleod @kibertoad in case you have any idea.... :P

this is the very last thing to fix, and then we can fully switch to Chrome!

@obiot
Copy link
Member

obiot commented Jul 13, 2017

issue seems to be that with the current script Chromium 37 is installed

 LOG MESSAGES FOR: Chromium 37.0.2062 (Ubuntu 0.0.0) INSTANCE #: 35999929
    'Initializing melonJS'

have not succeed yet to make it install the latest version, and it's kind of difficult to test everytime.... lunch time !

obiot added a commit that referenced this issue Jul 13, 2017
@obiot
Copy link
Member

obiot commented Jul 13, 2017

job done !

13 07 2017 05:03:39.061:INFO [karma]: Karma v1.7.0 server started at http://0.0.0.0:9876/
13 07 2017 05:03:39.063:INFO [launcher]: Launching browser ChromeHeadless with unlimited concurrency
13 07 2017 05:03:39.073:INFO [launcher]: Starting browser ChromeHeadless
13 07 2017 05:03:41.754:INFO [HeadlessChrome 0.0.0 (Ubuntu 0.0.0)]: Connected on socket JXLIE6HeptKA6X1VAAAA with id 83669012
 292
 288
 0
 4
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
-_-_-_-_-_214m-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-_-
292 total 288 passed 0 failed 4 skipped
 LOG MESSAGES FOR: HeadlessChrome 0.0.0 (Ubuntu 0.0.0) INSTANCE #: 83669012
    'Initializing melonJS'
Done.

Unit tests are now using chrome headless !

Interesting exercise, I learned a lot, just by switching from phantomJS to Chrome :)

@obiot obiot closed this as completed Jul 13, 2017
@obiot obiot added this to the 5.0.0 milestone Jul 13, 2017
@parasyte
Copy link
Collaborator

Wow!

One concern; Chrome 37 is ancient. It's not much better than the ancient WebkitQT in PhantomJS.

@obiot
Copy link
Member

obiot commented Jul 13, 2017

Chrome 59 is the one currently installed with the Trusty distribution, so aaaall gooood! :)

rbuels added a commit to GMOD/jbrowse that referenced this issue Feb 17, 2018
rbuels added a commit to GMOD/jbrowse that referenced this issue Feb 19, 2018
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

3 participants