gemini-testing / testplane

Testplane (ex-hermione) browser test runner based on mocha and wdio
https://testplane.io
MIT License
713 stars 62 forks source link

feat: add ability to specify ignoreDiffPixelCount in assertView #849

Closed KuznetsovRoman closed 8 months ago

KuznetsovRoman commented 8 months ago

What is done

Implemented ignoreDiffPixelCount optional param to assertView command. With there params, it would be possible to ignore 2-5 pixel image diffs, which are hard to get rid of

Example:

it('example', async ({browser}) => {
    // ignores up to 5 diff pixels
    await browser.assertView('some-state', 'some-selector', {ignoreDiffPixelCount: 5});

    // ignores up to 5% diff pixels
    await browser.assertView('other-state', 'other-selector', {ignoreDiffPixelCount: "5%"});
});