diff --git a/tests/assets/detect-touch.html b/tests/assets/detect-touch.html
deleted file mode 100644
index 8ccb82dc79..0000000000
--- a/tests/assets/detect-touch.html
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Detect Touch Test
-
-
-
-
-
-
diff --git a/tests/library/browsercontext-viewport-mobile.spec.ts b/tests/library/browsercontext-viewport-mobile.spec.ts
index 1f897f60fa..e02a99b982 100644
--- a/tests/library/browsercontext-viewport-mobile.spec.ts
+++ b/tests/library/browsercontext-viewport-mobile.spec.ts
@@ -55,23 +55,19 @@ it.describe('mobile viewport', () => {
}
});
- it('should be detectable by Modernizr', async ({ playwright, browser, server, browserName, platform }) => {
- it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'detect-touch.html uses Modernizr which uses WebGL. WebGL is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
+ it('should be detectable', async ({ playwright, browser, server, browserName, platform }) => {
const iPhone = playwright.devices['iPhone 6'];
const context = await browser.newContext({ ...iPhone });
const page = await context.newPage();
- await page.goto(server.PREFIX + '/detect-touch.html');
- expect(await page.evaluate(() => document.body.textContent!.trim())).toBe('YES');
+ expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(true);
await context.close();
});
it('should detect touch when applying viewport with touches', async ({ browser, server, browserName, platform }) => {
- it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'Modernizr uses WebGL. WebGL is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
const context = await browser.newContext({ viewport: { width: 800, height: 600 }, hasTouch: true });
const page = await context.newPage();
await page.goto(server.EMPTY_PAGE);
- await page.addScriptTag({ url: server.PREFIX + '/modernizr.js' });
- expect(await page.evaluate(() => (window as any)['Modernizr'].touchevents)).toBe(true);
+ expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(true);
await context.close();
});
diff --git a/tests/library/browsercontext-viewport.spec.ts b/tests/library/browsercontext-viewport.spec.ts
index 4ba1e2f52d..abb14b3a71 100644
--- a/tests/library/browsercontext-viewport.spec.ts
+++ b/tests/library/browsercontext-viewport.spec.ts
@@ -94,11 +94,8 @@ it('should emulate availWidth and availHeight', async ({ page }) => {
});
it('should not have touch by default', async ({ page, server, browserName, platform }) => {
- it.skip(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 22, 'detect-touch.html uses Modernizr which uses WebGL. WebGL is not available in macOS-13 - https://bugs.webkit.org/show_bug.cgi?id=278277');
await page.goto(server.PREFIX + '/mobile.html');
expect(await page.evaluate(() => 'ontouchstart' in window)).toBe(false);
- await page.goto(server.PREFIX + '/detect-touch.html');
- expect(await page.evaluate(() => document.body.textContent.trim())).toBe('NO');
});
it('should throw on tap if hasTouch is not enabled', async ({ page }) => {