Share a Nightwatch report
The useful part of a Nightwatch failure is rarely the assertion message. It is the screenshot taken at the moment it failed, and the sequence of steps that led there. Both of which are in the HTML report, and neither of which fits in the Slack message someone actually sends: "e2e is red again."
Publish it
npx nightwatch --reporter html || true
Nightwatch writes tests_output/nightwatch-html-report/index.html plus
the screenshots it references. Publish the directory:
curl -fsS -X PATCH \
"https://commareports.com/api/v1/reports/$COMMA_REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html tests_output/nightwatch-html-report/index.html \
--arg title "E2E — $BRANCH — build $BUILD_NUMBER" \
'{title: $title, html: $html}')"
Or drag the whole nightwatch-html-report/ folder into
the app, which uploads the screenshots as
assets and rewrites the references to the uploaded copies. That second
part is the step people skip, and it is why a report that looked fine
locally shows empty image slots once it is
somewhere else.
|| true because the failing run is the one worth publishing. PATCH on
a per-suite report id keeps one URL with a revision per run.