e8f51309e5
- 更新 Page Object 模型适配新字段名 - 新增 UAT 测试套件与 journey 测试用例 - 优化测试辅助工具与数据工厂 - 更新 playwright 认证状态
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
import { LoginPage } from '../pages/LoginPage';
|
|
import { NotificationPage } from '../pages/NotificationPage';
|
|
import { FileManagementPage } from '../pages/FileManagementPage';
|
|
|
|
test.describe('User Journey: 通知与文件管理', () => {
|
|
test.describe.configure({ mode: 'serial' });
|
|
|
|
const timestamp = Date.now();
|
|
|
|
test('UJ-06: 通知管理 CRUD', async ({ page }) => {
|
|
const loginPage = new LoginPage(page);
|
|
const notifyPage = new NotificationPage(page);
|
|
const title = `E2E通知_${timestamp}`;
|
|
|
|
await test.step('登录', async () => {
|
|
await loginPage.goto();
|
|
await loginPage.login('admin', 'Test@123');
|
|
});
|
|
|
|
await test.step('导航到通知管理', async () => {
|
|
await notifyPage.goto();
|
|
});
|
|
|
|
await test.step('创建通知', async () => {
|
|
await notifyPage.addNotification(title, 'E2E测试通知内容', '通知');
|
|
});
|
|
|
|
await test.step('验证通知已创建', async () => {
|
|
const exists = await notifyPage.containsText(title);
|
|
expect(exists).toBe(true);
|
|
});
|
|
|
|
await test.step('编辑通知', async () => {
|
|
await notifyPage.editNotification(title, '更新后的通知内容');
|
|
});
|
|
|
|
await test.step('删除通知', async () => {
|
|
await notifyPage.deleteNotification(title);
|
|
});
|
|
});
|
|
|
|
test('UJ-07: 文件上传与管理', async ({ page }) => {
|
|
const loginPage = new LoginPage(page);
|
|
const filePage = new FileManagementPage(page);
|
|
|
|
await test.step('登录', async () => {
|
|
await loginPage.goto();
|
|
await loginPage.login('admin', 'Test@123');
|
|
});
|
|
|
|
await test.step('导航到文件管理', async () => {
|
|
await filePage.goto();
|
|
});
|
|
|
|
await test.step('验证文件管理页面加载', async () => {
|
|
await expect(filePage.uploadButton).toBeVisible({ timeout: 10000 });
|
|
await expect(filePage.refreshButton).toBeVisible();
|
|
});
|
|
|
|
await test.step('刷新文件列表', async () => {
|
|
await filePage.reload();
|
|
});
|
|
});
|
|
});
|