Files
novalon-manage-system/novalon-manage-web/e2e/uat-file-workflow.spec.ts
T
张翔 af44c23f21 refactor(security): 重构安全配置并优化测试环境
- 移除旧的测试套件和UAT测试文件
- 更新密码编码器配置使用BCrypt strength=12
- 添加用户角色关联表和相关服务
- 优化前端日期显示格式
- 清理无用资源和配置文件
- 增强测试数据管理和清理功能
2026-03-27 13:00:22 +08:00

95 lines
3.4 KiB
TypeScript

import { test, expect } from '@playwright/test';
import { LoginPage } from './pages/LoginPage';
import { DashboardPage } from './pages/DashboardPage';
import { FileManagementPage } from './pages/FileManagementPage';
test.describe('UAT文件管理流程测试', () => {
test('UAT-FILE-001: 文件上传下载完整流程', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
const fileManagementPage = new FileManagementPage(page);
await test.step('1. 管理员登录', async () => {
await loginPage.goto();
await loginPage.login('admin', 'admin123');
await page.waitForURL(/.*dashboard/);
});
await test.step('2. 导航到文件管理', async () => {
await dashboardPage.navigateToFileManagement();
await expect(fileManagementPage.table).toBeVisible();
});
await test.step('3. 上传文件', async () => {
await fileManagementPage.clickUploadButton();
const fileInput = page.locator('input[type="file"]');
await fileInput.setInputFiles('./e2e/fixtures/test-file.txt');
await fileManagementPage.submitUpload();
await expect(fileManagementPage.successMessage).toBeVisible();
});
await test.step('4. 验证文件列表', async () => {
const rowCount = await fileManagementPage.getTableRowCount();
expect(rowCount).toBeGreaterThan(0);
});
await test.step('5. 下载文件', async () => {
await fileManagementPage.clickDownloadButton(1);
const downloadPromise = page.waitForEvent('download');
const download = await downloadPromise;
expect(download.suggestedFilename()).toBeTruthy();
});
});
test('UAT-FILE-002: 文件删除流程', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
const fileManagementPage = new FileManagementPage(page);
await test.step('1. 管理员登录', async () => {
await loginPage.goto();
await loginPage.login('admin', 'admin123');
await page.waitForURL(/.*dashboard/);
});
await test.step('2. 导航到文件管理', async () => {
await dashboardPage.navigateToFileManagement();
await expect(fileManagementPage.table).toBeVisible();
});
await test.step('3. 删除文件', async () => {
await fileManagementPage.clickDeleteButton(1);
await page.on('dialog', dialog => dialog.accept());
await expect(fileManagementPage.successMessage).toBeVisible();
});
});
test('UAT-FILE-003: 文件搜索和过滤', async ({ page }) => {
const loginPage = new LoginPage(page);
const dashboardPage = new DashboardPage(page);
const fileManagementPage = new FileManagementPage(page);
await test.step('1. 管理员登录', async () => {
await loginPage.goto();
await loginPage.login('admin', 'admin123');
await page.waitForURL(/.*dashboard/);
});
await test.step('2. 导航到文件管理', async () => {
await dashboardPage.navigateToFileManagement();
await expect(fileManagementPage.table).toBeVisible();
});
await test.step('3. 搜索文件', async () => {
await fileManagementPage.searchInput.fill('test');
await fileManagementPage.searchButton.click();
await page.waitForTimeout(2000);
const rowCount = await fileManagementPage.getTableRowCount();
expect(rowCount).toBeGreaterThanOrEqual(0);
});
});
});