diff --git a/src/support/steps/ll-css-bg-image.ts b/src/support/steps/ll-css-bg-image.ts index 1675f15..f3bb185 100644 --- a/src/support/steps/ll-css-bg-image.ts +++ b/src/support/steps/ll-css-bg-image.ts @@ -66,18 +66,24 @@ When('I go to {string} Check initial image loaded', async function (this: ICusto this.page.on('request', request => { if (request.resourceType() === 'image') { - images[0] = request.url(); - expect(images).not.toContain(LL_BACKGROUND_IMAGES.templateOne.onLoad) + images.push(request.url()); } }); - await this.utils.visitPage(page); await this.page.waitForLoadState('load', { timeout: 100000 }); + + expect(images).toEqual(LL_BACKGROUND_IMAGES.templateOne.initialImages) }); Then('I must see other lazyloaded images', async function (this: ICustomWorld) { + this.page.on('request', request => { + if (request.resourceType() === 'image') { + console.log(request.url()); + } + }); await this.page.evaluate(async () => { const scrollPage: Promise = new Promise((resolve) => { + let totalHeight = 0; const distance = 100; const timer = setInterval(() => { @@ -93,12 +99,6 @@ 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) - } - }); }); this.page.on('request', request => {