From bff9f30b6f6fd971f7732fc87d6ce714f15b7d88 Mon Sep 17 00:00:00 2001 From: Max Schmitt Date: Wed, 10 Apr 2024 22:13:01 +0200 Subject: [PATCH] test: add test for 'should parse cookie with large Max-Age correctly' (#30323) --- tests/library/browsercontext-cookies.spec.ts | 27 ++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/library/browsercontext-cookies.spec.ts b/tests/library/browsercontext-cookies.spec.ts index d0cfdb6cec..a53f989886 100644 --- a/tests/library/browsercontext-cookies.spec.ts +++ b/tests/library/browsercontext-cookies.spec.ts @@ -400,3 +400,30 @@ it('should support requestStorageAccess', async ({ page, server, channel, browse } } }); + +it('should parse cookie with large Max-Age correctly', async ({ server, page, defaultSameSiteCookieValue, browserName, platform }) => { + it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/30305' }); + it.fixme(browserName === 'webkit' && platform === 'linux', 'https://github.com/microsoft/playwright/issues/30305'); + + server.setRoute('/foobar', (req, res) => { + res.setHeader('set-cookie', [ + 'cookie1=value1; Path=/; Expires=Thu, 08 Sep 2270 15:06:12 GMT; Max-Age=7776000000' + ]); + res.statusCode = 200; + res.end(); + }); + await page.goto(server.PREFIX + '/foobar'); + expect(await page.evaluate(() => document.cookie)).toBe('cookie1=value1'); + expect(await page.context().cookies()).toEqual([ + { + name: 'cookie1', + value: 'value1', + domain: 'localhost', + path: '/', + expires: expect.any(Number), + httpOnly: false, + secure: false, + sameSite: defaultSameSiteCookieValue, + }, + ]); +});