test: fix client-certificate tests (#32691)

This commit is contained in:
Max Schmitt 2024-09-19 12:03:05 +02:00 committed by GitHub
parent 48030a4eff
commit 61cbca6695
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -365,7 +365,8 @@ test.describe('browser', () => {
}); });
expect(proxyServer.connectHosts).toEqual([]); expect(proxyServer.connectHosts).toEqual([]);
await page.goto(serverURL); 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 expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
await page.close(); await page.close();
}); });
@ -389,7 +390,8 @@ test.describe('browser', () => {
}); });
expect(connectHosts).toEqual([]); expect(connectHosts).toEqual([]);
await page.goto(serverURL); 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 expect(page.getByTestId('message')).toHaveText('Hello Alice, your certificate was issued by localhost!');
await page.close(); await page.close();
await closeProxyServer(); await closeProxyServer();