Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: unflake more cookie tests (#2346)
Dmitry Gozman79ec3c916ed7
diff --git a/test/defaultbrowsercontext.spec.js b/test/defaultbrowsercontext.spec.jsindex 206cb51a77..5b187dc540 100644--- a/test/defaultbrowsercontext.spec.js+++ b/test/defaultbrowsercontext.spec.js@@ -38,9 +38,11 @@ describe('launchPersistentContext()', function() {it('context.cookies() should work', async state => {const { page, server } = await launch(state);await page.goto(server.EMPTY_PAGE);- await page.evaluate(() => {+ const documentCookie = await page.evaluate(() => {document.cookie = 'username=John Doe';+ return document.cookie;});+ expect(documentCookie).toBe('username=John Doe');expect(await page.context().cookies()).toEqual([{name: 'username',value: 'John Doe',@@ -105,7 +107,11 @@ describe('launchPersistentContext()', function() {iframe.src = src;return promise;}, server.CROSS_PROCESS_PREFIX + '/grid.html');- await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);+ const documentCookie = await page.frames()[1].evaluate(() => {+ document.cookie = 'username=John Doe';+ return document.cookie;+ });+ expect(documentCookie).toBe('username=John Doe');await page.waitForTimeout(2000);const allowsThirdParty = CHROMIUM || FFOX;const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');diff --git a/test/headful.spec.js b/test/headful.spec.jsindex 2779bd8d7f..061aaf7df9 100644--- a/test/headful.spec.js+++ b/test/headful.spec.js@@ -92,7 +92,11 @@ describe('Headful', function() {iframe.src = src;return promise;}, server.CROSS_PROCESS_PREFIX + '/grid.html');- await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);+ const documentCookie = await page.frames()[1].evaluate(() => {+ document.cookie = 'username=John Doe';+ return document.cookie;+ });+ expect(documentCookie).toBe('username=John Doe');await page.waitForTimeout(2000);const allowsThirdParty = CHROMIUM || FFOX;const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');