mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
test: add more unit testing
This commit is contained in:
parent
bd8b68452b
commit
57cfd5a3fa
3 changed files with 17 additions and 23 deletions
|
@ -62,7 +62,7 @@ test("user search test", async ({ page }) => {
|
||||||
console.log("Clicked Internal User tab");
|
console.log("Clicked Internal User tab");
|
||||||
|
|
||||||
// Wait for the page to load and table to be visible
|
// Wait for the page to load and table to be visible
|
||||||
await page.waitForSelector("tbody tr", { timeout: 10000 });
|
await page.waitForSelector("tbody tr", { timeout: 30000 });
|
||||||
await page.waitForTimeout(2000); // Additional wait for table to stabilize
|
await page.waitForTimeout(2000); // Additional wait for table to stabilize
|
||||||
console.log("Table is visible");
|
console.log("Table is visible");
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ test("user filter test", async ({ page }) => {
|
||||||
console.log("Clicked Internal User tab");
|
console.log("Clicked Internal User tab");
|
||||||
|
|
||||||
// Wait for the page to load and table to be visible
|
// Wait for the page to load and table to be visible
|
||||||
await page.waitForSelector("tbody tr", { timeout: 10000 });
|
await page.waitForSelector("tbody tr", { timeout: 30000 });
|
||||||
await page.waitForTimeout(2000); // Additional wait for table to stabilize
|
await page.waitForTimeout(2000); // Additional wait for table to stabilize
|
||||||
console.log("Table is visible");
|
console.log("Table is visible");
|
||||||
|
|
||||||
|
@ -164,22 +164,14 @@ test("user filter test", async ({ page }) => {
|
||||||
const initialUserCount = await page.locator("tbody tr").count();
|
const initialUserCount = await page.locator("tbody tr").count();
|
||||||
console.log(`Initial user count: ${initialUserCount}`);
|
console.log(`Initial user count: ${initialUserCount}`);
|
||||||
|
|
||||||
// Test email filter
|
// Click the filter button to show additional filters
|
||||||
const emailInput = page.locator('input[placeholder="Search by email..."]');
|
const filterButton = page.getByRole("button", {
|
||||||
await expect(emailInput).toBeVisible();
|
name: "Filters",
|
||||||
console.log("Email search input is visible");
|
exact: true,
|
||||||
|
});
|
||||||
await emailInput.fill("test@");
|
await filterButton.click();
|
||||||
console.log("Filled email filter");
|
console.log("Clicked filter button");
|
||||||
await page.waitForTimeout(500); // Wait for debounce
|
await page.waitForTimeout(500); // Wait for filters to appear
|
||||||
const emailFilteredCount = await page.locator("tbody tr").count();
|
|
||||||
console.log(`Email filtered count: ${emailFilteredCount}`);
|
|
||||||
expect(emailFilteredCount).toBeLessThan(initialUserCount);
|
|
||||||
|
|
||||||
// Clear email filter
|
|
||||||
await emailInput.clear();
|
|
||||||
await page.waitForTimeout(500);
|
|
||||||
console.log("Cleared email filter");
|
|
||||||
|
|
||||||
// Test user ID filter
|
// Test user ID filter
|
||||||
const userIdInput = page.locator('input[placeholder="Filter by User ID"]');
|
const userIdInput = page.locator('input[placeholder="Filter by User ID"]');
|
||||||
|
@ -188,14 +180,14 @@ test("user filter test", async ({ page }) => {
|
||||||
|
|
||||||
await userIdInput.fill("user");
|
await userIdInput.fill("user");
|
||||||
console.log("Filled user ID filter");
|
console.log("Filled user ID filter");
|
||||||
await page.waitForTimeout(500);
|
await page.waitForTimeout(1000);
|
||||||
const userIdFilteredCount = await page.locator("tbody tr").count();
|
const userIdFilteredCount = await page.locator("tbody tr").count();
|
||||||
console.log(`User ID filtered count: ${userIdFilteredCount}`);
|
console.log(`User ID filtered count: ${userIdFilteredCount}`);
|
||||||
expect(userIdFilteredCount).toBeLessThan(initialUserCount);
|
expect(userIdFilteredCount).toBeLessThan(initialUserCount);
|
||||||
|
|
||||||
// Clear user ID filter
|
// Clear user ID filter
|
||||||
await userIdInput.clear();
|
await userIdInput.clear();
|
||||||
await page.waitForTimeout(500);
|
await page.waitForTimeout(1000);
|
||||||
console.log("Cleared user ID filter");
|
console.log("Cleared user ID filter");
|
||||||
|
|
||||||
// Test SSO user ID filter
|
// Test SSO user ID filter
|
||||||
|
@ -205,14 +197,14 @@ test("user filter test", async ({ page }) => {
|
||||||
|
|
||||||
await ssoUserIdInput.fill("sso");
|
await ssoUserIdInput.fill("sso");
|
||||||
console.log("Filled SSO user ID filter");
|
console.log("Filled SSO user ID filter");
|
||||||
await page.waitForTimeout(500);
|
await page.waitForTimeout(1000);
|
||||||
const ssoUserIdFilteredCount = await page.locator("tbody tr").count();
|
const ssoUserIdFilteredCount = await page.locator("tbody tr").count();
|
||||||
console.log(`SSO user ID filtered count: ${ssoUserIdFilteredCount}`);
|
console.log(`SSO user ID filtered count: ${ssoUserIdFilteredCount}`);
|
||||||
expect(ssoUserIdFilteredCount).toBeLessThan(initialUserCount);
|
expect(ssoUserIdFilteredCount).toBeLessThan(initialUserCount);
|
||||||
|
|
||||||
// Clear SSO user ID filter
|
// Clear SSO user ID filter
|
||||||
await ssoUserIdInput.clear();
|
await ssoUserIdInput.clear();
|
||||||
await page.waitForTimeout(500);
|
await page.waitForTimeout(5000);
|
||||||
console.log("Cleared SSO user ID filter");
|
console.log("Cleared SSO user ID filter");
|
||||||
|
|
||||||
// Verify count returns to initial after clearing all filters
|
// Verify count returns to initial after clearing all filters
|
||||||
|
|
|
@ -322,6 +322,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
filters.email || null,
|
filters.email || null,
|
||||||
filters.user_role || null,
|
filters.user_role || null,
|
||||||
filters.team || null,
|
filters.team || null,
|
||||||
|
filters.sso_user_id || null,
|
||||||
filters.sort_by,
|
filters.sort_by,
|
||||||
filters.sort_order
|
filters.sort_order
|
||||||
);
|
);
|
||||||
|
@ -361,6 +362,7 @@ const ViewUserDashboard: React.FC<ViewUserDashboardProps> = ({
|
||||||
filters.email || null,
|
filters.email || null,
|
||||||
filters.user_role || null,
|
filters.user_role || null,
|
||||||
filters.team || null,
|
filters.team || null,
|
||||||
|
filters.sso_user_id || null,
|
||||||
filters.sort_by,
|
filters.sort_by,
|
||||||
filters.sort_order
|
filters.sort_order
|
||||||
);
|
);
|
||||||
|
|
|
@ -50,7 +50,7 @@ export function UserDataTable({
|
||||||
state: {
|
state: {
|
||||||
sorting,
|
sorting,
|
||||||
},
|
},
|
||||||
onSortingChange: (newSorting) => {
|
onSortingChange: (newSorting: any) => {
|
||||||
setSorting(newSorting);
|
setSorting(newSorting);
|
||||||
if (newSorting.length > 0) {
|
if (newSorting.length > 0) {
|
||||||
const sortState = newSorting[0];
|
const sortState = newSorting[0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue