mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 05:37:20 +03:00
fix(wheel): throw on wheel access in mobile WebKit (#10946)
This commit is contained in:
parent
0b86fbde90
commit
230e0b7049
@ -149,6 +149,8 @@ export class RawMouseImpl implements input.RawMouse {
|
||||
}
|
||||
|
||||
async wheel(x: number, y: number, buttons: Set<types.MouseButton>, modifiers: Set<types.KeyboardModifier>, deltaX: number, deltaY: number): Promise<void> {
|
||||
if (this._page?._browserContext._options.isMobile)
|
||||
throw new Error('Mouse wheel is not supported in mobile WebKit');
|
||||
await this._session!.send('Page.updateScrollingState');
|
||||
// Wheel events hit the compositor first, so wait one frame for it to be synced.
|
||||
await this._page!.mainFrame().evaluateExpression(`new Promise(requestAnimationFrame)`, false, false, 'utility');
|
||||
|
@ -112,7 +112,6 @@ it('should work when the event is canceled', async ({ page }) => {
|
||||
|
||||
contextTest('should scroll when emulating a mobile viewport', async ({ contextFactory, server, browserName }) => {
|
||||
contextTest.skip(browserName === 'firefox');
|
||||
contextTest.fixme(browserName === 'webkit');
|
||||
const context = await contextFactory({
|
||||
viewport: { 'width': 1000, 'height': 600 },
|
||||
isMobile: true,
|
||||
@ -120,8 +119,11 @@ contextTest('should scroll when emulating a mobile viewport', async ({ contextFa
|
||||
const page = await context.newPage();
|
||||
await page.goto(server.PREFIX + '/input/scrollable.html');
|
||||
await page.mouse.move(50, 60);
|
||||
await page.mouse.wheel(0, 100);
|
||||
await page.waitForFunction('window.scrollY === 100');
|
||||
const error = await page.mouse.wheel(0, 100).catch(e => e);
|
||||
if (browserName === 'webkit')
|
||||
expect(error.message).toContain('Mouse wheel is not supported in mobile WebKit');
|
||||
else
|
||||
await page.waitForFunction('window.scrollY === 100');
|
||||
});
|
||||
|
||||
async function listenForWheelEvents(page: Page, selector: string) {
|
||||
|
Loading…
Reference in New Issue
Block a user