Come together with the global Drupal community in Rotterdam, 28 Sept – 1 Oct 2026. Sessions, contribution, connection, and Early Bird savings until 8 June.
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.
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.
Comments
Comment #2
dawehnerI believe #2775653: JavascriptTests with webDriver is the obvious solution for that as of now.
Comment #3
cilefen commentedComment #5
mglamanWe can use the
dmore/chrome-mink-driverlibrary. 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)
Examples here for alias https://developers.google.com/web/updates/2017/04/headless-chrome#cli
Comment #6
mglamanFollow up: Tested this with core
Run
composer require dmore/chrome-mink-driverRun headless chrome
Override test to use custom mink driver (my base URL is localhost:8080)
Comment #7
acbramley commentedBe 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.
Comment #8
dawehner@acbramley
For now we are exploring to use the selenium driver, but @mixologic reported a lot of issues, see #2775653: JavascriptTests with webDriver
Comment #9
acbramley commented@dawehner yeah I'm following that issue too :) That's going to be the next thing I try!
Comment #11
MixologicPretty 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.
Comment #12
dawehnerSure let's fix the issue :)