-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
[Infra] UI - E2E Tests: Key Delete, Regenerate, and Update TPM/RPM Limits #20803
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,6 @@ | ||
| export const ADMIN_STORAGE_PATH = "admin.storageState.json"; | ||
|
|
||
| export const E2E_UPDATE_LIMITS_KEY_ID_PREFIX = "102c"; | ||
| export const E2E_DELETE_KEY_ID_PREFIX = "94a5"; | ||
| export const E2E_DELETE_KEY_NAME = "e2eDeleteKey"; | ||
| export const E2E_REGENERATE_KEY_ID_PREFIX = "593a"; |
25 changes: 25 additions & 0 deletions
25
ui/litellm-dashboard/e2e_tests/tests/keys/deleteKey.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
| import { ADMIN_STORAGE_PATH, E2E_DELETE_KEY_ID_PREFIX, E2E_DELETE_KEY_NAME } from "../../constants"; | ||
| import { Page } from "../../fixtures/pages"; | ||
| import { navigateToPage } from "../../helpers/navigation"; | ||
|
|
||
| test.describe("Delete Key", () => { | ||
| test.use({ storageState: ADMIN_STORAGE_PATH }); | ||
|
|
||
| test("Able to delete a key", async ({ page }) => { | ||
| await navigateToPage(page, Page.ApiKeys); | ||
| await expect(page.getByRole("button", { name: "Next" })).toBeVisible(); | ||
| await page | ||
| .locator("button", { | ||
| hasText: E2E_DELETE_KEY_ID_PREFIX, | ||
| }) | ||
| .click(); | ||
| await page.getByRole("button", { name: "Delete Key" }).click(); | ||
| await page.getByRole("textbox", { name: E2E_DELETE_KEY_NAME }).click(); | ||
| await page.getByRole("textbox", { name: E2E_DELETE_KEY_NAME }).fill(E2E_DELETE_KEY_NAME); | ||
| const deleteButton = page.getByRole("button", { name: "Delete", exact: true }); | ||
| await expect(deleteButton).toBeEnabled(); | ||
| await deleteButton.click(); | ||
| await expect(page.getByText("Key deleted successfully")).toBeVisible(); | ||
| }); | ||
| }); | ||
21 changes: 21 additions & 0 deletions
21
ui/litellm-dashboard/e2e_tests/tests/keys/regenerateKey.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
| import { ADMIN_STORAGE_PATH, E2E_REGENERATE_KEY_ID_PREFIX } from "../../constants"; | ||
| import { Page } from "../../fixtures/pages"; | ||
| import { navigateToPage } from "../../helpers/navigation"; | ||
|
|
||
| test.describe("Regenerate Key", () => { | ||
| test.use({ storageState: ADMIN_STORAGE_PATH }); | ||
|
|
||
| test("Able to regenerate a key", async ({ page }) => { | ||
| await navigateToPage(page, Page.ApiKeys); | ||
| await expect(page.getByRole("button", { name: "Next" })).toBeVisible(); | ||
| await page | ||
| .locator("button", { | ||
| hasText: E2E_REGENERATE_KEY_ID_PREFIX, | ||
| }) | ||
| .click(); | ||
| await page.getByRole("button", { name: "Regenerate Key" }).click(); | ||
| await page.getByRole("button", { name: "Regenerate", exact: true }).click(); | ||
| await expect(page.getByText("Virtual Key regenerated")).toBeVisible(); | ||
| }); | ||
| }); |
27 changes: 27 additions & 0 deletions
27
ui/litellm-dashboard/e2e_tests/tests/keys/updateKeyLimits.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { test, expect } from "@playwright/test"; | ||
| import { ADMIN_STORAGE_PATH, E2E_UPDATE_LIMITS_KEY_ID_PREFIX } from "../../constants"; | ||
| import { Page } from "../../fixtures/pages"; | ||
| import { navigateToPage } from "../../helpers/navigation"; | ||
|
|
||
| test.describe("Update Key TPM and RPM Limits", () => { | ||
| test.use({ storageState: ADMIN_STORAGE_PATH }); | ||
|
|
||
| test("Able to update a key's TPM and RPM limits", async ({ page }) => { | ||
| await navigateToPage(page, Page.ApiKeys); | ||
| await expect(page.getByRole("button", { name: "Next" })).toBeVisible(); | ||
| await page | ||
| .locator("button", { | ||
| hasText: E2E_UPDATE_LIMITS_KEY_ID_PREFIX, | ||
| }) | ||
| .click(); | ||
| await page.getByRole("tab", { name: "Settings" }).click(); | ||
| await page.getByRole("button", { name: "Edit Settings" }).click(); | ||
| await page.getByRole("spinbutton", { name: "TPM Limit" }).click(); | ||
| await page.getByRole("spinbutton", { name: "TPM Limit" }).fill("123"); | ||
| await page.getByRole("spinbutton", { name: "RPM Limit" }).click(); | ||
| await page.getByRole("spinbutton", { name: "RPM Limit" }).fill("456"); | ||
| await page.getByRole("button", { name: "Save Changes" }).click(); | ||
| await expect(page.getByRole("paragraph").filter({ hasText: "TPM: 123" })).toBeVisible(); | ||
| await expect(page.getByRole("paragraph").filter({ hasText: "RPM: 456" })).toBeVisible(); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect accessible name
The locator
getByRole("textbox", { name: E2E_DELETE_KEY_NAME })uses the accessible name of the input, not the placeholder/value. If the confirmation field is labeled something like "Type key name to confirm", this will never match and the test will fail. Prefer targeting the textbox by its real label (or by a stabledata-testid) and thenfill(E2E_DELETE_KEY_NAME).This same issue appears twice here (click + fill) and will break the delete flow if the textbox isn’t literally named
e2eDeleteKey.