Skip to content

Commit 0bf7477

Browse files
authored
test(network): add failing test for Set-Cookie in fulfill (#4988)
1 parent cac119f commit 0bf7477

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/page-request-fulfill.spec.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,29 @@ it('should include the origin header', async ({page, server}) => {
177177
expect(text).toBe('done');
178178
expect(interceptedRequest.headers()['origin']).toEqual(server.PREFIX);
179179
});
180+
181+
it('should support Set-Cookie header', (test, { browserName }) => {
182+
test.fixme(browserName === 'webkit');
183+
test.fixme(browserName === 'firefox');
184+
}, async ({context, page, server}) => {
185+
await page.route('https://example.com/', (route, request) => {
186+
route.fulfill({
187+
headers: {
188+
'Set-Cookie': 'name=value; domain=.example.com; Path=/'
189+
},
190+
contentType: 'text/html',
191+
body: 'done'
192+
});
193+
});
194+
await page.goto('https://example.com');
195+
expect(await context.cookies()).toEqual([{
196+
sameSite: 'None',
197+
name: 'name',
198+
value: 'value',
199+
domain: '.example.com',
200+
path: '/',
201+
expires: -1,
202+
httpOnly: false,
203+
secure: false
204+
}]);
205+
});

0 commit comments

Comments
 (0)