mirror of
https://github.com/puppeteer/puppeteer
synced 2024-06-14 14:02:48 +00:00
chore: update Travis to run latest macOS and fix HTTPS test (#5903)
* chore: fix invalid SSL assertion on Catalina The error Chrome gives with an invalid cert changes between older Mac versions and Catalina as detailed here: https://support.google.com/chrome/thread/18125056?hl=en. This PR changes Travis to run Catalina (and we think most devs run up to date OS versions) so this fix ensures the test behaviour is consistent locally and on Travis. For those on older Mac versions I've left a comment by the tests to hopefully save them debugging! Co-authored-by: Mathias Bynens <mathias@qiwi.be>
This commit is contained in:
parent
9a08d31319
commit
d8e0557d18
@ -6,6 +6,7 @@ jobs:
|
||||
- os: "osx"
|
||||
name: 'Unit tests: macOS/Chromium'
|
||||
node_js: "10.19.0"
|
||||
osx_image: xcode11.4
|
||||
env:
|
||||
- CHROMIUM=true
|
||||
before_install:
|
||||
|
@ -21,6 +21,7 @@ const {
|
||||
setupTestBrowserHooks,
|
||||
setupTestPageAndContextHooks,
|
||||
} = require('./mocha-utils');
|
||||
const os = require('os');
|
||||
|
||||
describe('navigation', function () {
|
||||
setupTestBrowserHooks();
|
||||
@ -146,6 +147,17 @@ describe('navigation', function () {
|
||||
expect(error.message).toContain('Cannot navigate to invalid URL');
|
||||
else expect(error.message).toContain('Invalid url');
|
||||
});
|
||||
|
||||
/* If you are running this on pre-Catalina versions of macOS this will fail locally.
|
||||
/* Mac OSX Catalina outputs a different message than other platforms.
|
||||
* See https://support.google.com/chrome/thread/18125056?hl=en for details.
|
||||
* If you're running pre-Catalina Mac OSX this test will fail locally.
|
||||
*/
|
||||
const EXPECTED_SSL_CERT_MESSAGE =
|
||||
os.platform() === 'darwin'
|
||||
? 'net::ERR_CERT_INVALID'
|
||||
: 'net::ERR_CERT_AUTHORITY_INVALID';
|
||||
|
||||
itFailsFirefox('should fail when navigating to bad SSL', async () => {
|
||||
const { page, httpsServer, isChrome } = getTestState();
|
||||
|
||||
@ -158,8 +170,7 @@ describe('navigation', function () {
|
||||
await page
|
||||
.goto(httpsServer.EMPTY_PAGE)
|
||||
.catch((error_) => (error = error_));
|
||||
if (isChrome)
|
||||
expect(error.message).toContain('net::ERR_CERT_AUTHORITY_INVALID');
|
||||
if (isChrome) expect(error.message).toContain(EXPECTED_SSL_CERT_MESSAGE);
|
||||
else expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
||||
});
|
||||
itFailsFirefox(
|
||||
@ -174,7 +185,7 @@ describe('navigation', function () {
|
||||
.goto(httpsServer.PREFIX + '/redirect/1.html')
|
||||
.catch((error_) => (error = error_));
|
||||
if (isChrome)
|
||||
expect(error.message).toContain('net::ERR_CERT_AUTHORITY_INVALID');
|
||||
expect(error.message).toContain(EXPECTED_SSL_CERT_MESSAGE);
|
||||
else expect(error.message).toContain('SSL_ERROR_UNKNOWN');
|
||||
}
|
||||
);
|
||||
|
Loading…
Reference in New Issue
Block a user