Skip to main content

Configuration

Config Examples

testplane.config.ts
export = {
// ...
plugins: {
'html-reporter/testplane': {
enabled: true,
path: 'html-report',
},
},
};

Configuration Reference

ParameterTypeDefault valueDescription
enabledbooleantrueEnable / disable the plugin.
pathstring"testplane-report"The path to the folder for saving html-report files.
saveErrorDetailsbooleanfalseSave / do not save error details in json files.
uiModestringnullDefault UI mode: "old" for classic interface, "new" for modern interface.
defaultViewstring"all"The test filtering mode when displayed, which will be set by default.
diffModestring"3-up"The mode of viewing diffs, which will be set by default.
baseHoststringN/AReplaces the original host address for viewing in the browser.
errorPatternsErrorPattern[] | string[][]Error patterns with hints to improve the UX of the report.
metaInfoBaseUrlsRecord<string, string>{}Base URLs for generating links in the Meta section based on meta information about the tests run.
saveFormatstring"sqlite"DEPRECATED. Allows you to set the format in which the results of the tests run will be saved.
customGuiCustomGUI{ }DEPRECATED. Use plugins instead. Description of custom controls for GUI mode.
pluginsEnabledbooleanfalseEnable plugins for the report.
pluginsPlugin[][]A list of plugins with their settings.
customScriptsAnyFunction[][]A list of functions that implement custom scripts. For example, Yandex.Metrika scripts or a Bug.
yandexMetrikaYandexMetrikasee belowYandex.Metrika.

enabled

Enables or disables the plugin.

path

The path to the folder for saving html-report files. By default, the files will be saved to the testplane-report folder in the current working folder.

saveErrorDetails

Save or not save error details in json files (to the error-details folder).

By default, "do not save": false.

Any Testplane plugin can add any details to the error object when it occurs. These details can help the user in debugging problems that have occurred in the test. Html-reporter saves these details in the error-details folder in a file named: <hash from the full name of the test>-<browser>_<retry number>_<timestamp>.json.

Under the stack trace, the html-reporter adds an Error details section with a <title> link pointing to the json file. The user can open this file either in the browser or in any IDE.

Example of how to add details to an error object from a plugin:

const err = new Error("some error");

err.details = {
title: "description, will be used as url title",
data: {}, // or [], or String
};

throw err;

uiMode

Default UI mode: "old" for classic interface, "new" for modern interface. Affects redirects between old and new interfaces.

By default, no redirects are performed.

Available values: "old", "new".

For example, if set to "new", users will be redirected to the new interface when trying to access the old interface. However, if the user manually clicks "return to old interface", this preference will be saved, and they will always use the old interface until they switch back.

defaultView

The test filtering mode when displayed, which will be set by default. The following values are available:

View modeDescription
allall tests
passedonly passed tests
failedonly failed tests
retriedonly those tests in which there were retries (re-runs)
skippedonly disabled (skipped) tests

By default: all, that is, if the parameter is not set, all tests will be displayed.

diffMode

The mode of viewing diffs, which will be set by default. The following values are available:

Diff modeDescription
3-upall images (expected, actual, diff) in one column, under each other
3‑up‑scaledall images (expected, actual, diff) in one row so that they fit on the screen
only-diffonly diff image
switchreference image with the ability to switch to the actual image by mouse click
swipethe actual image on top of the reference image, with a separator opening the reference image
onion-skinthe actual image on top of the reference with the ability to change the transparency of the actual image

By default: 3-up.

baseHost

Replaces the original host address for viewing in the browser. By default, the original host address is not changed.

errorPatterns

Error patterns are used:

  • to show more understandable error information if they correspond to patterns for which there is a detailed description;
  • in the Group by display mode with the error key selected.

Error patterns can be set either as objects or as strings.

To set the error pattern as an object, use the following format:

{
name: '<error name>',
pattern: '<error pattern>',
hint: '<hint to the user>'
}

where:

ParameterTypeDescription
namestringError name.
patternstring | RegExpA regular expression or a regular string that the error should match.
hintstringOptional parameter. A hint of what can be done with this error: why it occurred, how to fix it, etc.

