Skip to content

test(e2e): cover navbar Logout flow as proxy admin - #29076

Merged
yuneng-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_e2e_logout
May 29, 2026
Merged

test(e2e): cover navbar Logout flow as proxy admin#29076
yuneng-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_e2e_logout

Conversation

@ryan-crabbe-berri

@ryan-crabbe-berri ryan-crabbe-berri commented May 27, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds an e2e test for the previously-uncovered manual-QA item "Click Logout". The test opens the navbar User dropdown, clicks Logout, then navigates to a protected page and asserts the redirect to /ui/login — proving the session cookie was cleared.

Uses the same synthetic-hover trick as login.spec.ts because antd's dropdown trigger closes on cursor movement between Playwright actions.

Test plan

  • e2e_tests/tests/auth/logout.spec.ts::Clicking Logout clears the session and forces re-login on a protected page

Refs LIT-3093

The Logout button under the navbar User dropdown was an uncovered
manual-QA step. This test signs in as admin, opens the dropdown,
clicks Logout, then navigates to a protected page and asserts the
redirect to /ui/login — proving the session was cleared.
@greptile-apps

greptile-apps Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a Playwright e2e test that verifies the Logout button in the navbar UserDropdown clears the session cookie and forces re-login when visiting a protected page. The previous issues identified in review (wrong button text selector, synthetic-hover trick against a click-triggered dropdown) have been corrected: the button is now located via its aria-label and opened with a plain .click().

  • The aria-label selector page.getByRole(\"button\", { name: /Account menu/i }) correctly targets the <Button aria-label=\"Account menu — ...\"> rendered by UserDropdown.tsx.
  • The popup filter .bg-white.rounded-lg.shadow-lg aligns with the popupRender div in UserDropdown.tsx and should match reliably.
  • One minor sequencing concern: after clicking Logout, window.location.href = \"\" queues a same-page reload; calling page.goto immediately after the click races against that reload, though the final assertion still passes in both orderings because the cookies are cleared synchronously first.

Confidence Score: 5/5

Safe to merge — this is a new test-only file that adds no production code changes.

The change is a single new e2e spec file. The prior review's blocking concerns (wrong button selector, synthetic hover on a click-triggered dropdown) have both been corrected. The test correctly uses the aria-label selector and a plain click to open the antd Dropdown, and clearTokenCookies runs synchronously before any navigation, so the redirect assertion is sound.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/e2e_tests/tests/auth/logout.spec.ts New e2e test for logout flow; selector and trigger mechanism look correct after addressing prior review comments; one concern around intermediate navigation state after clicking Logout

Reviews (2): Last reviewed commit: "test(e2e): fix logout dropdown trigger a..." | Re-trigger Greptile

Comment thread ui/litellm-dashboard/e2e_tests/tests/auth/logout.spec.ts Outdated
Comment thread ui/litellm-dashboard/e2e_tests/tests/auth/logout.spec.ts Outdated
@codecov

codecov Bot commented May 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

The button never rendered the literal text "User" (it shows initials +
display name), and the antd Dropdown uses trigger={["click"]}, so the
synthetic mouseover/mouseenter never opened the popup. Open it with a real
click on the button's aria-label ("Account menu — ...").
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@yuneng-berri
yuneng-berri merged commit 5eafe1c into litellm_internal_staging May 29, 2026
118 of 122 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
* test(e2e): cover navbar Logout flow as proxy admin

The Logout button under the navbar User dropdown was an uncovered
manual-QA step. This test signs in as admin, opens the dropdown,
clicks Logout, then navigates to a protected page and asserts the
redirect to /ui/login — proving the session was cleared.

* test(e2e): fix logout dropdown trigger and account-menu selector

The button never rendered the literal text "User" (it shows initials +
display name), and the antd Dropdown uses trigger={["click"]}, so the
synthetic mouseover/mouseenter never opened the popup. Open it with a real
click on the button's aria-label ("Account menu — ...").
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants