mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 21:53:35 +03:00
test: update SameSite cookie fetch test (#17797)
This commit is contained in:
parent
99266e48ec
commit
cb6b824119
@ -1027,7 +1027,7 @@ it('should work with connectOverCDP', async ({ browserName, browserType, server
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support SameSite cookie attribute over https', async ({ contextFactory, httpsServer }) => {
|
it('should support SameSite cookie attribute over https', async ({ contextFactory, httpsServer, browserName, isWindows }) => {
|
||||||
// Cookies with SameSite=None must also specify the Secure attribute. WebKit navigation
|
// Cookies with SameSite=None must also specify the Secure attribute. WebKit navigation
|
||||||
// to HTTP url will fail if the response contains a cookie with Secure attribute, so
|
// to HTTP url will fail if the response contains a cookie with Secure attribute, so
|
||||||
// we do HTTPS navigation.
|
// we do HTTPS navigation.
|
||||||
@ -1041,12 +1041,15 @@ it('should support SameSite cookie attribute over https', async ({ contextFactor
|
|||||||
});
|
});
|
||||||
await page.request.get(httpsServer.EMPTY_PAGE);
|
await page.request.get(httpsServer.EMPTY_PAGE);
|
||||||
const [cookie] = await page.context().cookies();
|
const [cookie] = await page.context().cookies();
|
||||||
expect(cookie.sameSite).toBe(value);
|
if (browserName === 'webkit' && isWindows)
|
||||||
|
expect(cookie.sameSite).toBe('None');
|
||||||
|
else
|
||||||
|
expect(cookie.sameSite).toBe(value);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should support set-cookie with SameSite and without Secure attribute over HTTP', async ({ page, server, browserName }) => {
|
it('should support set-cookie with SameSite and without Secure attribute over HTTP', async ({ page, server, browserName, isWindows }) => {
|
||||||
for (const value of ['None', 'Lax', 'Strict']) {
|
for (const value of ['None', 'Lax', 'Strict']) {
|
||||||
await it.step(`SameSite=${value}`, async () => {
|
await it.step(`SameSite=${value}`, async () => {
|
||||||
server.setRoute('/empty.html', (req, res) => {
|
server.setRoute('/empty.html', (req, res) => {
|
||||||
@ -1057,6 +1060,8 @@ it('should support set-cookie with SameSite and without Secure attribute over HT
|
|||||||
const [cookie] = await page.context().cookies();
|
const [cookie] = await page.context().cookies();
|
||||||
if (browserName === 'chromium' && value === 'None')
|
if (browserName === 'chromium' && value === 'None')
|
||||||
expect(cookie).toBeFalsy();
|
expect(cookie).toBeFalsy();
|
||||||
|
else if (browserName === 'webkit' && isWindows)
|
||||||
|
expect(cookie.sameSite).toBe('None');
|
||||||
else
|
else
|
||||||
expect(cookie.sameSite).toBe(value);
|
expect(cookie.sameSite).toBe(value);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user