From e5e0a7d375eff6b22b7799a76e71b133906bdbd6 Mon Sep 17 00:00:00 2001 From: Diya Date: Sat, 27 Jan 2024 11:33:17 +0530 Subject: [PATCH] Adds Error message for when there are no screenshots and the developer might need to wait for a promise --- test/unit/visual/visualTest.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/unit/visual/visualTest.js b/test/unit/visual/visualTest.js index 24dbec2f53..a0bc033b7c 100644 --- a/test/unit/visual/visualTest.js +++ b/test/unit/visual/visualTest.js @@ -151,6 +151,12 @@ window.visualTest = function( actual.push(myp5.get()); }); + + if (actual.length === 0) { + throw new Error('No screenshots were generated. Check if your test generates screenshots correctly.If the test includes asynchronous operations, ensure they complete before the test ends.'); + } + + if (expectedScreenshots && actual.length !== expectedScreenshots) { throw new Error( `Expected ${expectedScreenshots} screenshot(s) but generated ${actual.length}`