e2e changes

This commit is contained in:
yuneng-jiang
2025-12-03 21:21:27 -08:00
parent a4341ccf83
commit 636f26d8a1
5 changed files with 11 additions and 1 deletions
@@ -11,6 +11,7 @@ import { test, expect } from "@playwright/test";
test("admin login test", async ({ page }) => {
// Go to the specified URL
await page.goto("http://localhost:4000/ui");
await page.waitForLoadState("networkidle");
await page.screenshot({ path: "test-results/login_before.png" });
@@ -10,7 +10,7 @@ test.describe("Authentication Checks", () => {
page.on("console", (msg) => console.log("PAGE LOG:", msg.text()));
const protectedPageUrl = "http://localhost:4000/ui?page=llm-playground";
const expectedRedirectUrl = "http://localhost:4000/ui/login";
const expectedRedirectUrl = "http://localhost:4000/ui/login/";
console.log(
`Attempting to navigate to protected page: ${protectedPageUrl}`
@@ -21,8 +21,11 @@ test("user search test", async ({ page }) => {
// Login first
await page.goto("http://localhost:4000/ui");
await page.waitForLoadState("networkidle");
console.log("Navigated to login page");
page.screenshot({ path: "test-results/search_users_before_login.png" });
// Wait for login form to be visible
await page.waitForSelector('input[name="username"]', { timeout: 10000 });
console.log("Login form is visible");
@@ -128,6 +131,7 @@ test("user filter test", async ({ page }) => {
// Login first
await page.goto("http://localhost:4000/ui");
await page.waitForLoadState("networkidle");
console.log("Navigated to login page");
// Wait for login form to be visible
@@ -7,6 +7,9 @@ import { test, expect } from "@playwright/test";
test("view internal user page", async ({ page }) => {
// Go to the specified URL
await page.goto("http://localhost:4000/ui");
await page.waitForLoadState("networkidle");
page.screenshot({ path: "test-results/view_internal_user_before_login.png" });
// Enter "admin" in the username input field
await page.fill('input[name="username"]', "admin");
@@ -3,8 +3,10 @@ import { Page, expect } from "@playwright/test";
export async function loginToUI(page: Page) {
// Login first
await page.goto("http://localhost:4000/ui");
await page.waitForLoadState("networkidle");
console.log("Navigated to login page");
page.screenshot({ path: "test-results/login_utils_before.png" });
// Wait for login form to be visible
await page.waitForSelector('input[name="username"]', { timeout: 10000 });
console.log("Login form is visible");