From 9a73dfe7739579233d9ac4f984637f1c5d6cb432 Mon Sep 17 00:00:00 2001 From: Andrey Lushnikov Date: Thu, 19 May 2022 10:29:44 -0600 Subject: [PATCH] feat(chromium-tip-of-tree): roll Chromium TOT to 1008 (#14279) --- packages/playwright-core/browsers.json | 4 ++-- tests/library/browsercontext-cookies.spec.ts | 18 ++++++++++++++---- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/packages/playwright-core/browsers.json b/packages/playwright-core/browsers.json index e054b0005f..f1dc0c8f74 100644 --- a/packages/playwright-core/browsers.json +++ b/packages/playwright-core/browsers.json @@ -15,9 +15,9 @@ }, { "name": "chromium-tip-of-tree", - "revision": "1007", + "revision": "1008", "installByDefault": false, - "browserVersion": "104.0.5067.0" + "browserVersion": "104.0.5071.0" }, { "name": "firefox", diff --git a/tests/library/browsercontext-cookies.spec.ts b/tests/library/browsercontext-cookies.spec.ts index c619a620a0..8692505244 100644 --- a/tests/library/browsercontext-cookies.spec.ts +++ b/tests/library/browsercontext-cookies.spec.ts @@ -40,7 +40,7 @@ it('should get a cookie @smoke', async ({ context, page, server, defaultSameSite }]); }); -it('should get a non-session cookie', async ({ context, page, server, defaultSameSiteCookieValue }) => { +it('should get a non-session cookie', async ({ context, page, server, defaultSameSiteCookieValue, browserName, browserMajorVersion }) => { await page.goto(server.EMPTY_PAGE); // @see https://en.wikipedia.org/wiki/Year_2038_problem const date = +(new Date('1/1/2038')); @@ -50,16 +50,26 @@ it('should get a non-session cookie', async ({ context, page, server, defaultSam return document.cookie; }, date); expect(documentCookie).toBe('username=John Doe'); - expect(await context.cookies()).toEqual([{ + const cookies = await context.cookies(); + expect(cookies.length).toBe(1); + expect(cookies[0]).toEqual({ name: 'username', value: 'John Doe', domain: 'localhost', path: '/', - expires: date / 1000, + // We will check this separately. + expires: expect.anything(), httpOnly: false, secure: false, sameSite: defaultSameSiteCookieValue, - }]); + }); + // Browsers start to cap cookies with 400 days max expires value. + // See https://github.com/httpwg/http-extensions/pull/1732 + // Chromium patch: https://chromium.googlesource.com/chromium/src/+/aaa5d2b55478eac2ee642653dcd77a50ac3faff6 + // We want to make sure that expires date is at least 400 days in future. + const FOUR_HUNDRED_DAYS = 1000 * 60 * 60 * 24 * 400; + const FIVE_MINUTES = 1000 * 60 * 5; // relax condition a bit to make sure test is not flaky. + expect(cookies[0].expires).toBeGreaterThan((Date.now() + FOUR_HUNDRED_DAYS - FIVE_MINUTES) / 1000); }); it('should properly report httpOnly cookie', async ({ context, page, server }) => {