Functional JavaScript tests
The last type of PHP tests we can write in Drupal 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. But if you are following along with the GitHub repository accompanying this book, you should be all set up.
Assuming you have Selenium running, we can write some tests. But only after we add another environment variable to the PHPUnit configuration file (ensure the Selenium endpoint is correct for you):
<env name="...