test: scroll into view span element (#20628)

https://github.com/microsoft/playwright/issues/20165
This commit is contained in:
Yury Semikhatsky 2023-02-04 10:32:53 -08:00 committed by GitHub
parent 758246bb9e
commit 492e9f6d7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,3 +86,15 @@ it('should not crash when force-clicking hidden input', async ({ page, browserNa
const error = await page.locator('input').click({ force: true, timeout: 2000 }).catch(e => e);
expect(error.message).toContain('Element is not visible');
});
it('should scroll into view span element', async ({ page, browserName }) => {
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/20165' });
it.fixme(browserName === 'webkit');
await page.setContent(`
<div id=big style="height: 10000px;"></div>
<span id=small>foo</span>
`);
await page.locator('#small').scrollIntoViewIfNeeded();
console.log(await page.evaluate(() => window.scrollY));
expect(await page.evaluate(() => window.scrollY)).toBeGreaterThan(9000);
});