Minor Changes
-
b194642: fix: ignore* option parity with resemble (pixelmatch)
After v10 switched to pixelmatch, the public
ignore*API did not fully match resemble.js preset behaviour. Combined modes such asignoreLesswith the defaultignoreAntialiasing: truestill inherited AA forgiveness, andignoreColorsused BT.601 grayscale instead of resemble brightness-only comparison.This release also adds
compareOptions.pixelmatchso you can pass pixelmatch settings directly instead of usingignore*presets.What changed
- Multiple
ignore*flags now follow resemble last-wins ordering (ignoreAlpha→ignoreAntialiasing→ignoreColors→ignoreLess→ignoreNothing) instead of composing independently ignoreLess,ignoreAlpha,ignoreColors, andignoreNothingnow apply their own threshold and AA rules when active; they no longer inherit defaultignoreAntialiasing: trueforgivenessignoreColorsnow compares brightness only using resemble luma weights (0.3/0.59/0.11), matching resemble v9 behaviour- WDIO logs a warning when multiple
ignore*flags are enabled, naming which preset wins - New
compareOptions.pixelmatchobject for direct pixelmatch control (threshold,includeAA,diffColor,aaColor,diffColorAlt,alpha,diffMask,checkerboard)
Preset reference
Active preset threshold AA forgiven ignoreNothing0 no ignoreLess~16/255 no ignoreColors~16/255 no (brightness only) ignoreAlpha~16/255 no ignoreAntialiasing(default)~32/255 yes Using
compareOptions.pixelmatchSet it in your service config or on a single
check*call. Do not putignore*keys andpixelmatchon the same options object; that throws, even when anignore*flag isfalse. Service config and method options are separate objects, so a method call can override the service compare mode for that check (a warning is logged when the mode switches).Service config:
// wdio.conf.js services: [ [ "visual", { compareOptions: { pixelmatch: { threshold: 0.063, includeAA: true, }, }, }, ], ];
Method override when the service uses
ignore*presets:await browser.checkScreen("homepage", { pixelmatch: { threshold: 0.05 }, });
Method override when the service uses
pixelmatch:await browser.checkScreen("homepage", { ignoreLess: true, });
Invalid (throws):
compareOptions: { ignoreLess: false, pixelmatch: { threshold: 0.063 }, }
See pixelmatch for option details.
What you need to do
- No change needed if you use a single
ignore*flag or rely on defaults (ignoreAntialiasing: true) - Set
ignoreAntialiasing: falsewhen anti-aliased pixels should count as differences - If you combine multiple
ignore*flags, review your tests; last-wins ordering now matches resemble v9 - If you use
ignoreColors, results may differ slightly from early v10 but align with resemble v9 - To tune pixelmatch directly, add
compareOptions.pixelmatchin your service config or passpixelmatchon individualcheck*calls
- Multiple