Files
orca/tests/e2e/network-proxy-bypass-rules.spec.ts
T

42 lines
1.6 KiB
TypeScript

import { test, expect } from './helpers/orca-app'
import { waitForSessionReady } from './helpers/store'
test.describe('network proxy bypass rules', () => {
test('preserves newline-separated hosts and canonicalizes them on blur', async ({ orcaPage }) => {
await waitForSessionReady(orcaPage)
const original = await orcaPage.evaluate(() => window.api.settings.get())
try {
await orcaPage.evaluate(() => {
const state = window.__store?.getState()
state?.openSettingsTarget({ pane: 'advanced', repoId: null })
state?.openSettingsPage()
})
await expect(orcaPage.getByRole('heading', { name: 'Advanced', exact: true })).toBeVisible()
await orcaPage.getByRole('button', { name: 'Configure proxy' }).click()
const bypassRules = orcaPage.locator('#settings-http-proxy-bypass-rules')
await expect(bypassRules).toBeVisible()
await expect(bypassRules).toHaveJSProperty('tagName', 'TEXTAREA')
await bypassRules.fill('localhost\n127.0.0.1\n*.internal.corp')
await expect(bypassRules).toHaveValue('localhost\n127.0.0.1\n*.internal.corp')
await orcaPage.locator('#settings-http-proxy-url').focus()
await expect
.poll(
async () =>
(await orcaPage.evaluate(() => window.api.settings.get())).httpProxyBypassRules
)
.toBe('localhost;127.0.0.1;*.internal.corp')
await expect(bypassRules).toHaveValue('localhost;127.0.0.1;*.internal.corp')
} finally {
await orcaPage.evaluate(
(settings) =>
window.api.settings.set({ httpProxyBypassRules: settings.httpProxyBypassRules ?? '' }),
original
)
}
})
})