Skip to content

Commit

Permalink
Merge pull request #2080 from camptocamp/image-test
Browse files Browse the repository at this point in the history
Image test fix...
  • Loading branch information
sbrunner authored Dec 22, 2023
2 parents 79f17dc + 0d5a21b commit 46ed5e3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion c2cwsgiutils/acceptance/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def check_image(
assert ((0 < mask) & (mask < 255)).sum() == 0, "Mask should be only black and white image"

# Convert to boolean
mask = mask != 0
mask = mask == 0

assert (
mask.shape[0] == image_to_check.shape[0] and mask.shape[1] == image_to_check.shape[1]
Expand All @@ -148,6 +148,7 @@ def check_image(
assert (
expected.shape[0] == mask.shape[0] and expected.shape[1] == mask.shape[1]
), f"Mask and expected image should have the same shape ({mask.shape} != {expected.shape})"
expected[mask] = [255, 255, 255]

assert (
expected.shape == image_to_check.shape
Expand Down
6 changes: 3 additions & 3 deletions c2cwsgiutils/acceptance/screenshot.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ const options = program.opts();
}
});

await page.goto(options.url, { timeout: 60000 });

await page.setViewport({
width: parseInt(options.width),
height: parseInt(options.height),
});
await page.waitForTimeout(parseInt(options.sleep));
await page.goto(options.url, { timeout: 60000 });

await new Promise((r) => setTimeout(r, parseInt(options.sleep)));
await page.screenshot({
path: options.output,
clip: { x: 0, y: 0, width: parseInt(options.width), height: parseInt(options.height) },
Expand Down

0 comments on commit 46ed5e3

Please sign in to comment.