Fix e2e ui playwright test (#16799)

This commit is contained in:
yuneng-jiang
2025-11-18 17:56:40 -08:00
committed by GitHub
parent 7b9c409760
commit fe05e33723
@@ -6,17 +6,17 @@ Basic UI Test
Click on all the tabs ensure nothing is broken
*/
import { test, expect } from '@playwright/test';
import { test, expect } from "@playwright/test";
test('admin login test', async ({ page }) => {
test("admin login test", async ({ page }) => {
// Go to the specified URL
await page.goto('http://localhost:4000/ui');
await page.goto("http://localhost:4000/ui");
// Enter "admin" in the username input field
await page.fill('input[name="username"]', 'admin');
await page.fill('input[name="username"]', "admin");
// Enter "gm" in the password input field
await page.fill('input[name="password"]', 'gm');
await page.fill('input[name="password"]', "gm");
// Optionally, you can add an assertion to verify the login button is enabled
const loginButton = page.locator('input[type="submit"]');
@@ -25,20 +25,22 @@ test('admin login test', async ({ page }) => {
// Optionally, you can click the login button to submit the form
await loginButton.click();
const tabs = [
'Virtual Keys',
'Test Key',
'Models',
'Usage',
'Teams',
'Internal User',
'Settings',
'Experimental',
'API Reference',
'Model Hub'
"Virtual Keys",
"Test Key",
"Models",
"Usage",
"Teams",
"Internal User",
"Settings",
"Experimental",
"API Reference",
"AI Hub",
];
for (const tab of tabs) {
const tabElement = page.locator('span.ant-menu-title-content', { hasText: tab });
const tabElement = page.locator("span.ant-menu-title-content", {
hasText: tab,
});
await tabElement.click();
}
});