Repository navigation
test(e2e): cover PROXY_LOGOUT_URL redirect on Logout - #29080
Conversation
Env-gated spec mirroring the existing serverRootPathRedirect pattern: when the proxy is booted with PROXY_LOGOUT_URL set, clicking Logout in the navbar must navigate to that external URL. The standard run_e2e.sh exports an empty value so the rest of the suite is unaffected; this spec self-skips unless the env var is populated.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Greptile SummaryThis PR adds an env-gated Playwright e2e test covering the
Confidence Score: 5/5Pure test infrastructure change — no production code touched; the new spec is well-guarded and the environment changes are correctly scoped. All three changed files are test/CI infrastructure. The spec correctly addresses the two issues raised in the previous review cycle (async timing and Ant Design selector fragility). No production logic is modified. No files require special attention.
|
| Filename | Overview |
|---|---|
| ui/litellm-dashboard/e2e_tests/tests/auth/proxyLogoutUrl.spec.ts | New Playwright e2e test for PROXY_LOGOUT_URL redirect; correctly addresses both previous review issues (timing race and fragile Ant Design selector). Uses waitForResponse to gate logout click on settings fetch, role-based locators, route interception to stub external host, and parallel waitForURL+click to capture the redirect. |
| ui/litellm-dashboard/e2e_tests/run_e2e.sh | Changes PROXY_LOGOUT_URL from "" to "https://www.example.com" so local suite runs proxyLogoutUrl.spec.ts by default; the comment explicitly acknowledges the suite-wide behavioral change. |
| .circleci/config.yml | Promotes PROXY_LOGOUT_URL to job-level environment and removes the conflicting step-level override so the proxy boot step and Playwright step both see the same value. |
Reviews (2): Last reviewed commit: "test(e2e): run PROXY_LOGOUT_URL spec in ..." | Re-trigger Greptile
…ertions Boot the e2e proxy with PROXY_LOGOUT_URL set (job-level env in CircleCI and run_e2e.sh) so proxyLogoutUrl.spec.ts actually runs instead of self-skipping. Nothing else in the suite performs a logout, so this only affects the behavior under test. Harden the spec to verify the logout flow rather than a URL substring: - wait for /sso/get/ui_settings before clicking so logoutUrl is populated (otherwise window.location.href = "" silently reloads same-origin) - assert a token cookie exists first, and is cleared after logout - locate the dropdown via getByRole instead of internal antd CSS classes - stub the external destination and assert on URL origin + path prefix
|
@greptileai rereview |
Replace the origin + startsWith(pathname) checks with a single normalized href comparison. With PROXY_LOGOUT_URL=https://www.example.com the path was "/", so startsWith("/") matched any path and left path/query/hash unchecked. Comparing normalized hrefs pins scheme, host, port, path, query and hash while still tolerating the browser's trailing-slash/default-port normalization.
…itellm_e2e_proxy_logout_url
a9cc6ed
into
litellm_internal_staging
* test(e2e): cover PROXY_LOGOUT_URL redirect on Logout Env-gated spec mirroring the existing serverRootPathRedirect pattern: when the proxy is booted with PROXY_LOGOUT_URL set, clicking Logout in the navbar must navigate to that external URL. The standard run_e2e.sh exports an empty value so the rest of the suite is unaffected; this spec self-skips unless the env var is populated. * test(e2e): run PROXY_LOGOUT_URL spec in the suite + harden logout assertions Boot the e2e proxy with PROXY_LOGOUT_URL set (job-level env in CircleCI and run_e2e.sh) so proxyLogoutUrl.spec.ts actually runs instead of self-skipping. Nothing else in the suite performs a logout, so this only affects the behavior under test. Harden the spec to verify the logout flow rather than a URL substring: - wait for /sso/get/ui_settings before clicking so logoutUrl is populated (otherwise window.location.href = "" silently reloads same-origin) - assert a token cookie exists first, and is cleared after logout - locate the dropdown via getByRole instead of internal antd CSS classes - stub the external destination and assert on URL origin + path prefix * test(e2e): assert exact PROXY_LOGOUT_URL on logout redirect Replace the origin + startsWith(pathname) checks with a single normalized href comparison. With PROXY_LOGOUT_URL=https://www.example.com the path was "/", so startsWith("/") matched any path and left path/query/hash unchecked. Comparing normalized hrefs pins scheme, host, port, path, query and hash while still tolerating the browser's trailing-slash/default-port normalization.
Summary
Adds an e2e test for the previously-uncovered manual-QA item "Set
PROXY_LOGOUT_URL, click Logout, confirm redirect to that URL".Both
run_e2e.shand the CircleCIe2e_ui_testingjob now boot the proxy withPROXY_LOGOUT_URL=https://www.example.comand export the same value to the Playwright process, so this spec runs as part of the standard suite. It self-skips ifPROXY_LOGOUT_URLis empty (e.g. an ad-hocnpx playwright testagainst a default proxy), so the contract is only asserted when there is a logout target to check.What the test verifies:
tokencookie)./sso/get/ui_settingsfetch so the navbar logout target is populated before clicking (avoids a same-origin reload from an emptywindow.location.href).PROXY_LOGOUT_URLvia a normalizedhrefcomparison — pins scheme, host, port, path, query and hash (not just origin), while tolerating the browser's trailing-slash/default-port normalization.tokencookie is cleared on logout.The external logout destination is stubbed via
page.routeso the assertion does not depend on that host being reachable from CI — we only care that the browser is sent there.Test plan
e2e_tests/tests/auth/proxyLogoutUrl.spec.ts::Logout clears the session and redirects to PROXY_LOGOUT_URLruns in the standard suite whenPROXY_LOGOUT_URLis set; self-skips otherwise.Refs LIT-3093