Functional JavaScript tests

The last type of tests we can write in Drupal 8 is the JavaScript-powered functional test. FunctionalJavascript tests are useful when we want to test more dynamic client-side functionality such as JavaScript behaviors or Ajax interactions.

They are an extension of the regular Functional tests, but which use WebDriver. The latter is an API that allows things like Selenium to control browsers such as Chrome or Firefox. Drupal uses Chrome for this so make sure you have Selenium installed and working with the Chrome driver. We won't cover this here because it depends on your local environment and the current latest versions.

Assuming you have Selenium running, we can write some tests. But only after we add another environment variable to the PHPUnit configuration file:

<env name="MINK_DRIVER_ARGS_WEBDRIVER" value='["chrome", null, "http://localhost:4444/wd/hub"]'/> 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset