diff options
Diffstat (limited to 'remote/test/puppeteer/test/src/navigation.spec.ts')
-rw-r--r-- | remote/test/puppeteer/test/src/navigation.spec.ts | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/remote/test/puppeteer/test/src/navigation.spec.ts b/remote/test/puppeteer/test/src/navigation.spec.ts index 1f3a51f58a..dd59c98349 100644 --- a/remote/test/puppeteer/test/src/navigation.spec.ts +++ b/remote/test/puppeteer/test/src/navigation.spec.ts @@ -154,10 +154,10 @@ describe('navigation', function () { }); const EXPECTED_SSL_CERT_MESSAGE_REGEX = - /net::ERR_CERT_INVALID|net::ERR_CERT_AUTHORITY_INVALID/; + /net::ERR_CERT_INVALID|net::ERR_CERT_AUTHORITY_INVALID|MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT|SSL_ERROR_UNKNOWN/; it('should fail when navigating to bad SSL', async () => { - const {page, httpsServer, isChrome} = await getTestState(); + const {page, httpsServer} = await getTestState(); // Make sure that network events do not emit 'undefined'. // @see https://crbug.com/750469 @@ -176,18 +176,14 @@ describe('navigation', function () { await page.goto(httpsServer.EMPTY_PAGE).catch(error_ => { return (error = error_); }); - if (isChrome) { - expect(error.message).toMatch(EXPECTED_SSL_CERT_MESSAGE_REGEX); - } else { - expect(error.message).toContain('SSL_ERROR_UNKNOWN'); - } + expect(error.message).toMatch(EXPECTED_SSL_CERT_MESSAGE_REGEX); expect(requests).toHaveLength(2); expect(requests[0]).toBe('request'); expect(requests[1]).toBe('requestfailed'); }); it('should fail when navigating to bad SSL after redirects', async () => { - const {page, server, httpsServer, isChrome} = await getTestState(); + const {page, server, httpsServer} = await getTestState(); server.setRedirect('/redirect/1.html', '/redirect/2.html'); server.setRedirect('/redirect/2.html', '/empty.html'); @@ -195,17 +191,10 @@ describe('navigation', function () { await page.goto(httpsServer.PREFIX + '/redirect/1.html').catch(error_ => { return (error = error_); }); - if (isChrome) { - expect(error.message).toMatch(EXPECTED_SSL_CERT_MESSAGE_REGEX); - } else { - expect(error.message).atLeastOneToContain([ - 'MOZILLA_PKIX_ERROR_SELF_SIGNED_CERT', // Firefox WebDriver BiDi. - 'SSL_ERROR_UNKNOWN ', // Others. - ]); - } + expect(error.message).toMatch(EXPECTED_SSL_CERT_MESSAGE_REGEX); }); it('should fail when main resources failed to load', async () => { - const {page, isChrome} = await getTestState(); + const {page} = await getTestState(); let error!: Error; await page @@ -213,11 +202,9 @@ describe('navigation', function () { .catch(error_ => { return (error = error_); }); - if (isChrome) { - expect(error.message).toContain('net::ERR_CONNECTION_REFUSED'); - } else { - expect(error.message).toContain('NS_ERROR_CONNECTION_REFUSED'); - } + expect(error.message).toMatch( + /net::ERR_CONNECTION_REFUSED|NS_ERROR_CONNECTION_REFUSED/ + ); }); it('should fail when exceeding maximum navigation timeout', async () => { const {page, server} = await getTestState(); |