diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index 9880083107f2d..6a178bbaf2641 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -70,25 +70,23 @@ const test = baseTest.extend await run(false); }, { scope: 'worker' }], - defaultSameSiteCookieValue: [async ({ browserName, platform }, run) => { + defaultSameSiteCookieValue: [async ({ browserName, platform, macVersion }, run) => { if (browserName === 'chromium' || browserName as any === '_bidiChromium') await run('Lax'); else if (browserName === 'webkit' && platform === 'linux') await run('Lax'); - else if (browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) >= 24) - // macOS 15 Sequoia onwards + else if (browserName === 'webkit' && platform === 'darwin' && macVersion >= 15) await run('Lax'); else if (browserName === 'webkit') - // Windows + older macOS - await run('None'); + await run('None'); // Windows + older macOS else if (browserName === 'firefox' || browserName as any === '_bidiFirefox') await run('None'); else throw new Error('unknown browser - ' + browserName); }, { scope: 'worker' }], - sameSiteStoredValueForNone: [async ({ browserName, isMac }, run) => { - if (browserName === 'webkit' && isMac && parseInt(os.release(), 10) >= 24) + sameSiteStoredValueForNone: [async ({ browserName, isMac, macVersion }, run) => { + if (browserName === 'webkit' && isMac && macVersion >= 15) await run('Lax'); else await run('None'); diff --git a/tests/config/platformFixtures.ts b/tests/config/platformFixtures.ts index 34d340f7183cb..3bc8ec52cd48a 100644 --- a/tests/config/platformFixtures.ts +++ b/tests/config/platformFixtures.ts @@ -15,12 +15,14 @@ */ import { test } from '@playwright/test'; +import os from 'os'; export type PlatformWorkerFixtures = { platform: 'win32' | 'darwin' | 'linux'; isWindows: boolean; isMac: boolean; isLinux: boolean; + macVersion: number; // major only, 11 or later, zero if not mac }; function platform(): 'win32' | 'darwin' | 'linux' { @@ -33,9 +35,16 @@ function platform(): 'win32' | 'darwin' | 'linux' { return process.platform as 'win32' | 'darwin' | 'linux'; } +function macVersion() { + if (process.platform !== 'darwin') + return 0; + return +os.release().split('.')[0] - 9; +} + export const platformTest = test.extend<{}, PlatformWorkerFixtures>({ platform: [platform(), { scope: 'worker' }], isWindows: [platform() === 'win32', { scope: 'worker' }], isMac: [platform() === 'darwin', { scope: 'worker' }], isLinux: [platform() === 'linux', { scope: 'worker' }], + macVersion: [macVersion(), { scope: 'worker' }], }); diff --git a/tests/library/browsercontext-cookies.spec.ts b/tests/library/browsercontext-cookies.spec.ts index 798a840f9d681..9bb600c786237 100644 --- a/tests/library/browsercontext-cookies.spec.ts +++ b/tests/library/browsercontext-cookies.spec.ts @@ -15,7 +15,6 @@ * limitations under the License. */ -import os from 'os'; import { contextTest as it, expect } from '../config/browserTest'; it('should return no cookies in pristine browser context', async ({ context, page, server }) => { @@ -351,7 +350,7 @@ it('should be able to send third party cookies via an iframe', async ({ browser, } }); -it('should support requestStorageAccess', async ({ page, server, channel, browserName, isMac, isLinux, isWindows }) => { +it('should support requestStorageAccess', async ({ page, server, channel, browserName, isMac, isLinux, isWindows, macVersion }) => { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/17285' }); it.skip(browserName === 'chromium', 'requestStorageAccess API is not available in Chromium'); it.skip(channel === 'firefox-beta', 'hasStorageAccess returns true, but no cookie is sent'); @@ -397,7 +396,7 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse server.waitForRequest('/title.html'), frame.evaluate(() => fetch('/title.html')) ]); - if ((isLinux || (isMac && parseInt(os.release(), 10) >= 24)) && browserName === 'webkit') + if ((isLinux || (isMac && macVersion >= 15)) && browserName === 'webkit') expect(serverRequest.headers.cookie).toBe(undefined); else expect(serverRequest.headers.cookie).toBe('name=value'); diff --git a/tests/library/browsercontext-viewport.spec.ts b/tests/library/browsercontext-viewport.spec.ts index abb14b3a713f4..4fdd181f8fb26 100644 --- a/tests/library/browsercontext-viewport.spec.ts +++ b/tests/library/browsercontext-viewport.spec.ts @@ -19,7 +19,6 @@ import { devices } from '@playwright/test'; import { contextTest as it, expect } from '../config/browserTest'; import { browserTest } from '../config/browserTest'; import { verifyViewport } from '../config/utils'; -import * as os from 'os'; it('should get the proper default viewport size', async ({ page, server }) => { await verifyViewport(page, 1280, 720); @@ -176,10 +175,10 @@ browserTest('should be able to get correct orientation angle on non-mobile devic await context.close(); }); -it('should set window.screen.orientation.type for mobile devices', async ({ contextFactory, browserName, server, isMac }) => { +it('should set window.screen.orientation.type for mobile devices', async ({ contextFactory, browserName, server, isMac, macVersion }) => { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/31151' }); it.skip(browserName === 'firefox', 'Firefox does not support mobile emulation'); - it.skip(browserName === 'webkit' && isMac && parseInt(os.release().split('.')[0], 10) <= 21, 'WebKit on macOS 12 is frozen and does not support orientation.type override'); + it.skip(browserName === 'webkit' && isMac && macVersion <= 12, 'WebKit on macOS 12 is frozen and does not support orientation.type override'); const context = await contextFactory(devices['iPhone 14']); const page = await context.newPage(); await page.goto(server.PREFIX + '/index.html'); diff --git a/tests/library/browsertype-connect.spec.ts b/tests/library/browsertype-connect.spec.ts index 4a3cdb1efa90e..d494f63b192fa 100644 --- a/tests/library/browsertype-connect.spec.ts +++ b/tests/library/browsertype-connect.spec.ts @@ -16,7 +16,6 @@ */ import fs from 'fs'; -import os from 'os'; import type http from 'http'; import type net from 'net'; import * as path from 'path'; @@ -678,9 +677,9 @@ for (const kind of ['launchServer', 'run-server'] as const) { expect(await response.json()).toEqual({ 'foo': 'bar' }); }); - test('should upload large file', async ({ connect, startRemoteServer, server, browserName, isMac, mode }, testInfo) => { + test('should upload large file', async ({ connect, startRemoteServer, server, browserName, isMac, macVersion, mode }, testInfo) => { test.skip(mode.startsWith('service'), 'Take it easy on service'); - test.skip(browserName === 'webkit' && isMac && parseInt(os.release(), 10) < 20, 'WebKit for macOS 10.15 is frozen and does not have corresponding protocol features.'); + test.skip(browserName === 'webkit' && isMac && macVersion < 11, 'WebKit for macOS 10.15 is frozen and does not have corresponding protocol features.'); test.slow(); const remoteServer = await startRemoteServer(kind); const browser = await connect(remoteServer.wsEndpoint()); diff --git a/tests/library/capabilities.spec.ts b/tests/library/capabilities.spec.ts index 20dcecfa5eedb..816f647ef4bb7 100644 --- a/tests/library/capabilities.spec.ts +++ b/tests/library/capabilities.spec.ts @@ -19,8 +19,8 @@ import url from 'url'; import { contextTest as it, expect } from '../config/browserTest'; import { hostPlatform } from '../../packages/playwright-core/src/utils/hostPlatform'; -it('SharedArrayBuffer should work @smoke', async function({ contextFactory, httpsServer, isMac, browserName }) { - it.skip(browserName === 'webkit' && isMac && parseInt(os.release().split('.')[0], 10) <= 21, 'WebKit on macOS 12 is frozen and does not support SharedArrayBuffer'); +it('SharedArrayBuffer should work @smoke', async function({ contextFactory, httpsServer, isMac, macVersion, browserName }) { + it.skip(browserName === 'webkit' && isMac && macVersion <= 12, 'WebKit on macOS 12 is frozen and does not support SharedArrayBuffer'); const context = await contextFactory({ ignoreHTTPSErrors: true }); const page = await context.newPage(); httpsServer.setRoute('/sharedarraybuffer', (req, res) => { @@ -65,13 +65,13 @@ it('should respect CSP @smoke', async ({ page, server }) => { expect(await page.evaluate(() => window['testStatus'])).toBe('SUCCESS'); }); -it('should play video @smoke', async ({ page, asset, browserName, platform, mode }) => { +it('should play video @smoke', async ({ page, asset, browserName, platform, macVersion, mode }) => { // TODO: the test passes on Windows locally but fails on GitHub Action bot, // apparently due to a Media Pack issue in the Windows Server. // Also the test is very flaky on Linux WebKit. it.fixme(browserName === 'webkit' && platform !== 'darwin'); it.fixme(browserName === 'firefox', 'https://github.com/microsoft/playwright/issues/5721'); - it.fixme(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 20, 'Does not work on BigSur'); + it.fixme(browserName === 'webkit' && platform === 'darwin' && macVersion === 11, 'Does not work on BigSur'); it.skip(mode.startsWith('service')); // Safari only plays mp4 so we test WebKit with an .mp4 clip. @@ -84,8 +84,8 @@ it('should play video @smoke', async ({ page, asset, browserName, platform, mode await page.$eval('video', v => v.pause()); }); -it('should play webm video @smoke', async ({ page, asset, browserName, platform, mode }) => { - it.fixme(browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) === 20, 'Does not work on BigSur'); +it('should play webm video @smoke', async ({ page, asset, browserName, platform, macVersion, mode }) => { + it.fixme(browserName === 'webkit' && platform === 'darwin' && macVersion === 11, 'Does not work on BigSur'); it.fixme(browserName === 'webkit' && platform === 'win32'); it.skip(mode.startsWith('service')); @@ -143,6 +143,8 @@ it('should not crash on showDirectoryPicker', async ({ page, server, browserName it.skip(browserName === 'chromium' && browserMajorVersion < 99, 'Fixed in Chromium r956769'); it.skip(browserName !== 'chromium', 'showDirectoryPicker is only available in Chromium'); await page.goto(server.EMPTY_PAGE); + // "User activation is required to show a file picker." - so we click first. + await page.locator('body').click(); page.evaluate(async () => { const dir = await (window as any).showDirectoryPicker(); return dir.name; @@ -240,9 +242,9 @@ it('make sure that XMLHttpRequest upload events are emitted correctly', async ({ expect(events).toEqual(['loadstart', 'progress', 'load', 'loadend']); }); -it('loading in HTMLImageElement.prototype', async ({ page, server, browserName, isMac }) => { +it('loading in HTMLImageElement.prototype', async ({ page, server, browserName, isMac, macVersion }) => { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/22738' }); - it.skip(browserName === 'webkit' && isMac && parseInt(os.release(), 10) < 21, 'macOS 11 is frozen'); + it.skip(browserName === 'webkit' && isMac && macVersion < 12, 'macOS 11 is frozen'); await page.goto(server.EMPTY_PAGE); const defined = await page.evaluate(() => 'loading' in HTMLImageElement.prototype); expect(defined).toBeTruthy(); diff --git a/tests/library/chromium/connect-over-cdp.spec.ts b/tests/library/chromium/connect-over-cdp.spec.ts index a473539e8e178..f31f60baf0544 100644 --- a/tests/library/chromium/connect-over-cdp.spec.ts +++ b/tests/library/chromium/connect-over-cdp.spec.ts @@ -409,13 +409,13 @@ test('should connect to an existing cdp session when passed as a first argument' } }); -test('should use proxy with connectOverCDP', async ({ browserType, server, mode }, testInfo) => { +test('should use proxy with connectOverCDP', async ({ browserType, server }, testInfo) => { server.setRoute('/target.html', async (req, res) => { res.end('Served by the proxy'); }); const port = 9339 + testInfo.workerIndex; const browserServer = await browserType.launch({ - args: ['--remote-debugging-port=' + port, ...(process.platform === 'win32' ? ['--proxy-server=some-value'] : [])] + args: ['--remote-debugging-port=' + port] }); try { const cdpBrowser = await browserType.connectOverCDP(`http://127.0.0.1:${port}/`); diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts index 5f0321526a6f8..cadf49deb9144 100644 --- a/tests/library/client-certificates.spec.ts +++ b/tests/library/client-certificates.spec.ts @@ -291,8 +291,8 @@ test.describe('browser', () => { await page.close(); }); - test('should fail with no client certificates', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should fail with no client certificates', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -306,8 +306,8 @@ test.describe('browser', () => { await page.close(); }); - test('should fail with self-signed client certificates', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should fail with self-signed client certificates', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -321,8 +321,8 @@ test.describe('browser', () => { await page.close(); }); - test('should pass with matching certificates', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -336,8 +336,8 @@ test.describe('browser', () => { await page.close(); }); - test('should pass with matching certificates when passing as content', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates when passing as content', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -351,8 +351,8 @@ test.describe('browser', () => { await page.close(); }); - test('should pass with matching certificates and when a http proxy is used', async ({ browser, startCCServer, asset, browserName, proxyServer }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates and when a http proxy is used', async ({ browser, startCCServer, asset, browserName, proxyServer, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); proxyServer.forwardTo(parseInt(new URL(serverURL).port, 10), { allowConnectRequests: true }); const page = await browser.newPage({ ignoreHTTPSErrors: true, @@ -365,14 +365,14 @@ test.describe('browser', () => { }); expect(proxyServer.connectHosts).toEqual([]); await page.goto(serverURL); - const host = browserName === 'webkit' && process.platform === 'darwin' ? 'localhost' : '127.0.0.1'; + const host = browserName === 'webkit' && isMac ? 'localhost' : '127.0.0.1'; expect([...new Set(proxyServer.connectHosts)]).toEqual([`${host}:${new URL(serverURL).port}`]); await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!'); await page.close(); }); - test('should pass with matching certificates and when a socks proxy is used', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates and when a socks proxy is used', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const serverPort = parseInt(new URL(serverURL).port, 10); const { proxyServerAddr, closeProxyServer, connectHosts } = await setupSocksForwardingServer({ port: test.info().workerIndex + 2048 + 2, @@ -390,7 +390,7 @@ test.describe('browser', () => { }); expect(connectHosts).toEqual([]); await page.goto(serverURL); - const host = browserName === 'webkit' && process.platform === 'darwin' ? 'localhost' : '127.0.0.1'; + const host = browserName === 'webkit' && isMac ? 'localhost' : '127.0.0.1'; expect(connectHosts).toEqual([`${host}:${serverPort}`]); await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!'); await page.close(); @@ -439,8 +439,8 @@ test.describe('browser', () => { } }); - test('should pass with matching certificates in pfx format', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates in pfx format', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -514,7 +514,7 @@ test.describe('browser', () => { const stylesheet = ` button { background-color: red; - } + } `; const stylesheetBuffer = await new Promise((resolve, reject) => { @@ -586,8 +586,8 @@ test.describe('browser', () => { await new Promise(resolve => server.close(() => resolve())); }); - test('should pass with matching certificates in pfx format when passing as content', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates in pfx format when passing as content', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -601,8 +601,8 @@ test.describe('browser', () => { await page.close(); }); - test('should fail with matching certificates in legacy pfx format', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should fail with matching certificates in legacy pfx format', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); await expect(browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -613,8 +613,8 @@ test.describe('browser', () => { })).rejects.toThrow('Unsupported TLS certificate'); }); - test('should throw a http error if the pfx passphrase is incorect', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should throw a http error if the pfx passphrase is incorect', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); await expect(browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -649,8 +649,8 @@ test.describe('browser', () => { await page.close(); }); - test('should pass with matching certificates and trailing slash', async ({ browser, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates and trailing slash', async ({ browser, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const page = await browser.newPage({ ignoreHTTPSErrors: true, clientCertificates: [{ @@ -677,8 +677,8 @@ test.describe('browser', () => { await page.close(); }); - test('support http2', async ({ browser, startCCServer, asset, browserName }) => { - test.skip(browserName === 'webkit' && process.platform === 'darwin', 'WebKit on macOS doesn\n proxy localhost'); + test('support http2', async ({ browser, startCCServer, asset, browserName, isMac }) => { + test.skip(browserName === 'webkit' && isMac, 'WebKit on macOS doesn\n proxy localhost'); const serverURL = await startCCServer({ http2: true }); const page = await browser.newPage({ ignoreHTTPSErrors: true, @@ -727,9 +727,9 @@ test.describe('browser', () => { await browser.close(); }); - test('should return target connection errors when using http2', async ({ browser, startCCServer, asset, browserName }) => { - test.skip(browserName === 'webkit' && process.platform === 'darwin', 'WebKit on macOS doesn\n proxy localhost'); - test.fixme(browserName === 'webkit' && process.platform === 'linux', 'WebKit on Linux does not support http2 https://bugs.webkit.org/show_bug.cgi?id=276990'); + test('should return target connection errors when using http2', async ({ browser, startCCServer, asset, browserName, isMac, isLinux }) => { + test.skip(browserName === 'webkit' && isMac, 'WebKit on macOS doesn\n proxy localhost'); + test.fixme(browserName === 'webkit' && isLinux, 'WebKit on Linux does not support http2 https://bugs.webkit.org/show_bug.cgi?id=276990'); test.skip(+process.versions.node.split('.')[0] < 20, 'http2.performServerHandshake is not supported in older Node.js versions'); const serverURL = await startCCServer({ http2: true }); @@ -785,8 +785,8 @@ test.describe('browser', () => { await expect(launchPersistent(contextOptions)).rejects.toThrow(expected); }); - test('should pass with matching certificates', async ({ launchPersistent, startCCServer, asset, browserName }) => { - const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && process.platform === 'darwin' }); + test('should pass with matching certificates', async ({ launchPersistent, startCCServer, asset, browserName, isMac }) => { + const serverURL = await startCCServer({ useFakeLocalhost: browserName === 'webkit' && isMac }); const { page } = await launchPersistent({ ignoreHTTPSErrors: true, clientCertificates: [{ diff --git a/tests/library/fetch-proxy.spec.ts b/tests/library/fetch-proxy.spec.ts index f6961e6de5cb9..3b43b5c3a3b30 100644 --- a/tests/library/fetch-proxy.spec.ts +++ b/tests/library/fetch-proxy.spec.ts @@ -22,8 +22,12 @@ it('context request should pick up proxy credentials', async ({ browserType, ser proxyServer.forwardTo(server.PORT, { allowConnectRequests: true }); let auth; proxyServer.setAuthHandler(req => { - auth = req.headers['proxy-authorization']; - return !!auth; + const header = req.headers['proxy-authorization']; + // Browser can issue various unrelated requests over the proxy, + // but we are only interested in our own request. + if (proxyServer.connectHosts.includes('non-existent.com:80')) + auth = header; + return !!header; }); const browser = await browserType.launch({ proxy: { server: `localhost:${proxyServer.PORT}`, username: 'user', password: 'secret' } diff --git a/tests/library/signals.spec.ts b/tests/library/signals.spec.ts index 70f7eb51f1124..50bbd05f8c87a 100644 --- a/tests/library/signals.spec.ts +++ b/tests/library/signals.spec.ts @@ -59,11 +59,11 @@ test('should remove temp dir on process.exit', async ({ startRemoteServer, serve test.describe('signals', () => { test.skip(({ platform }) => platform === 'win32'); - test('should report browser close signal 2', async ({ startRemoteServer, server, isMac, browserName }) => { + test('should report browser close signal 2', async ({ startRemoteServer, server, isMac, macVersion, browserName }) => { const remoteServer = await startRemoteServer('launchServer', { url: server.EMPTY_PAGE }); const pid = await remoteServer.out('pid'); process.kill(-pid, 'SIGKILL'); - if (isMac && browserName === 'webkit' && parseInt(os.release(), 10) > 22 && os.arch() === 'arm64') { + if (isMac && browserName === 'webkit' && macVersion > 13 && os.arch() === 'arm64') { // WebKit on newer macOS exits sometimes with exit code, sometimes with signal. expect('exitCode:' + await remoteServer.out('exitCode') + 'signal:' + await remoteServer.out('signal')).toMatch(/exitCode:137|signal:SIGKILL/); diff --git a/tests/page/locator-misc-2.spec.ts b/tests/page/locator-misc-2.spec.ts index 820e9aba49492..eb5765dbf1e70 100644 --- a/tests/page/locator-misc-2.spec.ts +++ b/tests/page/locator-misc-2.spec.ts @@ -16,7 +16,6 @@ */ import { test as it, expect } from './pageTest'; -import os from 'os'; it('should press @smoke', async ({ page }) => { await page.setContent(``); @@ -43,9 +42,9 @@ it('should scroll into view', async ({ page, server, isAndroid }) => { } }); -it('should scroll zero-sized element into view', async ({ page, isAndroid, isElectron, isWebView2, browserName, isMac }) => { +it('should scroll zero-sized element into view', async ({ page, isAndroid, isElectron, isWebView2, browserName, isMac, macVersion }) => { it.fixme(isAndroid || isElectron || isWebView2); - it.skip(browserName === 'webkit' && isMac && parseInt(os.release(), 10) < 20, 'WebKit for macOS 10.15 is frozen.'); + it.skip(browserName === 'webkit' && isMac && macVersion < 11, 'WebKit for macOS 10.15 is frozen.'); await page.setContent(`