Testim Documentation

Welcome to the Testim documentation. You'll find comprehensive guides to help you get started quickly, example code snippets, and tips for being more productive. You will also find details about advanced features that allow you to customize Testim to fit your environment or special testing conditions. Don't worry, we'll support you if you get stuck. Let's jump right in!

Guides    Changelog

Root Cause Jest integration

Using Root Cause with Jest

Integrating Root Cause with Jest requires minor config changes in Jest. Following the configuration, Root Cause will begin collecting root cause analysis information, such as located elements, screenshots, console logs, etc.
If you are not sure how your Jest is configured, see https://jestjs.io/docs/en/configuration.

For working puppeteer examples
For working playwright examples

📘

Note

Ensure you have Puppeteer/Playwright integration that exposes browser & page globally.

Install the Root Cause jest package:

npm install @testim/root-cause-jest

For the following example, we assume you are using jest-puppeteer as preset.

const puppeteerPreset = require('jest-puppeteer-preset/jest-preset.json');
const runId = Date.now().toString();

module.exports = {
    ...puppeteerPreset,
    reporters: [
        ['@testim/root-cause-jest/lib/reporter/default', { runId }],
    ],
    setupFilesAfterEnv: [
        ...puppeteerPreset.setupFilesAfterEnv,
        '@testim/root-cause-jest/lib/forSetupFilesAfterEnv'
    ],
    globals: {
        runId,
    },
};

For the following example, we assume you are using jest-playwright as preset.

const playwrightPreset = require("jest-playwright-preset/jest-preset.json");

const runId = Date.now().toString();

module.exports = {
    ...playwrightPreset,
    testRunner: 'jasmine2',
    reporters: [
        ['@testim/root-cause-jest/lib/reporter/default', { runId }],
    ],
    setupFilesAfterEnv: [
        ...playwrightPreset.setupFilesAfterEnv, '@testim/root-cause-jest/lib/forSetupFilesAfterEnv'
    ],
    globals: {
        runId,
    },
};

As you can see in the example, we add a Root Cause reporter and Root Cause setupFilesAfterEnv entry.
We also pass runId as a global Jest variable and as a parameter to the Jest reporter.
The value of runId should be unique for each Jest run.

Updated 24 days ago


Root Cause Jest integration


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.