test: add test with request interception and cookies (#2988)

Fixes #2970.
This commit is contained in:
Andrey Lushnikov 2018-07-30 19:05:19 -07:00 committed by GitHub
parent 862ad96bde
commit 5bcb7cf512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -262,6 +262,17 @@ module.exports.addTests = function({testRunner, expect}) {
expect(requests[1].url()).toContain('/one-style.css'); expect(requests[1].url()).toContain('/one-style.css');
expect(requests[1].headers().referer).toContain('/one-style.html'); expect(requests[1].headers().referer).toContain('/one-style.html');
}); });
it('should properly return navigation response when URL has cookies', async({page, server}) => {
// Setup cookie.
await page.goto(server.EMPTY_PAGE);
await page.setCookie({ name: 'foo', value: 'bar'});
// Setup request interception.
await page.setRequestInterception(true);
page.on('request', request => request.continue());
const response = await page.reload();
expect(response.status()).toBe(200);
});
it('should stop intercepting', async({page, server}) => { it('should stop intercepting', async({page, server}) => {
await page.setRequestInterception(true); await page.setRequestInterception(true);
page.once('request', request => request.continue()); page.once('request', request => request.continue());