From 8236f0d5dc2dc0da5a7a5d3bc97865c8f274d64a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 21 Dec 2023 14:57:34 +0100 Subject: [PATCH 1/3] Revert "Fix mask" This reverts commit b07dfc7bdcbc83d825d35f12fff92e29d1d73385. --- c2cwsgiutils/acceptance/image.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c2cwsgiutils/acceptance/image.py b/c2cwsgiutils/acceptance/image.py index a08de53b5..1b29d9421 100644 --- a/c2cwsgiutils/acceptance/image.py +++ b/c2cwsgiutils/acceptance/image.py @@ -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] From 7dcaff40d4767426ce584d9c91efc5933ddb9525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 21 Dec 2023 17:04:02 +0100 Subject: [PATCH 2/3] Fix order, deprecated --- c2cwsgiutils/acceptance/screenshot.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c2cwsgiutils/acceptance/screenshot.js b/c2cwsgiutils/acceptance/screenshot.js index 9661df891..5d29c3da7 100644 --- a/c2cwsgiutils/acceptance/screenshot.js +++ b/c2cwsgiutils/acceptance/screenshot.js @@ -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) }, From 0d5a21bf0b5ec47739ec5c80272bb38db1cbb0e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Brunner?= Date: Thu, 21 Dec 2023 17:18:51 +0100 Subject: [PATCH 3/3] Fix diff with mask --- c2cwsgiutils/acceptance/image.py | 1 + 1 file changed, 1 insertion(+) diff --git a/c2cwsgiutils/acceptance/image.py b/c2cwsgiutils/acceptance/image.py index 1b29d9421..95cc79ac0 100644 --- a/c2cwsgiutils/acceptance/image.py +++ b/c2cwsgiutils/acceptance/image.py @@ -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