Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport master] Image test fix... #2081

Merged
merged 3 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading