Share a Detox test report
An E2E failure in React Native is one of the hardest things to explain in
text. The test says expect(element(by.id('checkout'))).toBeVisible() failed;
what the reader needs is the screenshot of the screen where it wasn't, and
maybe the simulator log around it.
Detox records all of that. It just leaves it in a folder on the runner.
Add a Jest HTML reporter
Detox drives Jest, so use Jest's reporter interface:
npm i -D jest-html-reporters
// e2e/jest.config.js
module.exports = {
// …your existing Detox config
reporters: [
"default",
["jest-html-reporters", { publicPath: "e2e/report", filename: "index.html" }],
],
};
Then run with artifacts on:
detox test -c ios.sim.release \
--take-screenshots failing --record-logs failing || true
--take-screenshots failing is the setting worth having — full recordings are
large, failure screenshots are what get read.
Publish it
Drag the e2e/report/ folder into the app:
index.html becomes the report body, and the embedded screenshots and
attachments upload as assets with their references rewritten. From CI:
curl -fsS -X PATCH "https://commareports.com/api/v1/reports/$REPORT_ID" \
-H "Authorization: Bearer $COMMA_API_TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n --rawfile html e2e/report/index.html \
--arg title "Detox — $GITHUB_REF_NAME" '{title: $title, html: $html}')"
One id per suite, PATCHed on every run, if: always() so red builds publish.
What changes when it is a link
- Anchored threads on the failing step, with the screenshot right there — "the button is off-screen on the SE, not missing." See commenting on HTML.
- Revisions, so an intermittent failure has a history rather than a rumour.
- No seat needed for the person who can tell you whether the screen is wrong or the test is.
Limits
- Entry HTML: 5 MB. Assets: 25 MB per file, 250 MB and 500 files total. Video recordings are the ones that hit the per-file cap — publish screenshots and keep the video in CI storage.
- 60 requests/minute per token.
Try it
Comma is free — unlimited reports, unlimited commenters, unlimited revision history.