Skip to content

test(e2e): cover Internal User create-key flow when in no teams#29083

Merged
ryan-crabbe-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_e2e_internal_user_no_team
May 30, 2026
Merged

test(e2e): cover Internal User create-key flow when in no teams#29083
ryan-crabbe-berri merged 3 commits into
litellm_internal_stagingfrom
litellm_e2e_internal_user_no_team

Conversation

@ryan-crabbe-berri

Copy link
Copy Markdown
Collaborator

Summary

Adds the last uncovered manual-QA item — "Create Key Flow: Internal User with no personal models and not in any team". The seeded e2e-internal-user is in two teams, so the empty-team-dropdown branch was unreachable. This PR seeds a new [email protected] user (no team memberships) and adds a spec that logs in fresh, opens the Create Key modal, and asserts the team dropdown has zero options.

Logs in inside the test rather than reusing a storage state because adding this user to the Role enum / globalSetup / STORAGE_PATHS for a single assertion isn't worth the maintenance cost.

Test plan

  • e2e_tests/tests/internal-user/internalUserNoTeam.spec.ts::Create Key team dropdown is empty when the user belongs to no teams

Refs LIT-3093

The seeded e2e-internal-user is in two teams, so the "no team" branch
of the Create Key modal — where the team dropdown must render empty —
was unreachable. Seeds a [email protected] user and adds a spec that
logs in fresh, opens the modal, and asserts the dropdown has zero
options.
@greptile-apps

greptile-apps Bot commented May 27, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR closes the last uncovered manual-QA scenario for the Create Key flow: an internal user with no team memberships. It seeds a [email protected] user, adds a spec that logs in fresh and asserts the team dropdown shows "No teams found" with zero options, and adds a differential partner spec (internalUserWithTeams) that asserts the seeded two-team user sees exactly two options — preventing the zero-count assertion from passing vacuously if the Playwright role query stops matching.

  • seed.sql: New e2e-internal-noteam row with an empty teams array and no LiteLLM_TeamMembership entries — correctly models the no-team state without polluting the membership table.
  • internalUserNoTeam.spec.ts: Anchors on the "No teams found" loading-settled text before asserting toHaveCount(0), avoiding the transient-empty race flagged in the previous review round.
  • internalUserWithTeams.spec.ts: Paired differential test using the existing stored session; the toHaveCount(2) assertion validates that getByRole("option") actually locates Ant Design dropdown options.

Confidence Score: 5/5

Safe to merge — all changes are additive E2E test infrastructure with no impact on production code.

The change is purely additive: a new seeded user row, a new constant, and two new spec files. The seed is idempotent (existing DELETE block covers e2e-% rows), the two specs are paired to prevent false-positive vacuous passes, and the "No teams found" text anchor correctly resolves the transient-state race from the previous review round. No production logic is modified.

No files require special attention; the one style note is in internalUserNoTeam.spec.ts around navigation consistency.

Important Files Changed

Filename Overview
ui/litellm-dashboard/e2e_tests/constants.ts Adds E2E_TEAM_ORG_ALIAS constant ("E2E Team In Org") to complete the org-team identifier pair already started with E2E_TEAM_ORG_ID; used by the new paired spec.
ui/litellm-dashboard/e2e_tests/fixtures/seed.sql Seeds e2e-internal-noteam user ([email protected], internal_user role, empty teams array, no LiteLLM_TeamMembership rows) — correctly models the no-team scenario under test.
ui/litellm-dashboard/e2e_tests/tests/internal-user/internalUserNoTeam.spec.ts New spec: logs in fresh as the no-team user, opens Create Key modal, anchors on "No teams found" to wait out the loading spinner, then asserts zero options — avoids the transient-empty race the previous comment flagged.
ui/litellm-dashboard/e2e_tests/tests/internal-user/internalUserWithTeams.spec.ts New spec: differential partner using the stored internal-user session; asserts exactly two options (E2E Team CRUD + E2E Team In Org) preventing the no-team spec's toHaveCount(0) from passing vacuously if the role query never matches.

Reviews (2): Last reviewed commit: "test(e2e): harden no-team dropdown asser..." | Re-trigger Greptile

Comment thread ui/litellm-dashboard/e2e_tests/tests/internal-user/internalUserNoTeam.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!

…itellm_e2e_internal_user_no_team

# Conflicts:
#	ui/litellm-dashboard/e2e_tests/fixtures/seed.sql
…part

Replace the one-shot count() check with a settled-empty assertion: wait for
the dropdown's loaded "No teams found" state before asserting zero options,
so the test can't pass on a transient empty frame while the team-options
request is still in flight.

Add internalUserWithTeams.spec.ts as the differential partner; it logs in as
the seeded e2e-internal-user (two team memberships) and asserts the dropdown
lists exactly those teams. Without it, the no-team spec's zero-options
assertion would still pass against a regression that empties the dropdown for
every user.
@ryan-crabbe-berri

Copy link
Copy Markdown
Collaborator Author

@greptileai re review

@ryan-crabbe-berri ryan-crabbe-berri merged commit 8928389 into litellm_internal_staging May 30, 2026
103 of 118 checks passed
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…iAI#29083)

* test(e2e): cover Internal User create-key flow when in no teams

The seeded e2e-internal-user is in two teams, so the "no team" branch
of the Create Key modal — where the team dropdown must render empty —
was unreachable. Seeds a [email protected] user and adds a spec that
logs in fresh, opens the modal, and asserts the dropdown has zero
options.

* test(e2e): harden no-team dropdown assertion + add with-teams counterpart

Replace the one-shot count() check with a settled-empty assertion: wait for
the dropdown's loaded "No teams found" state before asserting zero options,
so the test can't pass on a transient empty frame while the team-options
request is still in flight.

Add internalUserWithTeams.spec.ts as the differential partner; it logs in as
the seeded e2e-internal-user (two team memberships) and asserts the dropdown
lists exactly those teams. Without it, the no-team spec's zero-options
assertion would still pass against a regression that empties the dropdown for
every user.
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