mirror of
https://github.com/microsoft/playwright.git
synced 2025-01-05 19:04:43 +03:00
feat(webkit): roll to r2014 (#31074)
Closes https://github.com/microsoft/playwright/pull/31059 Closes https://github.com/microsoft/playwright/pull/31012 Reference https://github.com/microsoft/playwright-browsers/issues/795
This commit is contained in:
parent
6e9c31f93b
commit
f93da40925
@ -27,7 +27,7 @@
|
||||
},
|
||||
{
|
||||
"name": "webkit",
|
||||
"revision": "2013",
|
||||
"revision": "2014",
|
||||
"installByDefault": true,
|
||||
"revisionOverrides": {
|
||||
"mac10.14": "1446",
|
||||
|
@ -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 });
|
||||
}
|
||||
|
@ -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');
|
||||
|
@ -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, se
|
||||
expect(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, brows
|
||||
expires: -1,
|
||||
httpOnly: false,
|
||||
secure: false,
|
||||
sameSite: browserName === 'chromium' ? 'Lax' : 'None',
|
||||
sameSite: defaultSameSiteCookieValue,
|
||||
}]);
|
||||
});
|
||||
|
||||
|
@ -384,7 +384,7 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse
|
||||
server.waitForRequest('/title.html'),
|
||||
frame.evaluate(() => fetch('/title.html'))
|
||||
]);
|
||||
if (!isMac && browserName === 'webkit')
|
||||
if (isWindows && browserName === 'webkit')
|
||||
expect(serverRequest.headers.cookie).toBe('name=value');
|
||||
else
|
||||
expect(serverRequest.headers.cookie).toBeFalsy();
|
||||
@ -396,7 +396,10 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse
|
||||
server.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');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -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 HT
|
||||
const [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');
|
||||
else
|
||||
|
@ -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 ({ cont
|
||||
expect(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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user