From 6139cacbbd4e707d0501538240f9dbf956b28f8b Mon Sep 17 00:00:00 2001 From: optimalisatie Date: Sat, 26 Sep 2020 18:52:30 +0000 Subject: [PATCH] 1.2.1 --- test/specs/test-definitions.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/test/specs/test-definitions.js b/test/specs/test-definitions.js index 06afeb5..1b8934d 100644 --- a/test/specs/test-definitions.js +++ b/test/specs/test-definitions.js @@ -626,11 +626,16 @@ TEST_DEFINITIONS.basic = function() { (document.getElementById('img_' + pos).getAttribute('src').indexOf(type) !== -1) } - setTimeout(function() { - + let c = 0; + let i = setInterval(function() { + c++; if (!check('no_webp', '.png')) { - cb('top img not loaded - src:' + document.getElementById('img_no_webp').getAttribute('src') + ' webp:' + check('no_webp')); + if (c > 10) { + clearInterval(i); + cb('top img not loaded - src:' + document.getElementById('img_no_webp').getAttribute('src') + ' webp:' + check('no_webp')); + } } else { + clearInterval(i); cb(true); } }, 100);