From 9fc195bff5cd4a5dcb4337d8c9a4400683c9c62b Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 18 Sep 2024 11:08:17 +0200 Subject: [PATCH] test: update cookie expectations for macOS 15 (#32674) --- tests/config/browserTest.ts | 10 +++++++--- tests/library/browsercontext-cookies.spec.ts | 3 ++- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.ts index 44aaca9d26..c301233e07 100644 --- a/tests/config/browserTest.ts +++ b/tests/config/browserTest.ts @@ -69,12 +69,16 @@ const test = baseTest.extend await run(false); }, { scope: 'worker' }], - defaultSameSiteCookieValue: [async ({ browserName, isLinux }, run) => { + defaultSameSiteCookieValue: [async ({ browserName, platform }, run) => { if (browserName === 'chromium' || browserName as any === '_bidiChromium') await run('Lax'); - else if (browserName === 'webkit' && isLinux) + else if (browserName === 'webkit' && platform === 'linux') await run('Lax'); - else if (browserName === 'webkit' && !isLinux) + else if (browserName === 'webkit' && platform === 'darwin' && parseInt(os.release(), 10) >= 24) + // macOS 15 Sequoia onwards + await run('Lax'); + else if (browserName === 'webkit') + // Windows + older macOS await run('None'); else if (browserName === 'firefox' || browserName as any === '_bidiFirefox') await run('None'); diff --git a/tests/library/browsercontext-cookies.spec.ts b/tests/library/browsercontext-cookies.spec.ts index df923ef3ff..f0aabb7139 100644 --- a/tests/library/browsercontext-cookies.spec.ts +++ b/tests/library/browsercontext-cookies.spec.ts @@ -15,6 +15,7 @@ * 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 }) => { @@ -396,7 +397,7 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse server.waitForRequest('/title.html'), frame.evaluate(() => fetch('/title.html')) ]); - if (isLinux && browserName === 'webkit') + if ((isLinux || (isMac && parseInt(os.release(), 10) >= 24)) && browserName === 'webkit') expect(serverRequest.headers.cookie).toBe(undefined); else expect(serverRequest.headers.cookie).toBe('name=value');