chore: fix s2 mode (#24525)
This commit is contained in:
parent
f135b5f7a8
commit
744eb6823f
|
|
@ -23,9 +23,19 @@ export type PlatformWorkerFixtures = {
|
|||
isLinux: boolean;
|
||||
};
|
||||
|
||||
function platform(): 'win32' | 'darwin' | 'linux' {
|
||||
if (process.env.PLAYWRIGHT_SERVICE_OS === 'linux')
|
||||
return 'linux';
|
||||
if (process.env.PLAYWRIGHT_SERVICE_OS === 'windows')
|
||||
return 'win32';
|
||||
if (process.env.PLAYWRIGHT_SERVICE_OS === 'macos')
|
||||
return 'darwin';
|
||||
return process.platform as 'win32' | 'darwin' | 'linux';
|
||||
}
|
||||
|
||||
export const platformTest = test.extend<{}, PlatformWorkerFixtures>({
|
||||
platform: [process.platform as 'win32' | 'darwin' | 'linux', { scope: 'worker' }],
|
||||
isWindows: [process.platform === 'win32', { scope: 'worker' }],
|
||||
isMac: [process.platform === 'darwin', { scope: 'worker' }],
|
||||
isLinux: [process.platform === 'linux', { scope: 'worker' }],
|
||||
platform: [platform(), { scope: 'worker' }],
|
||||
isWindows: [platform() === 'win32', { scope: 'worker' }],
|
||||
isMac: [platform() === 'darwin', { scope: 'worker' }],
|
||||
isLinux: [platform() === 'linux', { scope: 'worker' }],
|
||||
});
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ export async function verifyViewport(page: Page, width: number, height: number)
|
|||
expect(await page.evaluate('window.innerHeight')).toBe(height);
|
||||
}
|
||||
|
||||
export function expectedSSLError(browserName: string): string {
|
||||
export function expectedSSLError(browserName: string, platform: string): string {
|
||||
let expectedSSLError: string;
|
||||
if (browserName === 'chromium') {
|
||||
expectedSSLError = 'net::ERR_CERT_AUTHORITY_INVALID';
|
||||
} else if (browserName === 'webkit') {
|
||||
if (process.platform === 'darwin')
|
||||
if (platform === 'darwin')
|
||||
expectedSSLError = 'The certificate for this server is invalid';
|
||||
else if (process.platform === 'win32')
|
||||
else if (platform === 'win32')
|
||||
expectedSSLError = 'SSL peer certificate or SSH remote key was not OK';
|
||||
else
|
||||
expectedSSLError = 'Unacceptable TLS certificate';
|
||||
|
|
|
|||
|
|
@ -16,7 +16,8 @@
|
|||
|
||||
import { playwrightTest as it, expect } from '../../config/browserTest';
|
||||
|
||||
it('should pass firefox user preferences', async ({ browserType }) => {
|
||||
it('should pass firefox user preferences', async ({ browserType, mode }) => {
|
||||
it.skip(mode.startsWith('service'));
|
||||
const browser = await browserType.launch({
|
||||
firefoxUserPrefs: {
|
||||
'network.proxy.type': 1,
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ it('should have version and creator', async ({ contextFactory, server }, testInf
|
|||
const log = await getLog();
|
||||
expect(log.version).toBe('1.2');
|
||||
expect(log.creator.name).toBe('Playwright');
|
||||
expect(log.creator.version).toBe(process.env.PW_VERSION_OVERRIDE || require('../../package.json')['version']);
|
||||
expect(log.creator.version).toContain(process.env.PW_VERSION_OVERRIDE || require('../../package.json')['version']);
|
||||
});
|
||||
|
||||
it('should have browser', async ({ browserName, browser, contextFactory, server }, testInfo) => {
|
||||
|
|
@ -583,9 +583,10 @@ it('should have connection details', async ({ contextFactory, server, browserNam
|
|||
await page.goto(server.EMPTY_PAGE);
|
||||
const log = await getLog();
|
||||
const { serverIPAddress, _serverPort: port, _securityDetails: securityDetails } = log.entries[0];
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
if (!mode.startsWith('service'))
|
||||
if (!mode.startsWith('service')) {
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
expect(port).toBe(server.PORT);
|
||||
}
|
||||
expect(securityDetails).toEqual({});
|
||||
});
|
||||
|
||||
|
|
@ -597,9 +598,10 @@ it('should have security details', async ({ contextFactory, httpsServer, browser
|
|||
await page.goto(httpsServer.EMPTY_PAGE);
|
||||
const log = await getLog();
|
||||
const { serverIPAddress, _serverPort: port, _securityDetails: securityDetails } = log.entries[0];
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
if (!mode.startsWith('service'))
|
||||
if (!mode.startsWith('service')) {
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
expect(port).toBe(httpsServer.PORT);
|
||||
}
|
||||
if (browserName === 'webkit' && platform === 'darwin')
|
||||
expect(securityDetails).toEqual({ protocol: 'TLS 1.3', subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: 33086084863 });
|
||||
else
|
||||
|
|
@ -618,16 +620,16 @@ it('should have connection details for redirects', async ({ contextFactory, serv
|
|||
if (browserName === 'webkit') {
|
||||
expect(detailsFoo.serverIPAddress).toBeUndefined();
|
||||
expect(detailsFoo._serverPort).toBeUndefined();
|
||||
} else {
|
||||
} else if (!mode.startsWith('service')) {
|
||||
expect(detailsFoo.serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
if (!mode.startsWith('service'))
|
||||
expect(detailsFoo._serverPort).toBe(server.PORT);
|
||||
expect(detailsFoo._serverPort).toBe(server.PORT);
|
||||
}
|
||||
|
||||
const detailsEmpty = log.entries[1];
|
||||
expect(detailsEmpty.serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
if (!mode.startsWith('service'))
|
||||
if (!mode.startsWith('service')) {
|
||||
const detailsEmpty = log.entries[1];
|
||||
expect(detailsEmpty.serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
expect(detailsEmpty._serverPort).toBe(server.PORT);
|
||||
}
|
||||
});
|
||||
|
||||
it('should have connection details for failed requests', async ({ contextFactory, server, browserName, platform, mode }, testInfo) => {
|
||||
|
|
@ -638,18 +640,20 @@ it('should have connection details for failed requests', async ({ contextFactory
|
|||
const { page, getLog } = await pageWithHar(contextFactory, testInfo);
|
||||
await page.goto(server.PREFIX + '/one-style.html');
|
||||
const log = await getLog();
|
||||
const { serverIPAddress, _serverPort: port } = log.entries[0];
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
if (!mode.startsWith('service'))
|
||||
if (!mode.startsWith('service')) {
|
||||
const { serverIPAddress, _serverPort: port } = log.entries[0];
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
expect(port).toBe(server.PORT);
|
||||
}
|
||||
});
|
||||
|
||||
it('should return server address directly from response', async ({ page, server, mode }) => {
|
||||
const response = await page.goto(server.EMPTY_PAGE);
|
||||
const { ipAddress, port } = await response.serverAddr();
|
||||
expect(ipAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
if (!mode.startsWith('service'))
|
||||
if (!mode.startsWith('service')) {
|
||||
const { ipAddress, port } = await response.serverAddr();
|
||||
expect(ipAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
expect(port).toBe(server.PORT);
|
||||
}
|
||||
});
|
||||
|
||||
it('should return security details directly from response', async ({ contextFactory, httpsServer, browserName, platform }) => {
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ let connectOptions: any;
|
|||
if (mode === 'service')
|
||||
connectOptions = { wsEndpoint: 'ws://localhost:3333/' };
|
||||
if (mode === 'service2') {
|
||||
process.env.PW_VERSION_OVERRIDE = '1.36.0';
|
||||
process.env.PW_VERSION_OVERRIDE = '1.37';
|
||||
connectOptions = {
|
||||
wsEndpoint: `${process.env.PLAYWRIGHT_SERVICE_URL}?accessKey=${process.env.PLAYWRIGHT_SERVICE_ACCESS_KEY}&cap=${JSON.stringify({ os, runId })}`,
|
||||
timeout: 3 * 60 * 1000,
|
||||
|
|
|
|||
|
|
@ -137,30 +137,31 @@ test('should render console', async ({ showTraceViewer, browserName }) => {
|
|||
const traceViewer = await showTraceViewer([traceFile]);
|
||||
await traceViewer.showConsoleTab();
|
||||
|
||||
await expect(traceViewer.consoleLineMessages).toHaveText([
|
||||
'Info',
|
||||
'Warning',
|
||||
'Error',
|
||||
'Unhandled exception',
|
||||
'Cheers!'
|
||||
]);
|
||||
await expect(traceViewer.consoleLines.locator('.codicon')).toHaveClass([
|
||||
'codicon codicon-blank',
|
||||
'codicon codicon-warning',
|
||||
'codicon codicon-error',
|
||||
'codicon codicon-error',
|
||||
'codicon codicon-blank',
|
||||
]);
|
||||
await expect(traceViewer.consoleLineMessages.nth(0)).toHaveText('Info');
|
||||
await expect(traceViewer.consoleLineMessages.nth(1)).toHaveText('Warning');
|
||||
await expect(traceViewer.consoleLineMessages.nth(2)).toHaveText('Error');
|
||||
await expect(traceViewer.consoleLineMessages.nth(3)).toHaveText('Unhandled exception');
|
||||
// Firefox can insert layout error here.
|
||||
await expect(traceViewer.consoleLineMessages.last()).toHaveText('Cheers!');
|
||||
|
||||
const icons = traceViewer.consoleLines.locator('.codicon');
|
||||
await expect(icons.nth(0)).toHaveClass('codicon codicon-blank');
|
||||
await expect(icons.nth(1)).toHaveClass('codicon codicon-warning');
|
||||
await expect(icons.nth(2)).toHaveClass('codicon codicon-error');
|
||||
await expect(icons.nth(3)).toHaveClass('codicon codicon-error');
|
||||
// Firefox can insert layout error here.
|
||||
await expect(icons.last()).toHaveClass('codicon codicon-blank');
|
||||
await expect(traceViewer.consoleStacks.first()).toContainText('Error: Unhandled exception');
|
||||
|
||||
await traceViewer.selectAction('page.evaluate');
|
||||
await expect(traceViewer.page.locator('.console-tab').locator('.list-view-entry')).toHaveClass([
|
||||
'list-view-entry highlighted',
|
||||
'list-view-entry highlighted warning',
|
||||
'list-view-entry highlighted error',
|
||||
'list-view-entry highlighted error',
|
||||
'list-view-entry',
|
||||
]);
|
||||
|
||||
const listViews = traceViewer.page.locator('.console-tab').locator('.list-view-entry');
|
||||
await expect(listViews.nth(0)).toHaveClass('list-view-entry highlighted');
|
||||
await expect(listViews.nth(1)).toHaveClass('list-view-entry highlighted warning');
|
||||
await expect(listViews.nth(2)).toHaveClass('list-view-entry highlighted error');
|
||||
await expect(listViews.nth(3)).toHaveClass('list-view-entry highlighted error');
|
||||
// Firefox can insert layout error here.
|
||||
await expect(listViews.last()).toHaveClass('list-view-entry');
|
||||
});
|
||||
|
||||
test('should open console errors on click', async ({ showTraceViewer, browserName }) => {
|
||||
|
|
|
|||
|
|
@ -236,8 +236,9 @@ test('should respect tracesDir and name', async ({ browserType, server, mode },
|
|||
}
|
||||
});
|
||||
|
||||
test('should not include trace resources from the previous chunks', async ({ context, page, server, browserName }, testInfo) => {
|
||||
test('should not include trace resources from the previous chunks', async ({ context, page, server, browserName, mode }, testInfo) => {
|
||||
test.skip(browserName !== 'chromium', 'The number of screenshots is flaky in non-Chromium');
|
||||
test.skip(mode.startsWith('service'), 'The number of screenshots is flaky');
|
||||
await context.tracing.start({ screenshots: true, snapshots: true, sources: true });
|
||||
|
||||
await context.tracing.startChunk();
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ it('should reject when frame detaches', async ({ page, server, browserName }) =>
|
|||
expect(error.message.toLowerCase()).toContain('frame was detached');
|
||||
});
|
||||
|
||||
it('should continue after client redirect', async ({ page, server, isAndroid }) => {
|
||||
it('should continue after client redirect', async ({ page, server, isAndroid, mode }) => {
|
||||
it.fixme(isAndroid);
|
||||
|
||||
server.setRoute('/frames/script.js', () => {});
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ it('should close page with active dialog', async ({ page }) => {
|
|||
await page.close();
|
||||
});
|
||||
|
||||
it('should not accept after close', async ({ page }) => {
|
||||
it('should not accept after close', async ({ page, mode }) => {
|
||||
it.fixme(mode.startsWith('service2'), 'Times out');
|
||||
page.evaluate(() => alert()).catch(() => {});
|
||||
const dialog = await page.waitForEvent('dialog');
|
||||
await page.close();
|
||||
|
|
|
|||
|
|
@ -69,9 +69,10 @@ it('should report requests and responses handled by service worker', async ({ pa
|
|||
expect(await failedRequest.response()).toBe(null);
|
||||
});
|
||||
|
||||
it('should report requests and responses handled by service worker with routing', async ({ page, server, isAndroid, isElectron }) => {
|
||||
it('should report requests and responses handled by service worker with routing', async ({ page, server, isAndroid, isElectron, mode, platform }) => {
|
||||
it.fixme(isAndroid);
|
||||
it.fixme(isElectron);
|
||||
it.fixme(mode.startsWith('service') && platform === 'linux', 'Times out for no clear reason');
|
||||
|
||||
await page.route('**/*', route => route.continue());
|
||||
await page.goto(server.PREFIX + '/serviceworkers/fetchdummy/sw.html');
|
||||
|
|
|
|||
|
|
@ -263,7 +263,7 @@ it('should fail when navigating to bad url', async ({ mode, page, browserName })
|
|||
expect(error.message).toContain('Invalid url');
|
||||
});
|
||||
|
||||
it('should fail when navigating to bad SSL', async ({ page, browserName, httpsServer }) => {
|
||||
it('should fail when navigating to bad SSL', async ({ page, browserName, httpsServer, platform }) => {
|
||||
// Make sure that network events do not emit 'undefined'.
|
||||
// @see https://crbug.com/750469
|
||||
page.on('request', request => expect(request).toBeTruthy());
|
||||
|
|
@ -271,15 +271,15 @@ 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));
|
||||
expect(error.message).toContain(expectedSSLError(browserName, platform));
|
||||
});
|
||||
|
||||
it('should fail when navigating to bad SSL after redirects', async ({ page, browserName, server, httpsServer }) => {
|
||||
it('should fail when navigating to bad SSL after redirects', async ({ page, browserName, server, httpsServer, platform }) => {
|
||||
server.setRedirect('/redirect/1.html', '/redirect/2.html');
|
||||
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));
|
||||
expect(error.message).toContain(expectedSSLError(browserName, platform));
|
||||
});
|
||||
|
||||
it('should not crash when navigating to bad SSL after a cross origin navigation', async ({ page, server, httpsServer }) => {
|
||||
|
|
@ -307,6 +307,8 @@ it('should fail when main resources failed to load', async ({ page, browserName,
|
|||
expect(error.message).toContain('net::ERR_SOCKS_CONNECTION_FAILED');
|
||||
else
|
||||
expect(error.message).toContain('net::ERR_CONNECTION_REFUSED');
|
||||
} else if (browserName === 'webkit' && isWindows && mode === 'service2') {
|
||||
expect(error.message).toContain(`proxy handshake error`);
|
||||
} else if (browserName === 'webkit' && isWindows) {
|
||||
expect(error.message).toContain(`Couldn\'t connect to server`);
|
||||
} else if (browserName === 'webkit') {
|
||||
|
|
|
|||
|
|
@ -82,14 +82,14 @@ it('should work with clicking on anchor links', async ({ page, server }) => {
|
|||
expect(page.url()).toBe(server.EMPTY_PAGE + '#foobar');
|
||||
});
|
||||
|
||||
it('should work with clicking on links which do not commit navigation', async ({ page, server, httpsServer, browserName }) => {
|
||||
it('should work with clicking on links which do not commit navigation', async ({ page, server, httpsServer, browserName, platform }) => {
|
||||
await page.goto(server.EMPTY_PAGE);
|
||||
await page.setContent(`<a href='${httpsServer.EMPTY_PAGE}'>foobar</a>`);
|
||||
const [error] = await Promise.all([
|
||||
page.waitForNavigation().catch(e => e),
|
||||
page.click('a'),
|
||||
]);
|
||||
expect(error.message).toContain(expectedSSLError(browserName));
|
||||
expect(error.message).toContain(expectedSSLError(browserName, platform));
|
||||
});
|
||||
|
||||
it('should work with history.pushState()', async ({ page, server }) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue