Skip to content

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

test: fix cookie tests on WebKit (#2359)

Dmitry Gozmand532cd5d9ff7
diff --git a/test/defaultbrowsercontext.spec.js b/test/defaultbrowsercontext.spec.js
index 5b187dc540..ccd65b5e98 100644
--- a/test/defaultbrowsercontext.spec.js
+++ b/test/defaultbrowsercontext.spec.js
@@ -111,9 +111,9 @@ describe('launchPersistentContext()', function() {
document.cookie = 'username=John Doe';
return document.cookie;
});
- expect(documentCookie).toBe('username=John Doe');
await page.waitForTimeout(2000);
const allowsThirdParty = CHROMIUM || FFOX;
+ expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : '');
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
if (allowsThirdParty) {
expect(cookies).toEqual([
diff --git a/test/headful.spec.js b/test/headful.spec.js
index 061aaf7df9..b3b07d4b3b 100644
--- a/test/headful.spec.js
+++ b/test/headful.spec.js
@@ -96,9 +96,9 @@ describe('Headful', function() {
document.cookie = 'username=John Doe';
return document.cookie;
});
- expect(documentCookie).toBe('username=John Doe');
await page.waitForTimeout(2000);
const allowsThirdParty = CHROMIUM || FFOX;
+ expect(documentCookie).toBe(allowsThirdParty ? 'username=John Doe' : '');
const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
if (allowsThirdParty) {
expect(cookies).toEqual([