Skip to content

Installation

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

Note: This helper requires CodeceptJS to work

npm

npm install codeceptjs-pixelmatchhelper

yarn

yarn add codeceptjs-pixelmatchhelper

Configuration

Include this helper in your codecept.json/codecept.conf.js file. For example:

helpers: {
    PixelmatchHelper: {
        require: "codeceptjs-pixelmatchhelper"
    }
}

After this, the helper provides three new methods via the I actor:

// Takes a screenshot of the current page. 
await I.takeScreenshot("screenshot.png");

// Compares the current screenshot.png with the expected base image. 
// Fails, if the images do not match.
await I.checkVisualDifferences("screenshot.png");

// Compares the current screenshot.png with the expected base image 
// and returns the result instead of failing the test.
const result = await I.getVisualDifferences("screenshot.png");

← Overview | Configuration →

Clone this wiki locally