If the error pattern is specified as a string, for example: <error>, then this string is automatically treated as an object of the form:

{
name: '<error>',
pattern: '<error>'
}

This way of setting a pattern is convenient for those errors where name and pattern are completely the same.

When one of the error patterns matches the error message, then:

  • the name of the error template will be displayed as the title of the error message, and the original error message will be hidden under the cut;
  • the hint for the error will be displayed after the error field stack. The hint can be specified as an html string. For example, <div>some-useful-hint</div>.

In the Group by mode with the selected error key, the test will be associated with the group if the test error matches the group error pattern. If the test cannot be linked to existing groups, a new group will be created.

metaInfoBaseUrls

Base URLs for generating links in the Meta section based on meta information about the tests run.

The parameter is set as an object:

{
'<option-1>': 'value of option 1',
'<option-2>': 'value of option 2',
// etc.
}

For example:

{
'file': 'base/path'
}

When the value of any key is set to auto, the base URL will be set to the base host specified in the report UI, or remain unchanged if the base host is not specified.

For example, if you have the following metaInfoBaseUrls value:

{
custom_url: "auto";
}

And you set the meta.custom_url field to https://example.com/some/path in your tests, you will see in the meta:

  • A link to https://example.com/some/path if the base host is not set in the UI
  • A link to https://another-host.com/some/path if the base host in the UI is set to https://another-host.com

saveFormat

DEPRECATED

Allows you to set the format in which the results of the tests run will be saved.

Only one value is available now, which is used by default:

  • sqlite — save the results of the tests run in the database of SQLite format.

customGui

DEPRECATED

warning

Instead of customGui, it is recommended to use report plugins.

Description of custom controls for GUI mode.

See more in the section "Customizing GUI".

pluginsEnabled

Enable plugins for html-reporter.

plugins

A list of plugins with their settings.

See more details in the section "Plugins".

customScripts

A list of custom scripts in the form of an array of functions. Using this parameter, you can add any script to the html-report page. For example, to collect any metrics or implement additional functionality. The scripts will be executed immediately after rendering the page.

For example:

customScripts: [
function () {
console.info("some logs");
},
() => {
const div = document.createElement("div");
div.innerHTML = "hello";
document.body.prepend(div);
},
];

yandexMetrika

By default, anonymous data about report UI usage is collected for analysis and UX improvement purposes. Data collected includes report loading speed, frequency of some feature usage (e.g., test sorting), and clicks on UI elements. Data about your project or test content is NOT collected under any circumstances.

If you don't want to share analytics with us, you can disable it in any of the following ways:

  • In the config
    module.exports = {
    plugins: {
    "html-reporter/testplane": {
    yandexMetrika: {
    enabled: false,
    },
    // other html-reporter settings...
    },
    // other Testplane plugins...
    },
    // other Testplane settings...
    };
  • Using environment variables: html_reporter_yandex_metrika_enabled=false or simply NO_ANALYTICS=true
  • Using CLI arguments: --html-reporter-yandex_metrika_enabled=false

Passing parameters via the CLI

All plugin parameters that can be defined in the config can also be passed as command line options or through environment variables during Testplane startup. Use the prefix --html-reporter- for command line options and html_reporter_ for environment variables.

For example, the settings parameter path can be passed in the following ways:

testplane path/to/mytest.js --html-reporter-path custom/dir
html_reporter_path=custom/dir testplane path/to/mytest.js

Data storage

As mentioned above, html-reporter saves the tests run results to the SQLite database.

Why do we use SQLite? Because it is:

  • serverless, easy to connect and requires no configuration
  • cross-platform, runs on any operating system
  • single-file, easy to reuse reports and share them
  • faster than if you store the report on the file system
  • compact and has full SQL.

Files that are created during the execution of tests:

  • sqlite.db—Sqlite database with tests run results
  • data.js—report configuration
  • databaseUrls.json—absolute or relative URLs to SQLite databases (sqlite.db) and/or URLs of other databaseUrls.json files (see command merge-reports).