feat: add ElementHandle.scrollIntoView (#10005)

This commit is contained in:
Alex Rudenko
2023-04-12 07:17:18 +02:00
committed by GitHub
parent 656b562c74
commit 0d556a71d6
6 changed files with 102 additions and 41 deletions

View File

@@ -509,6 +509,12 @@
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[click.spec] Page.click should scroll and click with disabled javascript",
"platforms": ["darwin", "linux", "win32"],
"parameters": ["cdp", "firefox"],
"expectations": ["FAIL"]
},
{
"testIdPattern": "[click.spec] Page.click should select the text by triple clicking",
"platforms": ["darwin", "linux", "win32"],

View File

@@ -116,6 +116,18 @@ describe('Page.click', function () {
await Promise.all([page.click('a'), page.waitForNavigation()]);
expect(page.url()).toBe(server.PREFIX + '/wrappedlink.html#clicked');
});
it('should scroll and click with disabled javascript', async () => {
const {page, server} = getTestState();
await page.setJavaScriptEnabled(false);
await page.goto(server.PREFIX + '/wrappedlink.html');
const body = await page.waitForSelector('body');
await body!.evaluate(el => {
el.style.paddingTop = '3000px';
});
await Promise.all([page.click('a'), page.waitForNavigation()]);
expect(page.url()).toBe(server.PREFIX + '/wrappedlink.html#clicked');
});
it('should click when one of inline box children is outside of viewport', async () => {
const {page} = getTestState();