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
feat(webkit): roll to r2014 (#31074)
Yury Semikhatskyf93da4092521
diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.jsonindex 26417b7054..25384e9345 100644--- a/packages/playwright-core/browsers.json+++ b/packages/playwright-core/browsers.json@@ -27,7 +27,7 @@},{"name": "webkit",- "revision": "2013",+ "revision": "2014","installByDefault": true,"revisionOverrides": {"mac10.14": "1446",diff --git a/packages/playwright-core/src/server/webkit/wkBrowser.ts b/packages/playwright-core/src/server/webkit/wkBrowser.tsindex 4b10dfd3fe..b65ca55c21 100644--- a/packages/playwright-core/src/server/webkit/wkBrowser.ts+++ b/packages/playwright-core/src/server/webkit/wkBrowser.ts@@ -267,7 +267,9 @@ export class WKBrowserContext extends BrowserContext {const cc = network.rewriteCookies(cookies).map(c => ({...c,session: c.expires === -1 || c.expires === undefined,- expires: c.expires && c.expires !== -1 ? c.expires * 1000 : c.expires+ expires: c.expires && c.expires !== -1 ? c.expires * 1000 : c.expires,+ // TODO: make WebKit on linux work without eplicit sameSite.+ sameSite: c.sameSite ?? (process.platform === 'linux' ? 'Lax' : undefined)})) as Protocol.Playwright.SetCookieParam[];await this._browser._browserSession.send('Playwright.setCookies', { cookies: cc, browserContextId: this._browserContextId });}diff --git a/tests/config/browserTest.ts b/tests/config/browserTest.tsindex 02555d42eb..8b4fdc27b9 100644--- a/tests/config/browserTest.ts+++ b/tests/config/browserTest.ts@@ -67,10 +67,12 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>await run(false);}, { scope: 'worker' }],- defaultSameSiteCookieValue: [async ({ browserName, browserMajorVersion, channel }, run) => {+ defaultSameSiteCookieValue: [async ({ browserName, browserMajorVersion, channel, isLinux }, run) => {if (browserName === 'chromium')await run('Lax');- else if (browserName === 'webkit')+ else if (browserName === 'webkit' && isLinux)+ await run('Lax');+ else if (browserName === 'webkit' && !isLinux)await run('None');else if (browserName === 'firefox' && channel === 'firefox-beta')await run(browserMajorVersion >= 103 && browserMajorVersion < 110 ? 'Lax' : 'None');diff --git a/tests/library/browsercontext-add-cookies.spec.ts b/tests/library/browsercontext-add-cookies.spec.tsindex bdfe14ef0a..f35ea8b327 100644--- a/tests/library/browsercontext-add-cookies.spec.ts+++ b/tests/library/browsercontext-add-cookies.spec.ts@@ -24,7 +24,7 @@ it('should work @smoke', async ({ context, page, server }) => {await context.addCookies([{url: server.EMPTY_PAGE,name: 'password',- value: '123456'+ value: '123456',}]);expect(await page.evaluate(() => document.cookie)).toEqual('password=123456');});@@ -224,7 +224,7 @@ it('should have |expires| set to |-1| for session cookies', async ({ context, seexpect(cookies[0].expires).toBe(-1);});-it('should set cookie with reasonable defaults', async ({ context, server, browserName }) => {+it('should set cookie with reasonable defaults', async ({ context, server, defaultSameSiteCookieValue }) => {await context.addCookies([{url: server.EMPTY_PAGE,name: 'defaults',@@ -239,7 +239,7 @@ it('should set cookie with reasonable defaults', async ({ context, server, browsexpires: -1,httpOnly: false,secure: false,- sameSite: browserName === 'chromium' ? 'Lax' : 'None',+ sameSite: defaultSameSiteCookieValue,}]);});diff --git a/tests/library/browsercontext-cookies.spec.ts b/tests/library/browsercontext-cookies.spec.tsindex a53f989886..df923ef3ff 100644--- a/tests/library/browsercontext-cookies.spec.ts+++ b/tests/library/browsercontext-cookies.spec.ts@@ -384,7 +384,7 @@ it('should support requestStorageAccess', async ({ page, server, channel, browseserver.waitForRequest('/title.html'),frame.evaluate(() => fetch('/title.html'))]);- if (!isMac && browserName === 'webkit')+ if (isWindows && browserName === 'webkit')expect(serverRequest.headers.cookie).toBe('name=value');elseexpect(serverRequest.headers.cookie).toBeFalsy();@@ -396,7 +396,10 @@ it('should support requestStorageAccess', async ({ page, server, channel, browseserver.waitForRequest('/title.html'),frame.evaluate(() => fetch('/title.html'))]);- expect(serverRequest.headers.cookie).toBe('name=value');+ if (isLinux && browserName === 'webkit')+ expect(serverRequest.headers.cookie).toBe(undefined);+ else+ expect(serverRequest.headers.cookie).toBe('name=value');}}});diff --git a/tests/library/browsercontext-fetch.spec.ts b/tests/library/browsercontext-fetch.spec.tsindex f4088359cf..99fd0265a3 100644--- a/tests/library/browsercontext-fetch.spec.ts+++ b/tests/library/browsercontext-fetch.spec.ts@@ -1202,7 +1202,7 @@ it('fetch should not throw on long set-cookie value', async ({ context, server }expect(cookies.map(c => c.name)).toContain('bar');});-it('should support set-cookie with SameSite and without Secure attribute over HTTP', async ({ page, server, browserName, isWindows }) => {+it('should support set-cookie with SameSite and without Secure attribute over HTTP', async ({ page, server, browserName, isWindows, isLinux }) => {for (const value of ['None', 'Lax', 'Strict']) {await it.step(`SameSite=${value}`, async () => {server.setRoute('/empty.html', (req, res) => {@@ -1213,6 +1213,8 @@ it('should support set-cookie with SameSite and without Secure attribute over HTconst [cookie] = await page.context().cookies();if (browserName === 'chromium' && value === 'None')expect(cookie).toBeFalsy();+ else if (browserName === 'webkit' && isLinux && value === 'None')+ expect(cookie).toBeFalsy();else if (browserName === 'webkit' && isWindows)expect(cookie.sameSite).toBe('None');elsediff --git a/tests/library/browsercontext-route.spec.ts b/tests/library/browsercontext-route.spec.tsindex a597cf1157..25d965c1b6 100644--- a/tests/library/browsercontext-route.spec.ts+++ b/tests/library/browsercontext-route.spec.ts@@ -109,7 +109,7 @@ it('should fall back to context.route', async ({ browser, server }) => {await context.close();});-it('should support Set-Cookie header', async ({ contextFactory, server, browserName, defaultSameSiteCookieValue }) => {+it('should support Set-Cookie header', async ({ contextFactory, defaultSameSiteCookieValue }) => {const context = await contextFactory();const page = await context.newPage();await page.route('https://example.com/', (route, request) => {@@ -152,7 +152,7 @@ it('should ignore secure Set-Cookie header for insecure requests', async ({ contexpect(await context.cookies()).toEqual([]);});-it('should use Set-Cookie header in future requests', async ({ contextFactory, server, browserName, defaultSameSiteCookieValue }) => {+it('should use Set-Cookie header in future requests', async ({ contextFactory, server, defaultSameSiteCookieValue }) => {const context = await contextFactory();const page = await context.newPage();