diff --git a/tests/config/utils.ts b/tests/config/utils.ts index dadb34fe33..26c1a8e484 100644 --- a/tests/config/utils.ts +++ b/tests/config/utils.ts @@ -51,21 +51,18 @@ export async function verifyViewport(page: Page, width: number, height: number) expect(await page.evaluate('window.innerHeight')).toBe(height); } -export function expectedSSLError(browserName: string, platform: string): string { - let expectedSSLError: string; - if (browserName === 'chromium') { - expectedSSLError = 'net::ERR_CERT_AUTHORITY_INVALID'; - } else if (browserName === 'webkit') { +export function expectedSSLError(browserName: string, platform: string): RegExp { + if (browserName === 'chromium') + return /net::(ERR_CERT_AUTHORITY_INVALID|ERR_CERT_INVALID)/; + if (browserName === 'webkit') { if (platform === 'darwin') - expectedSSLError = 'The certificate for this server is invalid'; + return /The certificate for this server is invalid/; else if (platform === 'win32') - expectedSSLError = 'SSL peer certificate or SSH remote key was not OK'; + return /SSL peer certificate or SSH remote key was not OK/; else - expectedSSLError = 'Unacceptable TLS certificate'; - } else { - expectedSSLError = 'SSL_ERROR_UNKNOWN'; + return /Unacceptable TLS certificate/; } - return expectedSSLError; + return /SSL_ERROR_UNKNOWN/; } export function chromiumVersionLessThan(a: string, b: string) { diff --git a/tests/page/page-goto.spec.ts b/tests/page/page-goto.spec.ts index 5128def18e..9ca0544916 100644 --- a/tests/page/page-goto.spec.ts +++ b/tests/page/page-goto.spec.ts @@ -271,7 +271,7 @@ it('should fail when navigating to bad SSL', async ({ page, browserName, httpsSe page.on('requestfailed', request => expect(request).toBeTruthy()); let error = null; await page.goto(httpsServer.EMPTY_PAGE).catch(e => error = e); - expect(error.message).toContain(expectedSSLError(browserName, platform)); + expect(error.message).toMatch(expectedSSLError(browserName, platform)); }); it('should fail when navigating to bad SSL after redirects', async ({ page, browserName, server, httpsServer, platform }) => { @@ -279,7 +279,7 @@ it('should fail when navigating to bad SSL after redirects', async ({ page, brow server.setRedirect('/redirect/2.html', '/empty.html'); let error = null; await page.goto(httpsServer.PREFIX + '/redirect/1.html').catch(e => error = e); - expect(error.message).toContain(expectedSSLError(browserName, platform)); + expect(error.message).toMatch(expectedSSLError(browserName, platform)); }); it('should not crash when navigating to bad SSL after a cross origin navigation', async ({ page, server, httpsServer }) => { diff --git a/tests/page/page-screenshot.spec.ts b/tests/page/page-screenshot.spec.ts index bea03d1d30..c43ed57728 100644 --- a/tests/page/page-screenshot.spec.ts +++ b/tests/page/page-screenshot.spec.ts @@ -841,10 +841,10 @@ it('should throw if screenshot size is too large', async ({ page, browserName, i } }); -it('page screenshot should capture css transform', async function({ page, browserName, isElectron }) { +it('page screenshot should capture css transform', async function({ page, browserName, isElectron, isAndroid }) { it.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26447' }); it.fixme(browserName === 'webkit'); - it.fixme(isElectron, 'Returns screenshot of a different size.'); + it.fixme(isElectron || isAndroid, 'Returns screenshot of a different size.'); await page.setContent(`