visual-testing icon indicating copy to clipboard operation
visual-testing copied to clipboard

image comparison with certain misMatch % difference is not allowed to certify via assertion

Open wswebcreation opened this issue 2 years ago • 0 comments

WebdriverIO Version: 8.35.1

Node.js Version 18

Wdio Visual service version 4.1.0

Issue: I have certified one test case of image comparison like this: await expect(element).toMatchElementSnapshot("tagName")

However there's a difference of certain % with baseline image. So I have updated my assertion like this: await expect(element).toMatchElementSnapshot("tagName", 2) <--- in order to pass this test case with misMatchPercenatage diff of 2 or less than 2% but while running it gave error in terminal

Error: Expected image to have a mismatch percentage of 2%, but was 1.8536803906635%

I do know another way to achieve the same thing but it requires 2 steps: const misMatchPercentage: number = await browser.checkElement(element, "tagName"); await expect(misMatchPercentage).toBeLessThanOrEqual(2);

Can we achieve the same thing with one line of assertion ?

cc: @jt-brevitaz

wswebcreation avatar Apr 08 '24 07:04 wswebcreation