From 0961e8a07dcaa74b25aa0cb9e0d3b3c35b4b2faa Mon Sep 17 00:00:00 2001 From: Dmitry Gozman Date: Tue, 6 Oct 2026 15:15:38 +0100 Subject: [PATCH] test(client-certificates): accept 503 when server resets after handshake The server's rejection of the client certificate after the TLS 1.3 handshake arrives at the proxy either as a clean close or as ECONNRESET, depending on timing and platform. The latter makes the proxy serve its 503 error page, so the test should accept both outcomes. --- tests/library/client-certificates.spec.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/library/client-certificates.spec.ts b/tests/library/client-certificates.spec.ts index be946e0a7366d..6e14caff8e95f 100644 --- a/tests/library/client-certificates.spec.ts +++ b/tests/library/client-certificates.spec.ts @@ -404,8 +404,15 @@ test.describe('browser', () => { keyPath: asset('client-certificates/client/self-signed/key.pem'), }], }); - const error = await page.goto(serverURL).catch(e => e); - expect(error.message).toMatch(/net::ERR_EMPTY_RESPONSE|NS_ERROR_NET_RESET|Connection terminated unexpectedly|The network connection was lost/); + const result = await page.goto(serverURL).catch(e => e); + if (result instanceof Error) { + // The server closed the connection with FIN after the TLS handshake. + expect(result.message).toMatch(/net::ERR_EMPTY_RESPONSE|NS_ERROR_NET_RESET|Connection terminated unexpectedly|The network connection was lost/); + } else { + // The server reset the connection, which the proxy reports as a client certificate error. + expect(result.status()).toBe(503); + await expect(page.getByText('Playwright client-certificate error')).toBeVisible(); + } await page.close(); });