mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-15 06:02:57 +03:00
test: unflake more cookie tests (#2346)
This commit is contained in:
parent
27d30fe162
commit
79ec3c916e
@ -38,9 +38,11 @@ describe('launchPersistentContext()', function() {
|
|||||||
it('context.cookies() should work', async state => {
|
it('context.cookies() should work', async state => {
|
||||||
const { page, server } = await launch(state);
|
const { page, server } = await launch(state);
|
||||||
await page.goto(server.EMPTY_PAGE);
|
await page.goto(server.EMPTY_PAGE);
|
||||||
await page.evaluate(() => {
|
const documentCookie = await page.evaluate(() => {
|
||||||
document.cookie = 'username=John Doe';
|
document.cookie = 'username=John Doe';
|
||||||
|
return document.cookie;
|
||||||
});
|
});
|
||||||
|
expect(documentCookie).toBe('username=John Doe');
|
||||||
expect(await page.context().cookies()).toEqual([{
|
expect(await page.context().cookies()).toEqual([{
|
||||||
name: 'username',
|
name: 'username',
|
||||||
value: 'John Doe',
|
value: 'John Doe',
|
||||||
@ -105,7 +107,11 @@ describe('launchPersistentContext()', function() {
|
|||||||
iframe.src = src;
|
iframe.src = src;
|
||||||
return promise;
|
return promise;
|
||||||
}, server.CROSS_PROCESS_PREFIX + '/grid.html');
|
}, 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);
|
await page.waitForTimeout(2000);
|
||||||
const allowsThirdParty = CHROMIUM || FFOX;
|
const allowsThirdParty = CHROMIUM || FFOX;
|
||||||
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
const cookies = await context.cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||||
|
@ -92,7 +92,11 @@ describe('Headful', function() {
|
|||||||
iframe.src = src;
|
iframe.src = src;
|
||||||
return promise;
|
return promise;
|
||||||
}, server.CROSS_PROCESS_PREFIX + '/grid.html');
|
}, 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);
|
await page.waitForTimeout(2000);
|
||||||
const allowsThirdParty = CHROMIUM || FFOX;
|
const allowsThirdParty = CHROMIUM || FFOX;
|
||||||
const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
const cookies = await page.context().cookies(server.CROSS_PROCESS_PREFIX + '/grid.html');
|
||||||
|
Loading…
Reference in New Issue
Block a user