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
This commit is contained in:
jrandolf 2022-10-10 16:00:47 +02:00 committed by GitHub
parent 87c08fd86a
commit acbc59999b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 1 additions and 38 deletions

View File

@ -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;
}

View File

@ -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 () => {