Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / core / tests / README.md
index 5dd6cc63944e638019d925a92974b293254f3afd..fcaa5cc2c2d54efaa5e0a5701ef4bcdcd4340353 100644 (file)
@@ -2,16 +2,11 @@
 
 ## Functional tests
 
-* Start PhantomJS:
-  ```
-  phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
-  ```
 * Run the functional tests:
   ```
   export SIMPLETEST_DB='mysql://root@localhost/dev_d8'
   export SIMPLETEST_BASE_URL='http://d8.dev'
   ./vendor/bin/phpunit -c core --testsuite functional
-  ./vendor/bin/phpunit -c core --testsuite functional-javascript
   ```
 
 Note: functional tests have to be invoked with a user in the same group as the
@@ -37,6 +32,67 @@ User <your-user>
 Group <your-group>
 ```
 
+## Functional javascript tests
+
+Javascript tests use the Selenium2Driver which allows you to control a
+big range of browsers. By default Drupal uses chromedriver to run tests.
+For help installing and starting selenium, see http://mink.behat.org/en/latest/drivers/selenium2.html
+
+* Make sure you have a recent version of chrome installed
+
+* Install selenium-server-standalone and chromedriver
+
+Example for Mac:
+
+```
+brew install selenium-server-standalone
+brew install chromedriver
+```
+
+* Before running tests make sure that selenium-server is running
+```
+selenium-server -port 4444
+```
+
+* Set the correct driver args and run the tests:
+```
+export MINK_DRIVER_ARGS_WEBDRIVER='["chrome", null, "http://localhost:4444/wd/hub"]'
+./vendor/bin/phpunit -c core --testsuite functional-javascript
+```
+
+* It is possible to use alternate browsers if the required dependencies are
+installed. For example to use Firefox:
+
+```
+export MINK_DRIVER_ARGS_WEBDRIVER='["firefox", null, "http://localhost:4444/wd/hub"]'
+./vendor/bin/phpunit -c core --testsuite functional-javascript
+```
+
+* To force all BrowserTestBase (including legacy JavascriptTestBase) tests to use
+webdriver:
+
+```
+export MINK_DRIVER_CLASS='Drupal\FunctionalJavascriptTests\DrupalSelenium2Driver'
+./vendor/bin/phpunit -c core --testsuite functional-javascript
+```
+
+## Running legacy javascript tests
+
+Older javascript test may use the PhantomJSDriver. To run these tests you will
+have to install and start PhantomJS.
+
+* Start PhantomJS:
+  ```
+  phantomjs --ssl-protocol=any --ignore-ssl-errors=true ./vendor/jcalderonzumba/gastonjs/src/Client/main.js 8510 1024 768 2>&1 >> /dev/null &
+  ```
+
+* Then you can run the test:
+```
+./vendor/bin/phpunit -c core --testsuite functional-javascript
+```
+
+## Running tests with a different user
+
 If the default user is e.g. `www-data`, the above functional tests will have to
 be invoked with sudo instead: