Skip to content

Commit b17a73c

Browse files
authored
test: try to unflake cookie test (#2310)
Happens on WebKit sometimes. There is probably a race between setting a cookie and saving it in the cookie jar in another process.
1 parent 8e396fd commit b17a73c

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/cookies.spec.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,14 @@ describe('BrowserContext.cookies', function() {
8888
});
8989
it('should get multiple cookies', async({context, page, server}) => {
9090
await page.goto(server.EMPTY_PAGE);
91-
await page.evaluate(() => {
91+
const documentCookie = await page.evaluate(() => {
9292
document.cookie = 'username=John Doe';
9393
document.cookie = 'password=1234';
94+
return document.cookie.split('; ').sort().join('; ');
9495
});
9596
const cookies = await context.cookies();
9697
cookies.sort((a, b) => a.name.localeCompare(b.name));
98+
expect(documentCookie).toBe('password=1234; username=John Doe');
9799
expect(cookies).toEqual([
98100
{
99101
name: 'password',

0 commit comments

Comments
 (0)