Skip to main content

FAQ

Do I need to use a save(Screen/Element/FullPageScreen) methods when I want to run check(Screen/Element/FullPageScreen)?​

No, you don't need to do this. The check(Screen/Element/FullPageScreen) will do this automatically for you.

My visual tests fail with a difference, how can I update my baseline?​

You can update the baseline images through the command line by adding the argument --update-visual-baseline. This will

  • automatically copy the actual take screenshot and put it in the baseline folder
  • if there are differences it will let the test pass because the baseline has been updated

Usage:

npm run test.local.desktop --update-visual-baseline

When running logs info/debug mode you will see the following logs added

[0-0] ..............
[0-0] #####################################################################################
[0-0] INFO:
[0-0] Updated the actual image to
[0-0] /Users/wswebcreation/Git/wdio/visual-testing/localBaseline/chromel/demo-chrome-1366x768.png
[0-0] #####################################################################################
[0-0] ..........

Width and height cannot be negative​

It could be that the error Width and height cannot be negative is thrown. 9 out of 10 times this is related to creating an image of an element that is not in the view. Please be sure you always make sure the element in is in the view before you try to make an image of the element.

Installation of Canvas on Windows failed with Node-Gyp logs​

If you encounter issues with Canvas installation on Windows due to Node-Gyp errors, please note that this applies only to Version 4 and lower. To avoid these issues, consider updating to Version 5 or higher, which does not have these dependencies. Version 5 to 9 used Jimp for image processing; Version 10 and up use fast-png and Pixelmatch with no native dependencies.

If you still need to resolve the issues with Version 4, please check:

I upgraded to v11, why did a mismatch percentage change?​

In v11 the comparison engine is pixelmatch 8, which measures color differences in the OKLab color space with the HyAB distance instead of YIQ. The threshold scale (0 to 1) and the ignore* presets did not change, but the number of different pixels can change a little for the same images (about −3 % to +3 % on real screenshots). If a check depends on an exact mismatch percentage or a tight tolerance, check it again, and update the baseline with --update-visual-baseline only when the new result is correct. Some fixes can also change a baseline once, for example iOS element screenshots of elements larger than the viewport, which no longer have a black area. See the v11 migration guide.

I upgraded to v10, why are my visual tests failing?​

The comparison engine changed from ResembleJS to Pixelmatch in v10. Pixelmatch uses a perceptual (YIQ) color model instead of raw RGB, so mismatch percentages differ from v9. Your tests haven't broken; the baselines just need to be regenerated once. Run your tests with --update-visual-baseline to accept the new values, or delete your baseline folder and let autoSaveBaseline recreate it.

Welcome! How can I help?

WebdriverIO AI Copilot