Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
test: request cookie order is same as in set-cookie (#24194)
Yury Semikhatskycc51d13c363d
diff --git a/tests/library/browsercontext-fetch.spec.ts b/tests/library/browsercontext-fetch.spec.tsindex fa38270a58..8d31c6b6f5 100644--- a/tests/library/browsercontext-fetch.spec.ts+++ b/tests/library/browsercontext-fetch.spec.ts@@ -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=']);