Problem/Motivation
- instaclick/php-webdriver and behat/mink-selenium2-driver do not support W3C webdriver standard and are using the deprecated JSONWireProtocol https://www.selenium.dev/documentation/legacy/json_wire_protocol/ - this isn't supported by e.g. Firefox or Selenium images from the last 2 years or so
- The upstream projects will not accept the changes needed to run webdriver https://github.com/minkphp/MinkSelenium2Driver/pull/372
Proposed resolution
- Change our code to use
lullabot/php-webdriver&lullabot/mink-selenium2-driver
This prepares the project to move to W3C compliant testing in #3421202: Enable W3C-compliant webdriver testing. The lullabot driver has supports both W3C and non-W3C modes. In this issue we continue to use a the non-W3C mode and will explore moving to W3C mode testing the aforementioned issue.
Remaining tasks
User interface changes
None
API changes
This issue deprecates support for the chromeOptions key in MINK_DRIVER_ARGS_WEBDRIVER. It is replaced by goog:chromeOptions.
Data model changes
None
Release notes snippet
The chromeOptions key in MINK_DRIVER_ARGS_WEBDRIVER should be renamed goog:chromeOptions.
Dependency evaluations
Mink selenium2 driver |
|
|---|---|
| Repository | https://github.com/lullabot/mink-selenium2-driver |
| Release cycle | New releases expected if Webdriver standard changes |
| Security policies | None. This is a dev tool and will not be present on production. |
| Security issue reporting | N/a |
| Contact(s) | https://www.drupal.org/u/justafish & https://www.drupal.org/u/alexpott |
PHP webdriver |
|
|---|---|
| Repository | https://github.com/lullabot/php-webdriver |
| Release cycle | New releases expected if Webdriver standard changes |
| Security policies | None. This is a dev tool and will not be present on production. |
| Security issue reporting | N/a |
| Contact(s) | https://www.drupal.org/u/justafish & https://www.drupal.org/u/alexpott |
| Comment | File | Size | Author |
|---|
Issue fork drupal-3240792
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3240792-driver-swap-only
changes, plain diff MR !6616
- 3240792-lullabot-only
changes, plain diff MR !6583
- 3240792-lullabot-MinkSelenium2Driver
changes, plain diff MR !5803
- 3240792-lullabot-on-top-of-3407834
changes, plain diff MR !6578
- 3240792
changes, plain diff MR !1316
- 3240792-lullabot-MinkSelenium2Driver-alex
changes, plain diff MR !6538
- 11.x
compare
- 9.3.x
compare
- 3240792-use-php-webdriverwebdriver-
compare
Comments
Comment #2
alexpottComment #3
alexpottThis passes a JS test locally... let's see
Comment #5
alexpottComment #12
andypostComment #13
justafishI've been working on a drop-in replacement for instaclick/php-webdriver https://github.com/Lullabot/drupal-webdriver/pull/1
Comment #14
justafishComment #15
justafishPR to minkphp/MinkSelenium2Driver for W3C compatibility fixes: https://github.com/minkphp/MinkSelenium2Driver/pull/372
Comment #16
andypostthere's Symfony's approach https://github.com/symfony/panther
Comment #18
andypostComment #20
justafishComment #21
justafishComment #22
justafishComment #23
justafishComment #24
justafishComment #25
justafishReady for review - I did try and pull in the library changes separately (starting from https://git.drupalcode.org/project/drupal/-/commit/557a63899eacf28a117e7... in this MR), over in https://www.drupal.org/project/drupal/issues/3407834 but I think it's going to be a lot of extra unnecessary work fixing the tests and then re-fixing them as soon as we come back here, that given how small the changeset for this is I don't think it's worth splitting up
Comment #32
alexpottCrediting @justafish for all the work to get this issue progressing. Nice one.
Comment #33
smustgrave commented@alexpott could you rerun that javascript test please
Comment #34
alexpottDiscussed with @justafish - we agreed to split this issue into 2.
This issue will move us to using a W3C driver for JS testing and then a follow-up issue will look at swapping out our chromedriver image for a selenium standalone image.
Will create an MR with the minimum change for us to use the W3C driver from lullabot.
Comment #36
alexpottCreated the issue to use selenium/standalone-chrome - see #3421202: Enable W3C-compliant webdriver testing ... going to close the other MRs here and move the bulk of that work over then.
Comment #39
alexpottThe one thing I'm wondering here is should we use a composer replace here to indicate that the lullabot dependencies replace the other ones... not sure.
Comment #40
alexpottThe lullabot deps already ship with replace sections so #39 is moot. Nice.
Comment #41
smustgrave commentedBefore marking can change record/release notes be added
Comment #42
longwaveSome nits, and yeah it needs a change record and release note.
Comment #43
alexpottI've resolved @longwave's feedback but I have some concerns that we have failures on a more recent chromedriver than the one we're currently using. Moving to https://hub.docker.com/r/justafish/chromedriver/tags to prove this.
Comment #44
mstrelan commentedAssume we need to set
w3c: trueand possibly other things incore/tests/Drupal/Nightwatch/nightwatch.conf.js.Comment #47
alexpottUpdated issue summary and title inline with current approach on the MR.
Note we will need to fix https://github.com/Lullabot/php-webdriver/pull/9 before we can get a green run.
Comment #48
smustgrave commentedRead both change record and release notes and seem straight forward, so removing those tags
Trying my best to review MR
Applied locally and still seem to be able to run tests in phpstorm. Deprecation link work.
Think this is good. Should it be tagged 10.3 highlight?
Comment #49
longwaveVia @alexpott in Slack
Comment #50
andypostCurious is there a way to measure effect of changing driver's protocol?
Comment #51
alexpott@andypost we've not changed the protocol in this issue. W3C is set to false by default here. This is about getting the dependency change done. Chromedriver doesn't care whether you use W3C commands whatever W3C is set to. So in order to prove we're using W3C we have to do #3421202: Enable W3C-compliant webdriver testing or something similar.
Comment #52
alexpott@smustgrave this is not a highlight yet. We need to fix the underlying Drupal tests to be W3C compatible.
Moved deprecation to WebDriverTestBase - this will allow us to differentiate between core and custom/contrib tests in the future which might make things easier.
Comment #53
andypostAdded comment, probably the TODO needs link
Comment #54
alexpottAddressed @andypost's review
Comment #55
andypostSuppose it ready
Comment #56
spokjeNew dependencies require an evaluation: https://www.drupal.org/about/core/policies/core-dependency-policies/depe...
Does this also need to happen when swapping one dependency for another?
Comment #57
longwaveYup we should also do a quick dependency evaluation and add it to https://www.drupal.org/about/core/policies/core-dependency-policies-and-... (seems the existing packages are not there, but that shouldn't stop us adding these ones)
@justafish I assume you/Lullabot are OK to continue maintaining these packages as needed and also handle any security reports?
Comment #58
alexpottAdded dependency evaluations. As dev dependencies that are only used for testing I'm not sure that having a security policy is that important. Also in mitigation @justafish is granting access to the repository for me and @longwave - so two Drupal security team members have access.
Comment #59
justafishYes we're ok to continue maintaining and handle security reports - I've also added longwave and alexpott as maintainers to the repository
Comment #62
catchDictionary was the only thing I found...
Getting off the custom container and also mink which is barely/unmaintained and also towards the w3c standard is all great stuff, even if there's a fair bit more to do.
Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!
Comment #63
catchIf I try to run tests locally, I get a 500 from the chrome container:
The chrome container log looks like this:
This is with ddev and https://github.com/ddev/ddev-selenium-standalone-chrome
There is a small change upstream to update the ddev config, but that's not the problem, changing the ddev config locally gets rid of the deprecation message but not the fatal error.
I did a clean drupal core clone in a new directory, ddev config then ddev get ddev/ddev-selenium-standalone-chrome and got the same error. Then I checkout out the commit just before this one, composer installed, and everything runs fine again (with the updated standalone config).
I can't track it down, but the fact that with an identical ddev setup I can run tests without this change, makes me think it's probably not just me.
Comment #64
andypost@catch it looks like material for DDEV or #3421202: Enable W3C-compliant webdriver testing
I'm using
image: zenika/alpine-chrome:with-chromedriverimage and the test is running fine hereconnection options are
MINK_DRIVER_ARGS_WEBDRIVER: '["chrome", {"browserName":"chrome","goog:chromeOptions":{"args":["--disable-gpu","--headless"]}}, "http://172.30.1.3:4444"]'Comment #65
alexpott@catch can you post your MINK_DRIVER_ARGS_WEBDRIVER too?
Comment #66
longwaveI haven't changed my ddev setup since before this was committed - still using
drupalci/chromedriver:production- and everything still works for me, I just get the deprecation:Comment #67
catchI rebuilt my ddev install to try to rule out any stray old config out, so it's the ones that come with the
ddev-selenium-standalone-chromeadd-on, just withchromeOptionschanged togoog:chromeOptions.I'll try dropping that and doing the
drupalci/chromedriver:production+ 'copy and paste from @mglaman's two year old blog post' approach to see if that gets things running to narrow things down a bit more.Comment #68
catchGoing back to
drupalci/chromedriver:productionworked for me, so can probably wait for https://github.com/ddev/ddev-selenium-standalone-chrome/pull/35 to get merged and/or to flush more issues out in #3421202: Enable W3C-compliant webdriver testing.Comment #69
alexpottIn light of #68 - marking fixed again.