Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: update SameSite cookie fetch test (#17797)

Yury Semikhatskycb6b824119cd
diff --git a/tests/library/browsercontext-fetch.spec.ts b/tests/library/browsercontext-fetch.spec.ts
index ab854a57fc..d5c89ae5b6 100644
--- a/tests/library/browsercontext-fetch.spec.ts
+++ b/tests/library/browsercontext-fetch.spec.ts
@@ -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
// to HTTP url will fail if the response contains a cookie with Secure attribute, so
// 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);
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']) {
await it.step(`SameSite=${value}`, async () => {
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();
if (browserName === 'chromium' && value === 'None')
expect(cookie).toBeFalsy();
+ else if (browserName === 'webkit' && isWindows)
+ expect(cookie.sameSite).toBe('None');
else
expect(cookie.sameSite).toBe(value);
});