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

Run tests with Chrome headless. #15877

Merged
merged 6 commits into from
Nov 29, 2017
Merged

Run tests with Chrome headless. #15877

merged 6 commits into from
Nov 29, 2017

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Nov 29, 2017

Rebased and tweaked version of #15588 (thanks to @maclover7 for all of the actual hard work here).

Also, added a few commits on top of those changes for:

  • Drop phantomjs testing infrastructure
  • Remove extra running of Chrome in TEST_SUITE=travis-browsers
  • Update puppeteer to 0.13.0 (~ Chromium 64)

Addresses part of #15876.

maclover7 and others added 6 commits November 29, 2017 10:59
TL;DR: Drop-in code replacement for Phantom with Chrome headless.

The Google Chrome team came out with a slick JavaScript client library
called [puppeteer](https://github.com/googlechrome/puppeteer) to control
Chrome headless. This is a fairly (IMHO) straightforward port from
running QUnit tests through Phantom to instead using Chrome headless.
The functions are almost identical with the exceptions of how to
actually boot/load up the browser and page, and also the logging code
in-line.

There are a few TODOs (things before this PR is merged) and Future
Improvements (things likely out of scope for this PR) that I was able to
come up with, though I'm sure I may have missed a few things:

TODOs:

- Extract out the `addLogging` function to a package similar to `qunit-phantomjs-runner` (`qunit-chrome-runner`?): right now copy and pasting the code from the Phantom runner works, but this isn't sustainable. Not sure if the Ember core team wants to maintain a small package like this, or who will own it.
- Make sure testem is okay with removal of PhantomJS: there are a bunch of config files where Phantom is mentioned, those need to be looked at
- Figure out when to remove Phantom completely from `bin` scripts: my initial thought was to run tests through both phantom and Chrome headless for a little while to make sure nothing was loudly failing, but I'll love feedback from reviewers about that

Future Improvements:

- Eventually remove all PhantomJS code from `bin` scripts
- Remove `REDEFINE_SUPPORTED` / `handleBrokenPhantomDefineProperty` from [ember-metal](https://github.com/emberjs/ember.js/blob/master/packages/ember-metal/lib/properties.js)
- Find a way to more responsibly handle browsers: I tried to setup some `browser.close()` calls to better manage the current situation, but things got messy quickly. I think this is outside of the scope of just getting this running in the first place.
- Once Chrome headless hits stable release, add it as a Travis addon: currently the puppeteer npm package ships with a copy of the Chrome canary web browser, and it isn't necessary to install Chrome again
- Finish migrating all Ember projects off of Phantom: ember-cli has already done the migration, not sure what other repos still need attention
Chrome is now the default browser used, no need to test it _again_...
Prior to this change, the only content emitted was `[Object object]`
(this is due to how puppeteer provides the argument to
`page.on('console', ...)`).
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

Successfully merging this pull request may close these issues.

2 participants