Skip to content

test(e2e): assert internal-user navbar identity is scoped to that user - #29077

Merged
ryan-crabbe-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_e2e_internal_user_navbar_identity
May 30, 2026
Merged

test(e2e): assert internal-user navbar identity is scoped to that user#29077
ryan-crabbe-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_e2e_internal_user_navbar_identity

Conversation

@ryan-crabbe-berri

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

Copy link
Copy Markdown
Contributor

Summary

Adds the symmetric e2e check to the existing admin login test — verifying that signing in as an internal user surfaces their email / user_id / role in the navbar account button and dropdown, and that no admin-scoped values leak through. This covers the previously-uncovered manual-QA step "Sign in as the new user — UI should load only info for the new internal user (not Proxy Admin)".

Test plan

  • e2e_tests/tests/login/internalUserIdentity.spec.ts::Internal user navbar dropdown shows their own role and user id, not the admin's

Refs LIT-3093

The existing login.spec.ts only checks the admin's navbar identity.
This adds the symmetric check for the internal user — verifying the
account button + dropdown surface the internal user's email, id, and
role, and that no admin-scoped values leak through.
@greptile-apps

greptile-apps Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds a Playwright e2e test that verifies an internal user's session is correctly scoped in the navbar — confirming their own email, user ID, and role appear in the account button's aria-label and the dropdown panel, while the seeded proxy-admin's identifiers are absent. A companion one-line change adds data-testid="user-dropdown-panel" to UserDropdown.tsx so the test can locate the panel without coupling to Ant Design or Tailwind class names.

  • New e2e spec (internalUserIdentity.spec.ts): loads the internal-user session, asserts positive identity (email, user ID, "Internal User" role) in both the button's aria-label and the dropdown panel, and asserts the admin's email/user ID have count 0 in the panel.
  • Constants (constants.ts): exports four new identity constants keyed to seed.sql values, shared across current and future identity-scoping tests.
  • UserDropdown.tsx: adds data-testid="user-dropdown-panel" to the popupRender wrapper; no behaviour change.

Confidence Score: 5/5

Safe to merge — all changes are additive (new test + one data-testid attribute) with no runtime behaviour change.

The production code change is a single data-testid attribute on a non-interactive wrapper div, which has no effect on rendering or logic. The new e2e spec is purely additive, well-scoped to the internal-user session, and correctly uses positive and negative assertions against a stable test-id locator.

No files require special attention.

Important Files Changed

Filename Overview
ui/litellm-dashboard/e2e_tests/constants.ts Adds four new exported constants for seeded proxy-admin and internal-user identities (email + user ID), clearly annotated to match seed.sql.
ui/litellm-dashboard/e2e_tests/tests/login/internalUserIdentity.spec.ts New Playwright e2e spec; verifies navbar aria-label and dropdown panel show the internal user's email/ID/role and confirm no proxy-admin values leak through. Uses data-testid locator to avoid fragile class-name selectors.
ui/litellm-dashboard/src/components/Navbar/UserDropdown/UserDropdown.tsx Minimal one-attribute change: adds data-testid="user-dropdown-panel" to the popupRender wrapper div so tests can locate it without coupling to Ant Design or Tailwind class names.

Reviews (2): Last reviewed commit: "test(e2e): harden navbar identity test p..." | Re-trigger Greptile

Comment thread ui/litellm-dashboard/e2e_tests/tests/login/internalUserIdentity.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!

Locate the user dropdown panel by a data-testid on the popupRender div
instead of Ant Design internal + Tailwind class names, so styling
refactors no longer risk breaking the identity-scoping assertions.
Source the seeded user emails/ids from shared constants (match seed.sql)
instead of hardcoding them inline.
@ryan-crabbe-berri

Copy link
Copy Markdown
Contributor Author

@greptileai re review

@ryan-crabbe-berri
ryan-crabbe-berri merged commit 37e6e2d into litellm_internal_staging May 30, 2026
104 of 118 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
BerriAI#29077)

* test(e2e): assert internal-user navbar identity is scoped to that user

The existing login.spec.ts only checks the admin's navbar identity.
This adds the symmetric check for the internal user — verifying the
account button + dropdown surface the internal user's email, id, and
role, and that no admin-scoped values leak through.

* test(e2e): harden navbar identity test per review feedback

Locate the user dropdown panel by a data-testid on the popupRender div
instead of Ant Design internal + Tailwind class names, so styling
refactors no longer risk breaking the identity-scoping assertions.
Source the seeded user emails/ids from shared constants (match seed.sql)
instead of hardcoding them inline.
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