test: fix client-certificates tests on Windows (#31750)

This commit is contained in:
Max Schmitt 2024-07-18 13:43:56 +02:00 committed by GitHub
parent e78ce8521d
commit 453e3bdf9d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 3 deletions

View File

@ -661,7 +661,7 @@ export function assertBrowserContextIsNotOwned(context: BrowserContext) {
export async function createClientCertificatesProxyIfNeeded(options: channels.BrowserNewContextOptions, browserOptions?: BrowserOptions) {
if (!options.clientCertificates?.length)
return;
if (options.proxy?.server || browserOptions?.proxy?.server)
if ((options.proxy?.server && options.proxy?.server !== 'per-context') || (browserOptions?.proxy?.server && browserOptions?.proxy?.server !== 'http://per-context'))
throw new Error('Cannot specify both proxy and clientCertificates');
verifyClientCertificates(options.clientCertificates);
const clientCertificatesProxy = new ClientCertificatesProxy(options);

View File

@ -56,6 +56,15 @@ const test = base.extend<{ serverURL: string, serverURLRewrittenToLocalhost: str
}
});
test.use({
launchOptions: async ({ launchOptions }, use) => {
await use({
...launchOptions,
proxy: { server: 'per-context' }
});
}
});
test.skip(({ mode }) => mode !== 'default');
const kDummyFileName = __filename;
@ -174,8 +183,6 @@ test.describe('fetch', () => {
test.describe('browser', () => {
test.skip(({ browserName, platform, browserMajorVersion }) => browserName === 'chromium' && platform === 'win32' && browserMajorVersion < 128, 'Depends on https://chromium-review.googlesource.com/c/chromium/src/+/5688851');
test('validate input', async ({ browser }) => {
for (const [contextOptions, expected] of kValidationSubTests)
await expect(browser.newContext(contextOptions)).rejects.toThrow(expected);