Skip to content

Nightwatch

The Nightwatch job will run Nightwatch tests if your project contains them. Your javascript test files will need to match one of the following patterns:

tests/src/Nightwatch/**/*.js
modules/*/tests/src/Nightwatch/**/*.js
tests/modules/*/tests/src/Nightwatch/**/*.js

The results will be available as a junit artifact within the job, for browsing or download.

In addition to testing at the 'current' Drupal core version, the Nightwatch job has all five additional variants, to cover testing at previous and next core versions.

Web driver versions

Tests on Drupal 11.1 and above run Nightwatch 3.9 and will use Selenium and the latest Chrome W3C-compliant browser. Tests on Drupal 11.0 and below run Nightwatch 2.4 and will continue to use the legacy Chrome driver which is not W3C-compliant.

If your tests with Drupal 11.1+ still need to use the legacy driver, add the following lines to the appropriate Nightwatch job to override the defaults:

  # Set the web driver variables to the legacy values.
  variables:
    DRUPAL_TEST_WEBDRIVER_HOSTNAME: $DRUPAL_TEST_WEBDRIVER_HOSTNAME_LEGACY
    DRUPAL_TEST_WEBDRIVER_PORT: $DRUPAL_TEST_WEBDRIVER_PORT_LEGACY
    DRUPAL_TEST_WEBDRIVER_W3C: "false"

Customization

If you need to add additional arguments to the Nightwatch command, you can use the _NIGHTWATCH_EXTRA variable. This can be set at the global level, or just for a specific variant. For example:

'nightwatch (max PHP version)':
  variables:
    _NIGHTWATCH_EXTRA: '--verbose'

The --verbose option writes extra detailed information to the log.