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.
This commit is contained in:
Dmitry Gozman 2020-05-20 14:54:21 -07:00 committed by GitHub
parent 8e396fdac0
commit b17a73c184
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -88,12 +88,14 @@ describe('BrowserContext.cookies', function() {
});
it('should get multiple cookies', async({context, page, server}) => {
await page.goto(server.EMPTY_PAGE);
await page.evaluate(() => {
const documentCookie = await page.evaluate(() => {
document.cookie = 'username=John Doe';
document.cookie = 'password=1234';
return document.cookie.split('; ').sort().join('; ');
});
const cookies = await context.cookies();
cookies.sort((a, b) => a.name.localeCompare(b.name));
expect(documentCookie).toBe('password=1234; username=John Doe');
expect(cookies).toEqual([
{
name: 'password',