From 0bf7477c2433bce79c3ef77cfd04fc080af43d5f Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Tue, 12 Jan 2021 15:56:12 -0800 Subject: [PATCH] test(network): add failing test for Set-Cookie in fulfill (#4988) --- test/page-request-fulfill.spec.ts | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/test/page-request-fulfill.spec.ts b/test/page-request-fulfill.spec.ts index 7a0563f51b..691951810a 100644 --- a/test/page-request-fulfill.spec.ts +++ b/test/page-request-fulfill.spec.ts @@ -177,3 +177,29 @@ it('should include the origin header', async ({page, server}) => { expect(text).toBe('done'); expect(interceptedRequest.headers()['origin']).toEqual(server.PREFIX); }); + +it('should support Set-Cookie header', (test, { browserName }) => { + test.fixme(browserName === 'webkit'); + test.fixme(browserName === 'firefox'); +}, async ({context, page, server}) => { + await page.route('https://example.com/', (route, request) => { + route.fulfill({ + headers: { + 'Set-Cookie': 'name=value; domain=.example.com; Path=/' + }, + contentType: 'text/html', + body: 'done' + }); + }); + await page.goto('https://example.com'); + expect(await context.cookies()).toEqual([{ + sameSite: 'None', + name: 'name', + value: 'value', + domain: '.example.com', + path: '/', + expires: -1, + httpOnly: false, + secure: false + }]); +});