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-certificate tests (#32691)

Max Schmitt61cbca6695f6
diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts
index 4981d5cad7..5f0321526a 100644
--- a/tests/library/client-certificates.spec.ts
+++ b/tests/library/client-certificates.spec.ts
@@ -365,7 +365,8 @@ test.describe('browser', () => {
});
expect(proxyServer.connectHosts).toEqual([]);
await page.goto(serverURL);
- expect([...new Set(proxyServer.connectHosts)]).toEqual([`127.0.0.1:${new URL(serverURL).port}`]);
+ const host = browserName === 'webkit' && process.platform === 'darwin' ? 'localhost' : '127.0.0.1';
+ expect([...new Set(proxyServer.connectHosts)]).toEqual([`${host}:${new URL(serverURL).port}`]);
await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
await page.close();
});
@@ -389,7 +390,8 @@ test.describe('browser', () => {
});
expect(connectHosts).toEqual([]);
await page.goto(serverURL);
- expect(connectHosts).toEqual([`127.0.0.1:${serverPort}`]);
+ const host = browserName === 'webkit' && process.platform === 'darwin' ? 'localhost' : '127.0.0.1';
+ expect(connectHosts).toEqual([`${host}:${serverPort}`]);
await expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
await page.close();
await closeProxyServer();