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:
parent
218955c155
commit
820611e3cc
|
|
@ -51,21 +51,18 @@ export async function verifyViewport(page: Page, width: number, height: number)
|
||||||
expect(await page.evaluate('window.innerHeight')).toBe(height);
|
expect(await page.evaluate('window.innerHeight')).toBe(height);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function expectedSSLError(browserName: string, platform: string): string {
|
export function expectedSSLError(browserName: string, platform: string): RegExp {
|
||||||
let expectedSSLError: string;
|
if (browserName === 'chromium')
|
||||||
if (browserName === 'chromium') {
|
return /net::(ERR_CERT_AUTHORITY_INVALID|ERR_CERT_INVALID)/;
|
||||||
expectedSSLError = 'net::ERR_CERT_AUTHORITY_INVALID';
|
if (browserName === 'webkit') {
|
||||||
} else if (browserName === 'webkit') {
|
|
||||||
if (platform === 'darwin')
|
if (platform === 'darwin')
|
||||||
expectedSSLError = 'The certificate for this server is invalid';
|
return /The certificate for this server is invalid/;
|
||||||
else if (platform === 'win32')
|
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
|
else
|
||||||
expectedSSLError = 'Unacceptable TLS certificate';
|
return /Unacceptable TLS certificate/;
|
||||||
} else {
|
|
||||||
expectedSSLError = 'SSL_ERROR_UNKNOWN';
|
|
||||||
}
|
}
|
||||||
return expectedSSLError;
|
return /SSL_ERROR_UNKNOWN/;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function chromiumVersionLessThan(a: string, b: string) {
|
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());
|
page.on('requestfailed', request => expect(request).toBeTruthy());
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.goto(httpsServer.EMPTY_PAGE).catch(e => error = e);
|
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 }) => {
|
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');
|
server.setRedirect('/redirect/2.html', '/empty.html');
|
||||||
let error = null;
|
let error = null;
|
||||||
await page.goto(httpsServer.PREFIX + '/redirect/1.html').catch(e => error = e);
|
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 }) => {
|
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.info().annotations.push({ type: 'issue', description: 'https://github.com/microsoft/playwright/issues/26447' });
|
||||||
it.fixme(browserName === 'webkit');
|
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(`
|
await page.setContent(`
|
||||||
<style>
|
<style>
|
||||||
.container {
|
.container {
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ it('should work with clicking on links which do not commit navigation', async ({
|
||||||
page.waitForNavigation().catch(e => e),
|
page.waitForNavigation().catch(e => e),
|
||||||
page.click('a'),
|
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 }) => {
|
it('should work with history.pushState()', async ({ page, server }) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue