Skip to content

Commit

Permalink
✨ Add check for lazyloaded images after scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Mar 29, 2024
1 parent 81bce2a commit ace5fcd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/features/lazy-load.feature
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 3 additions & 7 deletions src/support/steps/ll-css-bg-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand All @@ -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)
});

0 comments on commit ace5fcd

Please sign in to comment.