diff --git a/packages/playwright-core/src/server/webkit/wkInput.ts b/packages/playwright-core/src/server/webkit/wkInput.ts index 16ff4c162f..87554d287b 100644 --- a/packages/playwright-core/src/server/webkit/wkInput.ts +++ b/packages/playwright-core/src/server/webkit/wkInput.ts @@ -149,6 +149,8 @@ export class RawMouseImpl implements input.RawMouse { } async wheel(x: number, y: number, buttons: Set, modifiers: Set, deltaX: number, deltaY: number): Promise { + 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'); diff --git a/tests/page/wheel.spec.ts b/tests/page/wheel.spec.ts index b87397f2bf..e2949c57f2 100644 --- a/tests/page/wheel.spec.ts +++ b/tests/page/wheel.spec.ts @@ -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) {