test: unflake more cookie tests (#2346)

This commit is contained in:
Dmitry Gozman 2020-05-22 17:20:42 -07:00 committed by GitHub
parent 27d30fe162
commit 79ec3c916e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -38,9 +38,11 @@ describe('launchPersistentContext()', function() {
it('context.cookies() should work', async state => {
const { page, server } = await launch(state);
await page.goto(server.EMPTY_PAGE);
await page.evaluate(() => {
const documentCookie = await page.evaluate(() => {
document.cookie = 'username=John Doe';
return document.cookie;
});
expect(documentCookie).toBe('username=John Doe');
expect(await page.context().cookies()).toEqual([{
name: 'username',
value: 'John Doe',
@ -105,7 +107,11 @@ describe('launchPersistentContext()', function() {
iframe.src = src;
return promise;
}, server.CROSS_PROCESS_PREFIX + '/grid.html');
await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);
const documentCookie = await page.frames()[1].evaluate(() => {
document.cookie = 'username=John Doe';
return document.cookie;
});
expect(documentCookie).toBe('username=John Doe');
await page.waitForTimeout(2000);
const allowsThirdParty = CHROMIUM || FFOX;
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');

View File

@ -92,7 +92,11 @@ describe('Headful', function() {
iframe.src = src;
return promise;
}, server.CROSS_PROCESS_PREFIX + '/grid.html');
await page.frames()[1].evaluate(`document.cookie = 'username=John Doe'`);
const documentCookie = await page.frames()[1].evaluate(() => {
document.cookie = 'username=John Doe';
return document.cookie;
});
expect(documentCookie).toBe('username=John Doe');
await page.waitForTimeout(2000);
const allowsThirdParty = CHROMIUM || FFOX;
const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');