By jibran on
Change record status:
Published (View all published change records)
Project:
Introduced in branch:
8.6.x
Introduced in version:
8.6.0
Description:
Test Drupal using webDriver introduced a new way to test Javascript code, Drupal core will now move to using webDriver for default JS testing instead of PhantomJS. Support for PhantomJS will be removed in Drupal 9.0.0.
Before:
namespace Drupal\FunctionalJavascriptTests\Core;
use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
/**
* Tests for the machine name field.
*
* @group field
*/
class MachineNameTest extends JavascriptTestBase {
After:
namespace Drupal\FunctionalJavascriptTests\Core;
use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests for the machine name field.
*
* @group field
*/
class MachineNameTest extends WebDriverTestBase {
Conversion:
Converting exiting JS tests to use webriver is straight forward. Instead of using \Drupal\FunctionalJavascriptTests\JavascriptTestBaseas a base class use \Drupal\FunctionalJavascriptTests\WebDriverTestBase as base class. Just be careful about Disabled methods to inspect headers for JavascriptTestBase tests. If header inspection is important then please convert that part of test to non-JS \Drupal\Tests\BrowserTestBase.
namespace Drupal\FunctionalJavascriptTests\Core;
-use Drupal\FunctionalJavascriptTests\JavascriptTestBase;
+use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
/**
* Tests for the machine name field.
*
* @group field
*/
-class MachineNameTest extends JavascriptTestBase {
+class MachineNameTest extends WebDriverTestBase {
Running tests
See core's help file core/tests/README.md
The tldr; way:
- Install chromedriver (in OS appropriate way - ie. brew or apt-get)
- Start it using the command
chromedriver --port=4444 - Run a test - for example:
/vendor/bin/phpunit -v -c core core/tests/Drupal/FunctionalJavascriptTests/Core/MachineNameTest.php
Impacts:
Module developers