Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

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

Max Schmitt453e3bdf9d88
diff --git a/packages/playwright-core/src/server/browserContext.ts b/packages/playwright-core/src/server/browserContext.ts
index b67771fe9a..45ecfb4dc1 100644
--- a/packages/playwright-core/src/server/browserContext.ts
+++ b/packages/playwright-core/src/server/browserContext.ts
@@ -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);
diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts
index b22ad12d97..585a4f5fe3 100644
--- a/tests/library/client-certificates.spec.ts
+++ b/tests/library/client-certificates.spec.ts
@@ -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);