Skip to content

Running the Suite

Prerequisites

  1. A running Drupal site (DDEV, Lando, or any local web server) — Drupal core (Standard) or Drupal CMS — with:
  2. canvas and canvas_override available, and the Canvas #3567225 patch applied to drupal/canvas;
  3. the two test recipes applied (they enable the modules, create the content types and the default Canvas layout):
    drush recipe modules/contrib/canvas_override/tests/fixtures/marketing_campaign_test_base
    drush recipe modules/contrib/canvas_override/tests/fixtures/department_test_base
    
    The @setup feature creates the seeded campaign node at /canvas-override-test through the browser on the first run.
  4. Node.js >= 20.

Install the test dependencies

cd canvas_override
corepack enable
yarn install
yarn playwright install --with-deps chromium

webship-js pins @cucumber/cucumber to the 12.x line (Node 20 compatible) via a resolutions entry so the whole suite runs on the same Cucumber instance.

Point the suite at your site

The base URL comes from the LAUNCH_URL environment variable (default http://localhost):

export LAUNCH_URL="https://canvas-override.ddev.site"

The seeded content alias, the enabled bundle and the test users are configured in cucumber.shared.js and can be overridden per run:

export CANVAS_OVERRIDE_BUNDLE="marketing_campaign"
export CANVAS_OVERRIDE_NODE_ALIAS="/canvas-override-test"

Run

# Drupal Standard suite (default)
yarn test

# Drupal CMS suite
yarn test:drupalcms

# A specific browser
yarn test:firefox
yarn test:webkit

# A subset by tag
yarn test -- --tags "@smoke"
yarn test -- --tags "@canvas and not @wip"

# A single feature file
yarn test -- tests/features/drupal/03-02-01-reset-layout.feature

Validate without a browser

A --dry-run checks that every Gherkin step resolves to a definition without launching a browser or needing a live site — handy in CI gates and pre-commit:

WEBSHIP_REPORT_DISABLE=1 yarn test -- --dry-run
WEBSHIP_REPORT_DISABLE=1 yarn test:drupalcms -- --dry-run

WEBSHIP_REPORT_DISABLE=1 stops webship-js's automatic HTML/PDF report hook, which otherwise looks for the default report path on exit.

Reports

Generate the HTML and PDF report after a run:

node ./node_modules/webship-js/bin/generate-reports.js \
  --json tests/reports/drupal/cucumber_report.json \
  --out  tests/reports/drupal/cucumber_report.html \
  --format all \
  --pdf-out tests/reports/drupal/cucumber_report.pdf

Failure screenshots land in tests/screenshots/, failure videos in tests/videos/, and the JSON / HTML / PDF reports in tests/reports/. All three directories are git-ignored except for their README placeholders.