Skip to content

Commit

Permalink
test: send cookies via an embedded iframe (#17036)
Browse files Browse the repository at this point in the history
  • Loading branch information
mxschmitt committed Sep 2, 2022
1 parent 3548f3f commit 8f1f494
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/library/browsercontext-cookies.spec.ts
Expand Up @@ -320,3 +320,32 @@ it('should add cookies with an expiration', async ({ context }) => {
expires: -42,
}])).rejects.toThrow(/Cookie should have a valid expires/);
});

it('should be able to send third party cookies via an iframe', async ({ browser, httpsServer, browserName }) => {
it.fixme(browserName === 'firefox' || browserName === 'webkit');
it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/16937' });

const context = await browser.newContext({
ignoreHTTPSErrors: true,
});
try {
const page = await context.newPage();
await page.goto(httpsServer.EMPTY_PAGE);
await context.addCookies([{
domain: new URL(httpsServer.CROSS_PROCESS_PREFIX).hostname,
path: '/',
name: 'cookie1',
value: 'yes',
httpOnly: true,
secure: true,
sameSite: 'None'
}]);
const [response] = await Promise.all([
httpsServer.waitForRequest('/grid.html'),
page.setContent(`<iframe src="${httpsServer.CROSS_PROCESS_PREFIX}/grid.html"></iframe>`)
]);
expect(response.headers['cookie']).toBe('cookie1=yes');
} finally {
await context.close();
}
});

0 comments on commit 8f1f494

Please sign in to comment.