Skip to content

Commit ccfed25

Browse files
committed
test: derive expected scheme from page protocol in server-url e2e
The normalization test hardcoded https://127.0.0.1:9, which only holds on the HTTPS dev server. The Docker E2E runs over HTTP, where normalizeServerUrl correctly produces http://127.0.0.1:9 (it adopts the page's protocol — the mixed-content fix), so the test failed in CI. Derive the expected scheme from page.url() so it's correct on both HTTP and HTTPS. https://claude.ai/code/session_01EeGweBeouxSsT6nSaXy8Pk
1 parent ee4c7d1 commit ccfed25

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

web/e2e/auth.spec.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ test('server settings tests and connects to the default (reverse proxy)', async
3030
})
3131

3232
test('server settings normalizes a scheme-less host using the page protocol', async ({ page }) => {
33-
// The dev server is served over HTTPS, so a bare host must become https://
34-
// (coercing to http:// would be blocked as mixed content on an HTTPS page).
33+
// A bare host must adopt the page's own scheme (https on an HTTPS page, http on
34+
// an HTTP one) — coercing to a fixed scheme would risk mixed-content blocking.
35+
// The dev server runs over HTTPS and the Docker E2E over HTTP, so derive it.
3536
await page.goto('/login')
37+
const expected = `${new URL(page.url()).protocol}//127.0.0.1:9`
3638
await page.getByRole('button', { name: /server settings/i }).click()
3739
await page.getByPlaceholder('Leave blank to use this site').fill('127.0.0.1:9')
3840
await page.getByRole('button', { name: /test & save/i }).click()
39-
await expect(page.getByText('Current: https://127.0.0.1:9')).toBeVisible()
40-
expect(await page.evaluate(() => localStorage.getItem('server_url'))).toBe('https://127.0.0.1:9')
41+
await expect(page.getByText(`Current: ${expected}`)).toBeVisible()
42+
expect(await page.evaluate(() => localStorage.getItem('server_url'))).toBe(expected)
4143
})

0 commit comments

Comments
 (0)