Skip to content
The docs are now organized by product area. Old links still work. Report a broken link

Detox reporter

Install @qualflare/detox in the Jest config Detox uses, then upload its qualflare-results folder and Detox artifacts with the Qualflare CLI.

Last updated

@qualflare/detox is the Qualflare reporter for Detox 20 or later: it writes each run's results, with retries, steps and the iOS or Android platform, to ./qualflare-results, and qf <identifier> collect --artifacts-dir ./artifacts uploads them with Detox's screenshots, videos and logs.

FactDetail
Package@qualflare/detox on npm
Works withDetox 20 or later, Jest 29 or later, Node.js 18 or later
qfqf ≥ 0.1.32 (requires qf 0.1.32 or later) for --artifacts-dir
LicenseApache-2.0
SourceQualflare/qualflare-detox on GitHub
Without the reporter--format detox with Detox's Jest JSON

Before you begin

  • The Qualflare CLI, qf: Install the CLI.
  • A saved login: qf login <identifier> with a project access token whose creator still holds the project role that uploads need Editor+ · project (requires the Editor role or higher in the project) (Authenticate with qf login).
  • The Identifier of the environment the results belong to (Environments).

Install

npm install --save-dev @qualflare/detox

It brings @qualflare/jest with it.

Configure

Add the reporter to the Jest config Detox uses, usually e2e/jest.config.js, and keep Detox's own reporter.

module.exports = {
  rootDir: '..',
  testMatch: ['<rootDir>/e2e/**/*.test.js'],
  testTimeout: 120000,
  verbose: true,
  reporters: ['detox/runners/jest/reporter', '@qualflare/detox/reporter'],
  globalSetup: 'detox/runners/jest/globalSetup',
  globalTeardown: 'detox/runners/jest/globalTeardown',
  testEnvironment: 'detox/runners/jest/testEnvironment',
};
OptionTypeDefaultRequiredDescription
platformstringdetectedNo

ios or android from the Detox session. Set it for a device driver whose type starts with neither, or the Jest default web applies.

Every other option is the Jest reporter's.

Every reporter shares the other settings: see Reporter configuration.

Set environment to the environment's Identifier: a name such as Staging fails the upload with HTTP 400 (Environment).

Run and upload

detox test --configuration ios.sim.debug --take-screenshots failing --record-videos failing
qf <identifier> collect ./qualflare-results --artifacts-dir ./artifacts

Screenshots upload by default. Videos and device logs upload with --upload-artifacts video,trace.

--artifacts-dir takes the Detox artifacts root or one run inside it, and nothing is scanned without it: see Attach Detox artifacts.

Run in CI

- name: Upload results to Qualflare
  if: ${{ !cancelled() }}
  env:
    QF_TOKEN: ${{ secrets.QF_TOKEN }}
    QF_BRANCH: ${{ github.head_ref || github.ref_name }}
    QF_COMMIT: ${{ github.event.pull_request.head.sha || github.sha }}
  run: |
    npm install -g @qualflare/cli
    qf login ci --force
    qf ci collect ./qualflare-results --artifacts-dir ./artifacts

if: ${{ !cancelled() }} uploads the results when tests fail, and QF_BRANCH and QF_COMMIT record a pull request's own branch and commit (Pull request branches). For GitLab CI/CD, Jenkins and Azure Pipelines, see Run the upload when tests fail.

Sharding and retries

Artifacts attach to the test, not to each attempt: a retried test's files all attach to the one test, with the attempt in each file name. To upload several CI jobs as one launch, see Merge sharded CI jobs into one launch.

What gets uploaded

  • Statuses, durations and the history of each retried attempt.
  • Steps and your own metadata.
  • The platform, ios or android.
  • Detox's screenshots, videos and device logs, matched to tests by test name.

The metadata calls are @qualflare/jest's, re-exported:

import { qualflare } from '@qualflare/detox';

it('signs in', async () => {
  qualflare.label('suite', 'auth');
  await qualflare.step('tap login', async () => {
    await element(by.id('login')).tap();
  });
});

qf doesn't read the branch, commit, language or milestone from the report: set them on the upload (Branch, commit, language and milestone).

Troubleshooting

  • No artifacts: pass --artifacts-dir; ./artifacts is never guessed.
  • Two tests with the same full name get each other's artifacts.
  • --artifacts-dir is not supported for <format> reports: the report isn't a Detox or Jest report.
  • Multi-device runs and detox test --device-name are untested.
  • environment "Staging" does not exist in this project: use the environment's Identifier, or pass --environment on the upload (Environment).
  • Screenshots can't be downloaded: qf is older than 0.1.24. Upgrade qf.