Skip to content

Helper Configuration

Philipp Stracker edited this page Aug 12, 2021 · 9 revisions

Helper configuration

The only required option is the require value, which is always "codeceptjs-pixelmatchhelper". The other configuration values are optional. Here is a full list of supported items:

helpers: {
    PixelmatchHelper: {
        require:      "codeceptjs-pixelmatchhelper",  // Mandatory and static!
        dirExpected:  "./tests/screenshots/base/",    // Optional but recommended.
        dirDiff:      "./tests/screenshots/diff/",    // Optional but recommended.
        dirActual:    "./tests/output/",              // Optional.
        diffPrefix:   "Diff_",                        // Optional.
        tolerance:    2.5,                            // Optional.
        threshold:    0.05,                           // Optional.
        dumpIntermediateImage: true                   // Optional.
    }
}

dirExpected

Folder that contains the expected base images. Those base images are usually generated once from a stable website/app and are rarely updated.

Defaults to "./tests/screenshots/base/"

dirDiff

Folder that receives the diff-images for all comparison where the matching fails. The diff-folder is an output folder; any files in this folder can potentially be overwritten. Only failed tests generate a diff-image.

Defaults to "./tests/screenshots/diff/"

dirActual

Folder that holds the actual screenshots that should be tested against an expected base images. The actual screenshot are usually generated fresh for every test.

Defaults to global.output_dir

diffPrefix

You can define a custom prefix for diff-images with this option.

Defaults to "Diff_"

tolerance

The default tolerance for all comparisons. This value can always be overwritten for a single comparison using the options object (see below). The tolerance can be a float value between 0 and 100.

Defaults to 0

threshold

The default threshold for all comparisons. This value can always be overwritten for a single comparison using the options object (see below). The tolerance can be a float value between 0 and 1.

Defaults to 0.1

dumpIntermediateImage

Whether to save the intermediate images to the global output folder, after applying the bounds and ignore-boxes. This value can always be overwritten for a single comparison using the options object (see below).

This is useful for debugging your tests, but not recommended for production usage.

Defaults to false

Clone this wiki locally