Skip to content

Commit 2c109b3

Browse files
fix: incorrect determination of ignore area (#1056)
* fix: incorrect determination of ignore area * chore: provide a changeset * test: fix Android app tests
1 parent 5788bb5 commit 2c109b3

9 files changed

+19
-13
lines changed

.changeset/twenty-apes-pump.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
"@wdio/image-comparison-core": patch
3+
"@wdio/visual-service": patch
4+
---
5+
6+
# 🐛 Bugfixes
7+
8+
## #1038 fix incorrect determination of ignore area
9+
Ignore regions with `left: 0` and `right:0` lead to an incorrect width which lead to an incorrect ignore area. This is now fixed
10+
11+
12+
# Committers: 1
13+
14+
- Wim Selles ([@wswebcreation](https://github.com/wswebcreation))

packages/image-comparison-core/src/methods/__snapshots__/rectangles.test.ts.snap

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -347,18 +347,6 @@ exports[`rectangles > prepareIgnoreRectangles > should include mobile web rectan
347347
"right": 2688,
348348
"top": 5842,
349349
},
350-
{
351-
"bottom": 5842,
352-
"left": 0,
353-
"right": 0,
354-
"top": 640,
355-
},
356-
{
357-
"bottom": 5842,
358-
"left": 2688,
359-
"right": 2688,
360-
"top": 640,
361-
},
362350
]
363351
`;
364352

packages/image-comparison-core/src/methods/rectangles.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,12 @@ export function prepareIgnoreRectangles(options: PrepareIgnoreRectanglesOptions)
335335

336336
if (webStatusAddressToolBarOptions.length > 0) {
337337
// There's an issue with the resemble lib when all the rectangles are 0,0,0,0, it will see this as a full
338-
// blockout of the image and the comparison will succeed with 0 % difference
338+
// blockout of the image and the comparison will succeed with 0 % difference.
339+
// Additionally, rectangles with either width or height equal to 0 will result in an entire axis being ignored
340+
// due to how resemble handles falsy values. Filter those out up front.
339341
webStatusAddressToolBarOptions = webStatusAddressToolBarOptions
340342
.filter((rectangle) => !(rectangle.x === 0 && rectangle.y === 0 && rectangle.width === 0 && rectangle.height === 0))
343+
.filter((rectangle) => rectangle.width > 0 && rectangle.height > 0)
341344
}
342345
}
343346

tests/configs/wdio.saucelabs.shared.conf.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ export const config: WebdriverIO.Config = {
4949
createJsonReportFiles: true,
5050
rawMisMatchPercentage: !!process.env.RAW_MISMATCH || false,
5151
enableLayoutTesting: true,
52+
ignoreAntialiasing: true,
5253
} satisfies VisualServiceOptions,
5354
],
5455
],
-1.99 KB
Loading
Loading
Loading
Loading
Loading

0 commit comments

Comments
 (0)