Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: scroll into view span element (#20628)

Yury Semikhatsky492e9f6d7c19
diff --git a/tests/page/page-click-scroll.spec.ts b/tests/page/page-click-scroll.spec.ts
index 12bc4ada39..8d148ca45e 100644
--- a/tests/page/page-click-scroll.spec.ts
+++ b/tests/page/page-click-scroll.spec.ts
@@ -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);
+});
\ No newline at end of file