test: fix client-certificate tests

This commit is contained in:
Max Schmitt 2024-09-18 18:04:03 +02:00
parent 48030a4eff
commit 129a45d2a5

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();