Comments

anavarre created an issue. See original summary.

dawehner’s picture

I believe #2775653: JavascriptTests with webDriver is the obvious solution for that as of now.

cilefen’s picture

Category: Bug report » Task

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mglaman’s picture

We can use the dmore/chrome-mink-driver library. I recently used the Behat extension for it. Over PhantomJS, my tests were about 50% faster.

Just need to run a command like (on MacOS)

$ /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --headless -disable-gpu --remote-debugging-port=9222

Examples here for alias https://developers.google.com/web/updates/2017/04/headless-chrome#cli

mglaman’s picture

Follow up: Tested this with core

Run composer require dmore/chrome-mink-driver
Run headless chrome

Override test to use custom mink driver (my base URL is localhost:8080)

MINK_DRIVER_ARGS='["http:\/\/localhost:9222",null,"http:\/\/localhost:8080"]' MINK_DRIVER_CLASS='\DMore\ChromeDriver\ChromeDriver' ../bin/phpunit -c core --testsuite functional-javascript --stop-on-failure
acbramley’s picture

Be warned: It won't be as easy as just swapping over the driver. While some tests may pass, others won't due to the differences in some of the Driver implementations.

For example, we tried it but tests were failing due to the difference in the getText implementation. When using ChromeDriver this was returning what seems to be the first string in the NodeElement. So if you're using a liberal selector to get (for example) a div, and then checking that div contains some text among a few different elements, chances are your tests will fail. Whereas, the phantomjs driver gets all the text in the element.

dawehner’s picture

@acbramley
For now we are exploring to use the selenium driver, but @mixologic reported a lot of issues, see #2775653: JavascriptTests with webDriver

acbramley’s picture

@dawehner yeah I'm following that issue too :) That's going to be the next thing I try!

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Mixologic’s picture

Status: Active » Reviewed & tested by the community

Pretty sure we can close this, as we now have the ability to run javascript tests with webdriver, and also have a plan in the works to write and run javascript only tests with nightwatch.

The dmore/chrome-mink-driver was explored, but it was a mink driver that communicated *directly* with chrome devtools protocol, whereas webdriver gives us an extra abstraction layer around the browser allowing us to run the tests on whatever browser we'd like, including headless chrome.

dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Sure let's fix the issue :)

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.