feat: 更新UAT测试配置和修复数据库连接问题
refactor(测试): 重构用户数据加载逻辑以支持数组格式 fix(数据库): 修正数据库连接配置和凭证 test: 添加新的导航和用户管理测试场景 docs: 生成UAT测试报告和最终报告 ci: 更新Woodpecker CI配置和测试命令 build: 添加application-test.yml配置文件 chore: 清理旧的测试场景文件
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
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('访问用户管理页面', async ({ page }) => {
|
||||
await loginPage.login('admin', 'admin123');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.goto('http://localhost:3003/users');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const currentUrl = page.url();
|
||||
console.log('当前URL:', currentUrl);
|
||||
|
||||
expect(currentUrl).toContain('/users');
|
||||
|
||||
const pageTitle = await page.title();
|
||||
console.log('页面标题:', pageTitle);
|
||||
expect(pageTitle).toBeTruthy();
|
||||
});
|
||||
|
||||
test('用户管理页面元素检查', async ({ page }) => {
|
||||
await loginPage.login('admin', 'admin123');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.goto('http://localhost:3003/users');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const searchInput = page.locator('input[placeholder*="搜索"], input[placeholder*="用户名"]');
|
||||
const addButton = page.locator('button:has-text("新增"), button:has-text("添加")');
|
||||
const table = page.locator('table, .el-table');
|
||||
|
||||
console.log('搜索输入框存在:', await searchInput.count() > 0);
|
||||
console.log('添加按钮存在:', await addButton.count() > 0);
|
||||
console.log('表格存在:', await table.count() > 0);
|
||||
|
||||
expect(await table.count()).toBeGreaterThan(0);
|
||||
});
|
||||
|
||||
test('搜索用户功能', async ({ page }) => {
|
||||
await loginPage.login('admin', 'admin123');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
await page.goto('http://localhost:3003/users');
|
||||
await page.waitForLoadState('networkidle');
|
||||
|
||||
const searchInput = page.locator('input[placeholder*="搜索"], input[placeholder*="用户名"]');
|
||||
if (await searchInput.count() > 0) {
|
||||
await searchInput.fill('admin');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
const tableRows = page.locator('table tbody tr, .el-table__body tr');
|
||||
const rowCount = await tableRows.count();
|
||||
console.log('搜索结果行数:', rowCount);
|
||||
|
||||
expect(rowCount).toBeGreaterThanOrEqual(0);
|
||||
} else {
|
||||
console.log('搜索输入框未找到,跳过搜索测试');
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user