move actual interception test

This commit is contained in:
Yury Semikhatsky 2019-12-14 19:28:31 -08:00
parent aac4a9bfaa
commit 971210ff12

View file

@ -662,20 +662,15 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p
}); });
describe('ignoreHTTPSErrors', function() { describe('ignoreHTTPSErrors', function() {
fit('should work with mixed content', async({server, httpsServer}) => { it('should work with request interception', async({httpsServer}) => {
const browser = await playwright.launch({...defaultBrowserOptions, ignoreHTTPSErrors: true}); const browser = await playwright.launch({...defaultBrowserOptions, ignoreHTTPSErrors: true});
const context = await browser.newContext(); const context = await browser.newContext();
const page = await context.newPage(); const page = await context.newPage();
httpsServer.setRoute('/mixedcontent.html', (req, res) => { await page.interception.enable();
res.end(`<iframe src=${server.EMPTY_PAGE}></iframe>`); page.on('request', request => page.interception.continue(request));
}); const response = await page.goto(httpsServer.EMPTY_PAGE);
await page.goto(httpsServer.PREFIX + '/mixedcontent.html', {waitUntil: 'load'}); expect(response.status()).toBe(200);
expect(page.frames().length).toBe(2);
// Make sure blocked iframe has functional execution context
// @see https://github.com/GoogleChrome/puppeteer/issues/2709
expect(await page.frames()[0].evaluate('1 + 2')).toBe(3);
expect(await page.frames()[1].evaluate('2 + 3')).toBe(5);
await browser.close(); await browser.close();
}); });