chore(webkit): update test-expecations for libsoup3.4
This commit is contained in:
parent
a6a44a07a7
commit
0b6e317a50
|
|
@ -267,7 +267,8 @@ export class WKBrowserContext extends BrowserContext {
|
||||||
const cc = network.rewriteCookies(cookies).map(c => ({
|
const cc = network.rewriteCookies(cookies).map(c => ({
|
||||||
...c,
|
...c,
|
||||||
session: c.expires === -1 || c.expires === undefined,
|
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,
|
||||||
|
sameSite: c.sameSite ? c.sameSite : 'Lax',
|
||||||
})) as Protocol.Playwright.SetCookieParam[];
|
})) as Protocol.Playwright.SetCookieParam[];
|
||||||
await this._browser._browserSession.send('Playwright.setCookies', { cookies: cc, browserContextId: this._browserContextId });
|
await this._browser._browserSession.send('Playwright.setCookies', { cookies: cc, browserContextId: this._browserContextId });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,9 +67,11 @@ const test = baseTest.extend<BrowserTestTestFixtures, BrowserTestWorkerFixtures>
|
||||||
await run(false);
|
await run(false);
|
||||||
}, { scope: 'worker' }],
|
}, { scope: 'worker' }],
|
||||||
|
|
||||||
defaultSameSiteCookieValue: [async ({ browserName, browserMajorVersion, channel }, run) => {
|
defaultSameSiteCookieValue: [async ({ browserName, browserMajorVersion, channel, platform }, run) => {
|
||||||
if (browserName === 'chromium')
|
if (browserName === 'chromium')
|
||||||
await run('Lax');
|
await run('Lax');
|
||||||
|
else if (browserName === 'webkit' && platform === 'linux')
|
||||||
|
await run('Lax');
|
||||||
else if (browserName === 'webkit')
|
else if (browserName === 'webkit')
|
||||||
await run('None');
|
await run('None');
|
||||||
else if (browserName === 'firefox' && channel === 'firefox-beta')
|
else if (browserName === 'firefox' && channel === 'firefox-beta')
|
||||||
|
|
|
||||||
|
|
@ -224,7 +224,7 @@ it('should have |expires| set to |-1| for session cookies', async ({ context, se
|
||||||
expect(cookies[0].expires).toBe(-1);
|
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, browserName, defaultSameSiteCookieValue }) => {
|
||||||
await context.addCookies([{
|
await context.addCookies([{
|
||||||
url: server.EMPTY_PAGE,
|
url: server.EMPTY_PAGE,
|
||||||
name: 'defaults',
|
name: 'defaults',
|
||||||
|
|
@ -239,7 +239,7 @@ it('should set cookie with reasonable defaults', async ({ context, server, brows
|
||||||
expires: -1,
|
expires: -1,
|
||||||
httpOnly: false,
|
httpOnly: false,
|
||||||
secure: false,
|
secure: false,
|
||||||
sameSite: browserName === 'chromium' ? 'Lax' : 'None',
|
sameSite: defaultSameSiteCookieValue,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -350,26 +350,26 @@ 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 ({ browser, httpsServer, channel, browserName, isLinux, isMac }) => {
|
||||||
|
const page = await browser.newPage({ ignoreHTTPSErrors: true });
|
||||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/17285' });
|
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(browserName === 'chromium', 'requestStorageAccess API is not available in Chromium');
|
||||||
it.skip(channel === 'firefox-beta', 'hasStorageAccess returns true, but no cookie is sent');
|
it.skip(channel === 'firefox-beta', 'hasStorageAccess returns true, but no cookie is sent');
|
||||||
|
httpsServer.setRoute('/set-cookie.html', (req, res) => {
|
||||||
server.setRoute('/set-cookie.html', (req, res) => {
|
res.setHeader('Set-Cookie', 'name=value; Path=/; SameSite=None; Secure');
|
||||||
res.setHeader('Set-Cookie', 'name=value; Path=/');
|
|
||||||
res.end();
|
res.end();
|
||||||
});
|
});
|
||||||
// Navigate once to the domain as top level.
|
// Navigate once to the domain as top level.
|
||||||
await page.goto(server.CROSS_PROCESS_PREFIX + '/set-cookie.html');
|
await page.goto(httpsServer.CROSS_PROCESS_PREFIX + '/set-cookie.html');
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(httpsServer.EMPTY_PAGE);
|
||||||
await page.setContent(`<iframe src="${server.CROSS_PROCESS_PREFIX + '/empty.html'}"></iframe>`);
|
await page.setContent(`<iframe src="${httpsServer.CROSS_PROCESS_PREFIX + '/empty.html'}"></iframe>`);
|
||||||
|
|
||||||
const frame = page.frames()[1];
|
const frame = page.frames()[1];
|
||||||
if (browserName === 'firefox') {
|
if (browserName === 'firefox') {
|
||||||
expect(await frame.evaluate(() => document.hasStorageAccess())).toBeTruthy();
|
expect(await frame.evaluate(() => document.hasStorageAccess())).toBeTruthy();
|
||||||
{
|
{
|
||||||
const [serverRequest] = await Promise.all([
|
const [serverRequest] = await Promise.all([
|
||||||
server.waitForRequest('/title.html'),
|
httpsServer.waitForRequest('/title.html'),
|
||||||
frame.evaluate(() => fetch('/title.html'))
|
frame.evaluate(() => fetch('/title.html'))
|
||||||
]);
|
]);
|
||||||
expect(serverRequest.headers.cookie).toBe('name=value');
|
expect(serverRequest.headers.cookie).toBe('name=value');
|
||||||
|
|
@ -381,7 +381,7 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse
|
||||||
expect(await frame.evaluate(() => document.hasStorageAccess())).toBeFalsy();
|
expect(await frame.evaluate(() => document.hasStorageAccess())).toBeFalsy();
|
||||||
{
|
{
|
||||||
const [serverRequest] = await Promise.all([
|
const [serverRequest] = await Promise.all([
|
||||||
server.waitForRequest('/title.html'),
|
httpsServer.waitForRequest('/title.html'),
|
||||||
frame.evaluate(() => fetch('/title.html'))
|
frame.evaluate(() => fetch('/title.html'))
|
||||||
]);
|
]);
|
||||||
if (!isMac && browserName === 'webkit')
|
if (!isMac && browserName === 'webkit')
|
||||||
|
|
@ -393,12 +393,13 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse
|
||||||
expect(await frame.evaluate(() => document.hasStorageAccess())).toBeTruthy();
|
expect(await frame.evaluate(() => document.hasStorageAccess())).toBeTruthy();
|
||||||
{
|
{
|
||||||
const [serverRequest] = await Promise.all([
|
const [serverRequest] = await Promise.all([
|
||||||
server.waitForRequest('/title.html'),
|
httpsServer.waitForRequest('/title.html'),
|
||||||
frame.evaluate(() => fetch('/title.html'))
|
frame.evaluate(() => fetch('/title.html'))
|
||||||
]);
|
]);
|
||||||
expect(serverRequest.headers.cookie).toBe('name=value');
|
expect(serverRequest.headers.cookie).toBe('name=value');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
await page.close();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should parse cookie with large Max-Age correctly', async ({ server, page, defaultSameSiteCookieValue, browserName, platform }) => {
|
it('should parse cookie with large Max-Age correctly', async ({ server, page, defaultSameSiteCookieValue, browserName, platform }) => {
|
||||||
|
|
|
||||||
|
|
@ -1155,7 +1155,7 @@ it('should support set-cookie with SameSite and without Secure attribute over HT
|
||||||
});
|
});
|
||||||
await page.request.get(server.EMPTY_PAGE);
|
await page.request.get(server.EMPTY_PAGE);
|
||||||
const [cookie] = await page.context().cookies();
|
const [cookie] = await page.context().cookies();
|
||||||
if (browserName === 'chromium' && value === 'None')
|
if (['chromium', 'webkit'].includes(browserName) && value === 'None')
|
||||||
expect(cookie).toBeFalsy();
|
expect(cookie).toBeFalsy();
|
||||||
else if (browserName === 'webkit' && isWindows)
|
else if (browserName === 'webkit' && isWindows)
|
||||||
expect(cookie.sameSite).toBe('None');
|
expect(cookie.sameSite).toBe('None');
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue