e8f51309e5
- 更新 Page Object 模型适配新字段名 - 新增 UAT 测试套件与 journey 测试用例 - 优化测试辅助工具与数据工厂 - 更新 playwright 认证状态
73 lines
2.5 KiB
TypeScript
73 lines
2.5 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { ExceptionLogPage } from '../pages/ExceptionLogPage';
|
|
|
|
test.describe('异常日志工作流', () => {
|
|
let exceptionLogPage: ExceptionLogPage;
|
|
|
|
test.beforeEach(async ({ page }) => {
|
|
exceptionLogPage = new ExceptionLogPage(page);
|
|
});
|
|
|
|
test('查看异常日志列表', async ({ page }) => {
|
|
await test.step('导航到异常日志页面', async () => {
|
|
await exceptionLogPage.goto();
|
|
});
|
|
|
|
await test.step('验证表格显示', async () => {
|
|
await expect(exceptionLogPage.table).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
await test.step('验证数据加载', async () => {
|
|
const rowCount = await exceptionLogPage.getLogCount();
|
|
console.log(`异常日志列表包含 ${rowCount} 条记录`);
|
|
expect(rowCount).toBeGreaterThanOrEqual(0);
|
|
});
|
|
});
|
|
|
|
test('搜索异常日志', async ({ page }) => {
|
|
await test.step('导航到异常日志页面', async () => {
|
|
await exceptionLogPage.goto();
|
|
});
|
|
|
|
await test.step('输入搜索关键词', async () => {
|
|
const searchKeyword = 'NullPointerException';
|
|
await exceptionLogPage.search(searchKeyword);
|
|
});
|
|
|
|
await test.step('验证搜索结果', async () => {
|
|
await page.waitForLoadState('networkidle');
|
|
const rowCount = await exceptionLogPage.getLogCount();
|
|
console.log(`搜索结果包含 ${rowCount} 条记录`);
|
|
});
|
|
});
|
|
|
|
test('查看异常日志详情', async ({ page }) => {
|
|
await test.step('导航到异常日志页面', async () => {
|
|
await exceptionLogPage.goto();
|
|
});
|
|
|
|
await test.step('等待数据加载', async () => {
|
|
await expect(exceptionLogPage.table).toBeVisible({ timeout: 10000 });
|
|
});
|
|
|
|
await test.step('点击查看详情按钮', async () => {
|
|
const detailButton = page.locator('button:has-text("详情")').or(page.locator('.detail-button')).first();
|
|
if (await detailButton.isVisible({ timeout: 3000 }).catch(() => false)) {
|
|
await detailButton.click();
|
|
|
|
await test.step('验证详情对话框显示', async () => {
|
|
const dialog = page.locator('.ant-modal');
|
|
await expect(dialog).toBeVisible({ timeout: 5000 });
|
|
console.log('异常日志详情对话框已打开');
|
|
});
|
|
|
|
await test.step('关闭详情对话框', async () => {
|
|
await exceptionLogPage.closeDetailDialog();
|
|
});
|
|
} else {
|
|
console.log('当前没有异常日志记录,跳过详情查看测试');
|
|
}
|
|
});
|
|
});
|
|
});
|