mirror of
https://github.com/tiennm99/litellm.git
synced 2026-06-17 16:48:54 +00:00
ci/cd changes for debugging
This commit is contained in:
@@ -12,7 +12,7 @@ test("admin login test", async ({ page }) => {
|
||||
// Go to the specified URL
|
||||
await page.goto("http://localhost:4000/ui");
|
||||
|
||||
page.screenshot({ path: "login_before.png" });
|
||||
await page.screenshot({ path: "test-results/login_before.png" });
|
||||
|
||||
// Enter "admin" in the username input field
|
||||
await page.fill('input[name="username"]', "admin");
|
||||
@@ -20,7 +20,7 @@ test("admin login test", async ({ page }) => {
|
||||
// Enter "gm" in the password input field
|
||||
await page.fill('input[name="password"]', "gm");
|
||||
|
||||
page.screenshot({ path: "login_after_inputs.png" });
|
||||
page.screenshot({ path: "test-results/login_after_inputs.png" });
|
||||
|
||||
// Optionally, you can add an assertion to verify the login button is enabled
|
||||
const loginButton = page.getByRole("button", { name: "Login" });
|
||||
|
||||
@@ -2,15 +2,19 @@
|
||||
import { test, expect } from "@playwright/test";
|
||||
|
||||
test.describe("Authentication Checks", () => {
|
||||
test("should redirect unauthenticated user from a protected page", async ({ page }) => {
|
||||
test("should redirect unauthenticated user from a protected page", async ({
|
||||
page,
|
||||
}) => {
|
||||
test.setTimeout(30000);
|
||||
|
||||
page.on("console", (msg) => console.log("PAGE LOG:", msg.text()));
|
||||
|
||||
const protectedPageUrl = "http://localhost:4000/ui?page=llm-playground";
|
||||
const expectedRedirectUrl = "http://localhost:4000/sso/key/generate";
|
||||
const expectedRedirectUrl = "http://localhost:4000/ui/login";
|
||||
|
||||
console.log(`Attempting to navigate to protected page: ${protectedPageUrl}`);
|
||||
console.log(
|
||||
`Attempting to navigate to protected page: ${protectedPageUrl}`
|
||||
);
|
||||
|
||||
await page.goto(protectedPageUrl);
|
||||
|
||||
@@ -20,7 +24,9 @@ test.describe("Authentication Checks", () => {
|
||||
await page.waitForURL(expectedRedirectUrl, { timeout: 10000 });
|
||||
console.log(`Waited for URL. Current URL is now: ${page.url()}`);
|
||||
} catch (error) {
|
||||
console.error(`Timeout waiting for URL: ${expectedRedirectUrl}. Current URL: ${page.url()}`);
|
||||
console.error(
|
||||
`Timeout waiting for URL: ${expectedRedirectUrl}. Current URL: ${page.url()}`
|
||||
);
|
||||
await page.screenshot({ path: "redirect-fail-screenshot.png" });
|
||||
throw error;
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function loginToUI(page: Page) {
|
||||
await page.fill('input[name="password"]', "gm");
|
||||
console.log("Filled login credentials");
|
||||
|
||||
const loginButton = page.locator('input[type="submit"]');
|
||||
const loginButton = page.getByRole("button", { name: "Login" });
|
||||
await expect(loginButton).toBeEnabled();
|
||||
await loginButton.click();
|
||||
console.log("Clicked login button");
|
||||
|
||||
Reference in New Issue
Block a user