test: fix electron test expectations (#26643)
This regressed in https://github.com/microsoft/playwright/pull/26423 since the certificate got changed.
This commit is contained in:
Родитель
218955c155
Коммит
820611e3cc
|
@ -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) {
|
||||
|
|
|
@ -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 }) => {
|
||||
|
|
|
@ -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(`
|
||||
<style>
|
||||
.container {
|
||||
|
|
|
@ -89,7 +89,7 @@ it('should work with clicking on links which do not commit navigation', async ({
|
|||
page.waitForNavigation().catch(e => e),
|
||||
page.click('a'),
|
||||
]);
|
||||
expect(error.message).toContain(expectedSSLError(browserName, platform));
|
||||
expect(error.message).toMatch(expectedSSLError(browserName, platform));
|
||||
});
|
||||
|
||||
it('should work with history.pushState()', async ({ page, server }) => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче