Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test(wheel): add test for scrolling while emulating mobile (#10224)
Joel Einbinder0878548238db
diff --git a/tests/page/wheel.spec.ts b/tests/page/wheel.spec.tsindex 79b7a8748a..b87397f2bf 100644--- a/tests/page/wheel.spec.ts+++ b/tests/page/wheel.spec.ts@@ -15,6 +15,8 @@*/import type { Page } from 'playwright-core';import { test as it, expect } from './pageTest';+import { contextTest } from '../config/browserTest';+it.skip(({ isElectron, browserMajorVersion }) => {// Old Electron has flaky wheel events.return isElectron && browserMajorVersion <= 11;@@ -108,6 +110,20 @@ it('should work when the event is canceled', async ({ page }) => {expect(await page.evaluate('window.scrollY')).toBe(0);});+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,+ });+ 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');+});+async function listenForWheelEvents(page: Page, selector: string) {await page.evaluate(selector => {document.querySelector(selector).addEventListener('wheel', (e: WheelEvent) => {