Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ tunnel: { tunnelIdentifier: process.env.TB_TUNNEL_ID, start: false }

The tunnel needs Java (17 for tunnel 5.0, 11 for older versions).

**HTTPS through the tunnel.** By default TestingBot Tunnel decrypts HTTPS (SSL bumping) with a TestingBot certificate. The Playwright browsers on TestingBot do not trust that certificate, so `https://` sites fail with `ERR_CERT_AUTHORITY_INVALID`. This package therefore starts the tunnel with `noBump: true` unless you set `noBump` yourself. If you need bumping (for example for a site with a self-signed certificate), pass `noBump: false` and set `ignoreHTTPSErrors: true` in `use`.
**HTTPS through the tunnel.** TestingBot Tunnel decrypts HTTPS (SSL bumping) with a TestingBot certificate, and the Playwright browsers on TestingBot trust that certificate in tunnel sessions. Firefox only does so with Playwright 1.53 or later; on older versions pass `noBump: true` to forward HTTPS untouched.

You can also use the setup on its own:

Expand Down
3 changes: 0 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,6 @@ export function withTestingBot<T = {}, W = {}>(config: PlaywrightTestConfig<T, W
let tunnelMetadata: TestingBotMetadata['tunnel'] = false
if (options.tunnel) {
const { start = true, ...tunnelOptions } = options.tunnel === true ? {} : options.tunnel
// Playwright browsers do not trust the tunnel's SSL-bumping CA, so HTTPS sites would fail
// with ERR_CERT_AUTHORITY_INVALID. Forward HTTPS untouched unless asked otherwise.
if (tunnelOptions.noBump === undefined) tunnelOptions.noBump = true
tunnelIdentifier = (tunnelOptions.tunnelIdentifier as string | undefined) ?? stable(env, TUNNEL_IDENTIFIER_ENV, () => generateTunnelIdentifier())
if (start) tunnelMetadata = { ...tunnelOptions, tunnelIdentifier }
}
Expand Down
9 changes: 5 additions & 4 deletions test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe('withTestingBot', () => {
expect(id).toMatch(/^playwright-/)
expect(e.TESTINGBOT_PLAYWRIGHT_TUNNEL_IDENTIFIER).toBe(id)
expect(config.globalSetup).toEqual([path.join(__dirname, '..', 'src', 'global-setup.js'), './my-setup.ts'])
expect((config.metadata as any).testingbot.tunnel).toEqual({ verbose: true, noBump: true, tunnelIdentifier: id })
expect((config.metadata as any).testingbot.tunnel).toEqual({ verbose: true, tunnelIdentifier: id })
expect(decodeCapabilities(use(config.projects![0]).connectOptions.wsEndpoint)['tb:options'].tunnelIdentifier).toBe(id)
// Same identifier when the config is loaded again in a worker.
expect(use(withTestingBot({}, { env: e, tunnel: true }).projects![0]).testingbot.tunnelIdentifier).toBe(id)
Expand All @@ -105,9 +105,10 @@ describe('withTestingBot', () => {
expect((config.metadata as any).testingbot.tunnel).toBe(false)
})

it('keeps noBump when set explicitly', () => {
const config = withTestingBot({}, { env: env(), tunnel: { noBump: false } })
expect((config.metadata as any).testingbot.tunnel.noBump).toBe(false)
it('leaves SSL bumping to the tunnel unless noBump is set', () => {
expect((withTestingBot({}, { env: env(), tunnel: true }).metadata as any).testingbot.tunnel).not.toHaveProperty('noBump')
const config = withTestingBot({}, { env: env(), tunnel: { noBump: true } })
expect((config.metadata as any).testingbot.tunnel.noBump).toBe(true)
})

it('adds the reporter after the configured reporters', () => {
Expand Down
Loading