From acbc59999bf800eeac75c4045b75a32b4357c79e Mon Sep 17 00:00:00 2001 From: jrandolf <101637635+jrandolf@users.noreply.github.com> Date: Mon, 10 Oct 2022 16:00:47 +0200 Subject: [PATCH] fix: remove viewport conditions in `waitForSelector` (#9087) This PR removes the viewport conditions in `waitForSelector`. See discussion: https://github.com/puppeteer/puppeteer/pull/8954#issuecomment-1272338883 --- packages/puppeteer-core/src/injected/util.ts | 9 +----- test/src/waittask.spec.ts | 30 -------------------- 2 files changed, 1 insertion(+), 38 deletions(-) diff --git a/packages/puppeteer-core/src/injected/util.ts b/packages/puppeteer-core/src/injected/util.ts index 94f993f7..00c4c726 100644 --- a/packages/puppeteer-core/src/injected/util.ts +++ b/packages/puppeteer-core/src/injected/util.ts @@ -64,12 +64,5 @@ export const checkVisibility = ( function isBoundingBoxVisible(element: Element): boolean { const rect = element.getBoundingClientRect(); - return ( - rect.width > 0 && - rect.height > 0 && - rect.right > 0 && - rect.bottom > 0 && - rect.left < self.innerWidth && - rect.top < self.innerHeight - ); + return rect.width > 0 && rect.height > 0 && rect.right > 0 && rect.bottom > 0; } diff --git a/test/src/waittask.spec.ts b/test/src/waittask.spec.ts index 36941ff8..9254868b 100644 --- a/test/src/waittask.spec.ts +++ b/test/src/waittask.spec.ts @@ -537,38 +537,8 @@ describe('waittask specs', function () { Promise.race([promise, createTimeout(40)]) ).resolves.toBeFalsy(); await element.evaluate(e => { - e.style.setProperty('position', 'absolute'); - e.style.setProperty('right', '100vw'); e.style.removeProperty('height'); }); - await expect( - Promise.race([promise, createTimeout(40)]) - ).resolves.toBeFalsy(); - await element.evaluate(e => { - e.style.setProperty('left', '100vw'); - e.style.removeProperty('right'); - }); - await expect( - Promise.race([promise, createTimeout(40)]) - ).resolves.toBeFalsy(); - await element.evaluate(e => { - e.style.setProperty('top', '100vh'); - e.style.removeProperty('left'); - }); - await expect( - Promise.race([promise, createTimeout(40)]) - ).resolves.toBeFalsy(); - await element.evaluate(e => { - e.style.setProperty('bottom', '100vh'); - e.style.removeProperty('top'); - }); - await expect( - Promise.race([promise, createTimeout(40)]) - ).resolves.toBeFalsy(); - await element.evaluate(e => { - // Just peeking - e.style.setProperty('bottom', '99vh'); - }); await expect(promise).resolves.toBeTruthy(); }); it('should wait for element to be visible recursively', async () => {