Skip to content

Commit

Permalink
:close: modified functions to get network request #56
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Mar 28, 2024
1 parent 63282bd commit 81bce2a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/support/steps/ll-css-bg-image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> = new Promise((resolve) => {

let totalHeight = 0;
const distance = 100;
const timer = setInterval(() => {
Expand All @@ -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 => {
Expand Down

0 comments on commit 81bce2a

Please sign in to comment.