Active
Project:
Drupal core
Version:
main
Component:
phpunit
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
2 Feb 2018 at 09:21 UTC
Updated:
3 Nov 2022 at 22:47 UTC
Jump to comment: Most recent
In #2775653: JavascriptTests with webDriver we added instructions on how to set up webdriver. We should extend these instructions to cover other OSes other than OSX.
Extend instructions. From @droplet in #2775653-126: JavascriptTests with webDriver:
This is even neater and for every platform than MacOS:
https://github.com/vvo/selenium-standaloneIf we run out of time, simply 2 lines:
npm install selenium-standalone@latest -g selenium-standalone installIf we have little time to polish it:
- Add a npm script (install part only). Even a single line adding to package.jsonnpm install selenium-standalone@latest -g && selenium-standalone installIn the future follow up:
- A npm script for config
- A npm script for test runner
None
None
None
Comments
Comment #2
Anonymous (not verified) commentedWell, here's the instruction for Windows (maybe not the best):
Prepare (only once):
npm install selenium-standalone@latest -g && selenium-standalone installphpunit.xml.dist, add to this file the next<env>config:<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", null, "http://localhost:4444/wd/hub"]'/>Otherwise, it need to be exported in some other way. See also
/core/tests/README.mdfor more options.Run selenium:
selenium-standalone start -port 4444(or click by .bat file with this command)Run tests:
phpunit.xml.dist).php ../vendor/phpunit/phpunit/phpunit --testsuite --class tests\Drupal\FunctionalJavascriptTests\Tests\JSWebWithWebDriverAssertTestNote: If your Test extends JavascriptTestBase, add the following line to it:
protected $minkDefaultDriverClass = DrupalSelenium2Driver::class;or switch the parent class to
WebDriverTestBase(after #2942900: Convert JavascriptTestBase Tests to use DrupalSelenium2Driver).Comment #3
MixologicSo we've got instructions in core/core.api.php that need to be updated: https://cgit.drupalcode.org/drupal/tree/core/core.api.php?h=8.6.x#n1175
Those become https://api.drupal.org/api/drupal/core%21core.api.php/group/testing/8.6.x
Those point at this docs page that needs updating:
https://www.drupal.org/docs/8/phpunit/phpunit-javascript-testing-tutorial
Change record for reference:
https://www.drupal.org/node/2941464
All of the docs, so far, give several different ways to accomplish the goal of having a service that implements the webdriver api running somewhere that the testing framework can access. Some of those involve installing node.js, or java, depending on the method used.
Im not entirely sure what we should keep in scope for the docs - i.e the testbots are running *solely* chromedriver, in headless mode, with no selenium server at all. There's geckodriver for the folks who want to see if the tests run on FF, but it looks like theres some bugs with it: https://developer.mozilla.org/en-US/docs/Mozilla/QA/Marionette/WebDriver... and then theres using selenium standalone using nodejs (which would also require java, because selenium is written in java).
And as far as "installing on various OS'es" we should keep in mind that theres additional options for people to erect a webdriver service, like running a docker container that provides it, or firing up a vagrant box that has it already configured. So perhaps we could use a boundary around how much howto we provide, and what choices we emphasize.
Comment #4
MixologicMore: https://www.drupal.org/node/2116263
Comment #5
Anonymous (not verified) commentedComment #7
larowlanAfter some pointers from @Mixologic, I was able to get testing going with docker-compose. I updated the docs here https://www.drupal.org/docs/8/phpunit/phpunit-javascript-testing-tutoria...
Comment #8
andypost@larowlan I see problem in
dev/shmwhich exists only for linux and will fail for macos & winComment #9
larowlanOSX has dev/shm
No idea about windows
Comment #13
andypostComment #19
andypostI'm using following
docker-composesnippet to run it everywhere