mirror of
https://github.com/microsoft/playwright.git
synced 2025-06-26 21:40:17 +00:00
test: fix CR proxy tests on Windows (#7675)
This commit is contained in:
parent
d03a54da64
commit
d5bb8a327b
@ -21,11 +21,17 @@ it.use({ proxy: { server: 'per-context' } });
|
||||
it('should throw for missing global proxy on Chromium Windows', async ({ browserName, platform, browserType, browserOptions, server }) => {
|
||||
it.skip(browserName !== 'chromium' || platform !== 'win32');
|
||||
|
||||
delete browserOptions.proxy;
|
||||
const browser = await browserType.launch(browserOptions);
|
||||
let browser;
|
||||
try {
|
||||
browser = await browserType.launch({
|
||||
...browserOptions,
|
||||
proxy: undefined,
|
||||
});
|
||||
const error = await browser.newContext({ proxy: { server: `localhost:${server.PORT}` } }).catch(e => e);
|
||||
expect(error.toString()).toContain('Browser needs to be launched with the global proxy');
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
});
|
||||
|
||||
it('should work when passing the proxy only on the context level', async ({browserName, platform, browserType, browserOptions, contextOptions, server}) => {
|
||||
@ -36,8 +42,12 @@ it('should work when passing the proxy only on the context level', async ({brows
|
||||
server.setRoute('/target.html', async (req, res) => {
|
||||
res.end('<html><title>Served by the proxy</title></html>');
|
||||
});
|
||||
delete browserOptions.proxy;
|
||||
const browser = await browserType.launch(browserOptions);
|
||||
let browser;
|
||||
try {
|
||||
browser = await browserType.launch({
|
||||
...browserOptions,
|
||||
proxy: undefined,
|
||||
});
|
||||
const context = await browser.newContext({
|
||||
...contextOptions,
|
||||
proxy: { server: `localhost:${server.PORT}` }
|
||||
@ -46,7 +56,9 @@ it('should work when passing the proxy only on the context level', async ({brows
|
||||
const page = await context.newPage();
|
||||
await page.goto('http://non-existent.com/target.html');
|
||||
expect(await page.title()).toBe('Served by the proxy');
|
||||
} finally {
|
||||
await browser.close();
|
||||
}
|
||||
});
|
||||
|
||||
it('should throw for bad server value', async ({ contextFactory }) => {
|
||||
|
||||
@ -381,6 +381,7 @@ it('should have connection details', async ({ contextFactory, server, browserNam
|
||||
|
||||
it('should have security details', async ({ contextFactory, httpsServer, browserName, platform }, testInfo) => {
|
||||
it.fail(browserName === 'webkit' && platform === 'linux', 'https://github.com/microsoft/playwright/issues/6759');
|
||||
it.fail(browserName === 'webkit' && platform === 'win32');
|
||||
|
||||
const { page, getLog } = await pageWithHar(contextFactory, testInfo);
|
||||
await page.goto(httpsServer.EMPTY_PAGE);
|
||||
@ -388,9 +389,7 @@ it('should have security details', async ({ contextFactory, httpsServer, browser
|
||||
const { serverIPAddress, _serverPort: port, _securityDetails: securityDetails } = log.entries[0];
|
||||
expect(serverIPAddress).toMatch(/^127\.0\.0\.1|\[::1\]/);
|
||||
expect(port).toBe(httpsServer.PORT);
|
||||
if (browserName === 'webkit' && platform === 'win32')
|
||||
expect(securityDetails).toEqual({subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: -1});
|
||||
else if (browserName === 'webkit')
|
||||
if (browserName === 'webkit' && platform === 'darwin')
|
||||
expect(securityDetails).toEqual({protocol: 'TLS 1.3', subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: 33086084863});
|
||||
else
|
||||
expect(securityDetails).toEqual({issuer: 'puppeteer-tests', protocol: 'TLS 1.3', subjectName: 'puppeteer-tests', validFrom: 1550084863, validTo: 33086084863});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user