diff --git a/test/ignorehttpserrors.spec.js b/test/ignorehttpserrors.spec.js index c524c52b36e..2eed7a0572d 100644 --- a/test/ignorehttpserrors.spec.js +++ b/test/ignorehttpserrors.spec.js @@ -39,10 +39,14 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p describe('Response.securityDetails', function() { it('should work', async({page, httpsServer}) => { - const response = await page.goto(httpsServer.EMPTY_PAGE); + const [serverRequest, response] = await Promise.all([ + httpsServer.waitForRequest('/empty.html'), + page.goto(httpsServer.EMPTY_PAGE) + ]); const securityDetails = response.securityDetails(); expect(securityDetails.issuer()).toBe('puppeteer-tests'); - expect(securityDetails.protocol()).toBe('TLS 1.2'); + const protocol = serverRequest.socket.getProtocol().replace('v', ' '); + expect(securityDetails.protocol()).toBe(protocol); expect(securityDetails.subjectName()).toBe('puppeteer-tests'); expect(securityDetails.validFrom()).toBe(1550084863); expect(securityDetails.validTo()).toBe(33086084863); @@ -55,11 +59,15 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p httpsServer.setRedirect('/plzredirect', '/empty.html'); const responses = []; page.on('response', response => responses.push(response)); - await page.goto(httpsServer.PREFIX + '/plzredirect'); + const [serverRequest, ] = await Promise.all([ + httpsServer.waitForRequest('/plzredirect'), + page.goto(httpsServer.PREFIX + '/plzredirect') + ]); expect(responses.length).toBe(2); expect(responses[0].status()).toBe(302); const securityDetails = responses[0].securityDetails(); - expect(securityDetails.protocol()).toBe('TLS 1.2'); + const protocol = serverRequest.socket.getProtocol().replace('v', ' '); + expect(securityDetails.protocol()).toBe(protocol); }); }); diff --git a/test/launcher.spec.js b/test/launcher.spec.js index 510d1c9ef1b..41a1e2b0638 100644 --- a/test/launcher.spec.js +++ b/test/launcher.spec.js @@ -288,11 +288,15 @@ module.exports.addTests = function({testRunner, expect, defaultBrowserOptions, p 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); + const [serverRequest, response] = await Promise.all([ + httpsServer.waitForRequest('/empty.html'), + 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'); + const protocol = serverRequest.socket.getProtocol().replace('v', ' '); + expect(response.securityDetails().protocol()).toBe(protocol); await page.close(); await browser.close(); }); diff --git a/utils/testserver/index.js b/utils/testserver/index.js index c85229c30f1..85f2d1fdd77 100644 --- a/utils/testserver/index.js +++ b/utils/testserver/index.js @@ -46,7 +46,6 @@ class TestServer { const server = new TestServer(dirPath, port, { key: fs.readFileSync(path.join(__dirname, 'key.pem')), cert: fs.readFileSync(path.join(__dirname, 'cert.pem')), - secureProtocol: 'TLSv1_2_method', passphrase: 'aaaa', }); await new Promise(x => server._server.once('listening', x));