mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-11 12:33:45 +03:00
test: request cookie order is same as in set-cookie (#24194)
This commit is contained in:
parent
53feeaf270
commit
cc51d13c36
@ -218,6 +218,33 @@ it('should add cookies from Set-Cookie header', async ({ context, page, server }
|
||||
expect((await page.evaluate(() => document.cookie)).split(';').map(s => s.trim()).sort()).toEqual(['foo=bar', 'session=value']);
|
||||
});
|
||||
|
||||
it('should preserve cookie order from Set-Cookie header', async ({ context, page, server, browserName, isLinux }) => {
|
||||
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/23390' });
|
||||
it.fixme(browserName === 'webkit' && isLinux);
|
||||
server.setRoute('/setcookie.html', (req, res) => {
|
||||
res.setHeader('Set-Cookie', ['cookie.0=foo', 'cookie.1=bar']);
|
||||
res.end();
|
||||
});
|
||||
await page.request.get(server.PREFIX + '/setcookie.html');
|
||||
const cookies = await context.cookies();
|
||||
expect(cookies.map(c => ({ name: c.name, value: c.value }))).toEqual([
|
||||
{
|
||||
name: 'cookie.0',
|
||||
value: 'foo'
|
||||
},
|
||||
{
|
||||
name: 'cookie.1',
|
||||
value: 'bar'
|
||||
},
|
||||
]);
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
expect(await page.evaluate(() => document.cookie)).toEqual('cookie.0=foo; cookie.1=bar');
|
||||
const requestPromise = server.waitForRequest('/empty.html');
|
||||
await page.request.get(server.EMPTY_PAGE);
|
||||
const request = await requestPromise;
|
||||
expect(request.headers.cookie).toEqual('cookie.0=foo; cookie.1=bar');
|
||||
});
|
||||
|
||||
it('should support cookie with empty value', async ({ context, page, server }) => {
|
||||
server.setRoute('/setcookie.html', (req, res) => {
|
||||
res.setHeader('Set-Cookie', ['first=']);
|
||||
|
Loading…
Reference in New Issue
Block a user