fix: resolve UAT test issues and improve test infrastructure

This commit is contained in:
张翔
2026-03-25 10:21:47 +08:00
parent f0efbaeabd
commit 6c35ba7fb4
7 changed files with 202 additions and 4 deletions
@@ -0,0 +1,34 @@
import { test, expect } from '@playwright/test';
import { LoginPage } from '../../novalon-manage-web/e2e/pages/LoginPage';
test.describe('UAT - 登录功能验证', () => {
let loginPage: LoginPage;
test.beforeEach(async ({ page }) => {
loginPage = new LoginPage(page);
await loginPage.goto();
});
test('使用admin账户登录', async ({ page }) => {
await loginPage.login('admin', 'admin123');
const currentUrl = page.url();
console.log('登录后URL:', currentUrl);
await page.waitForLoadState('networkidle');
const isLoggedIn = await loginPage.isLoggedIn();
expect(isLoggedIn).toBeTruthy();
});
test('登录失败显示错误信息', async ({ page }) => {
await loginPage.login('wronguser', 'wrongpassword');
await page.waitForTimeout(2000);
const errorMessage = await loginPage.getErrorMessage();
console.log('错误信息:', errorMessage);
expect(errorMessage).toBeTruthy();
});
});