From ace5fcd69c441f105159f9a2e43b3bdc3215e478 Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Fri, 29 Mar 2024 11:55:02 +0100 Subject: [PATCH] :sparkles: Add check for lazyloaded images after scrolling --- src/features/lazy-load.feature | 6 +++--- src/support/steps/ll-css-bg-image.ts | 10 +++------- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/src/features/lazy-load.feature b/src/features/lazy-load.feature index 6c3bb53..8357f8f 100644 --- a/src/features/lazy-load.feature +++ b/src/features/lazy-load.feature @@ -1,9 +1,9 @@ -@llimg +@llimg @setup Feature: Check if content are lazyloaded while scrolling Background: Given I am logged in - #And plugin is installed 'new_release' - #And plugin is activated + And plugin is installed 'new_release' + And plugin is activated When I go to 'wp-admin/options-general.php?page=wprocket#dashboard' And I save settings 'media' 'lazyloadCssBgImg' And clear wpr cache diff --git a/src/support/steps/ll-css-bg-image.ts b/src/support/steps/ll-css-bg-image.ts index f3bb185..1352ae9 100644 --- a/src/support/steps/ll-css-bg-image.ts +++ b/src/support/steps/ll-css-bg-image.ts @@ -76,9 +76,10 @@ When('I go to {string} Check initial image loaded', async function (this: ICusto }); Then('I must see other lazyloaded images', async function (this: ICustomWorld) { + const images = []; this.page.on('request', request => { if (request.resourceType() === 'image') { - console.log(request.url()); + images.push(request.url()); } }); await this.page.evaluate(async () => { @@ -101,10 +102,5 @@ Then('I must see other lazyloaded images', async function (this: ICustomWorld) { await scrollPage; }); - this.page.on('request', request => { - if (request.resourceType() === 'image') { - console.log(request.url()); - //expect(images).not.toContain(LL_BACKGROUND_IMAGES.templateOne.onLoad) - } - }); + expect(images).toEqual(LL_BACKGROUND_IMAGES.templateOne.lazyLoadedImages) }); \ No newline at end of file