test: verify ignoreHTTPSErrors works with puppeteer.connect (#2648)

References #2642.
This commit is contained in:
Andrey Lushnikov 2018-05-31 16:04:48 -07:00 committed by GitHub
parent 754df58d4e
commit 0ba72df67d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -301,6 +301,21 @@ module.exports.addTests = function({testRunner, expect, PROJECT_ROOT, defaultBro
expect(await secondPage.evaluate(() => 7 * 6)).toBe(42, 'original browser should still work'); expect(await secondPage.evaluate(() => 7 * 6)).toBe(42, 'original browser should still work');
await originalBrowser.close(); await originalBrowser.close();
}); });
it('should support ignoreHTTPSErrors option', async({httpsServer}) => {
const originalBrowser = await puppeteer.launch(defaultBrowserOptions);
const browserWSEndpoint = originalBrowser.wsEndpoint();
const browser = await puppeteer.connect({browserWSEndpoint, ignoreHTTPSErrors: true});
const page = await browser.newPage();
let error = null;
const response = await page.goto(httpsServer.EMPTY_PAGE).catch(e => error = e);
expect(error).toBe(null);
expect(response.ok()).toBe(true);
expect(response.securityDetails()).toBeTruthy();
expect(response.securityDetails().protocol()).toBe('TLS 1.2');
await page.close();
await browser.close();
});
it('should be able to reconnect to a disconnected browser', async({server}) => { it('should be able to reconnect to a disconnected browser', async({server}) => {
const originalBrowser = await puppeteer.launch(defaultBrowserOptions); const originalBrowser = await puppeteer.launch(defaultBrowserOptions);
const browserWSEndpoint = originalBrowser.wsEndpoint(); const browserWSEndpoint = originalBrowser.wsEndpoint();