Running the Suite
Prerequisites
- A running Drupal site (DDEV, Lando, or any local web server) — Drupal core (Standard) or Drupal CMS — with:
canvasandcanvas_overrideavailable, and the Canvas #3567225 patch applied todrupal/canvas;- the two test recipes applied (they enable the modules, create the content
types and the default Canvas layout):
The
drush recipe modules/contrib/canvas_override/tests/fixtures/marketing_campaign_test_base drush recipe modules/contrib/canvas_override/tests/fixtures/department_test_base@setupfeature creates the seeded campaign node at/canvas-override-testthrough the browser on the first run. - 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.