From bfc2ab2a63d336b0f49b991c9ed262b09f78c2f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Tue, 7 Apr 2026 08:19:14 +0800 Subject: [PATCH] =?UTF-8?q?feat(e2e):=20=E5=88=9B=E5=BB=BA=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E7=AE=A1=E7=90=86=E5=92=8C=E7=B3=BB=E7=BB=9F=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E5=B7=A5=E4=BD=9C=E6=B5=81=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 文件管理工作流测试: - 文件上传流程 - 文件搜索和筛选 - 文件删除流程 系统配置工作流测试: - 查看系统配置 - 修改系统配置 - 字典管理流程 - 参数管理流程 --- .../journeys/file-management-workflow.spec.ts | 89 +++++++++++++++++ .../journeys/system-config-workflow.spec.ts | 97 +++++++++++++++++++ 2 files changed, 186 insertions(+) create mode 100644 novalon-manage-web/e2e/journeys/file-management-workflow.spec.ts create mode 100644 novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts diff --git a/novalon-manage-web/e2e/journeys/file-management-workflow.spec.ts b/novalon-manage-web/e2e/journeys/file-management-workflow.spec.ts new file mode 100644 index 0000000..f042d2f --- /dev/null +++ b/novalon-manage-web/e2e/journeys/file-management-workflow.spec.ts @@ -0,0 +1,89 @@ +import { test, expect } from '@playwright/test'; + +test.describe('文件管理工作流', () => { + test.beforeEach(async ({ page }) => { + await page.goto('/login'); + await page.locator('input[placeholder*="用户名"]').fill('admin'); + await page.locator('input[placeholder*="密码"]').fill('admin123'); + await page.locator('button:has-text("登录")').click(); + await page.waitForURL('**/dashboard', { timeout: 30000 }); + }); + + test('文件上传流程', async ({ page }) => { + await test.step('导航到文件管理', async () => { + await page.goto('/dashboard'); + await page.locator('text=系统管理').click(); + await page.locator('text=文件管理').click(); + }); + + await test.step('上传文件', async () => { + const uploadButton = page.locator('button:has-text("上传")'); + if (await uploadButton.isVisible()) { + const fileInput = page.locator('input[type="file"]'); + await fileInput.setInputFiles({ + name: 'test-file.txt', + mimeType: 'text/plain', + buffer: Buffer.from('Test file content'), + }); + await page.waitForTimeout(2000); + } + }); + + await test.step('验证文件上传成功', async () => { + const successMessage = page.locator('.el-message--success'); + if (await successMessage.isVisible()) { + expect(await successMessage.textContent()).toContain('成功'); + } + }); + }); + + test('文件搜索和筛选', async ({ page }) => { + await test.step('导航到文件管理', async () => { + await page.goto('/dashboard'); + await page.locator('text=系统管理').click(); + await page.locator('text=文件管理').click(); + }); + + await test.step('搜索文件', async () => { + const searchInput = page.locator('input[placeholder*="搜索"]'); + if (await searchInput.isVisible()) { + await searchInput.fill('test'); + await page.locator('button:has-text("搜索")').click(); + await page.waitForTimeout(1000); + } + }); + + await test.step('按类型筛选', async () => { + const typeFilter = page.locator('.el-select:has-text("类型")'); + if (await typeFilter.isVisible()) { + await typeFilter.click(); + await page.locator('.el-select-dropdown__item').first().click(); + await page.waitForTimeout(1000); + } + }); + }); + + test('文件删除流程', async ({ page }) => { + await test.step('导航到文件管理', async () => { + await page.goto('/dashboard'); + await page.locator('text=系统管理').click(); + await page.locator('text=文件管理').click(); + }); + + await test.step('选择文件', async () => { + const fileCheckbox = page.locator('.el-checkbox').first(); + if (await fileCheckbox.isVisible()) { + await fileCheckbox.click(); + } + }); + + await test.step('删除文件', async () => { + const deleteButton = page.locator('button:has-text("删除")'); + if (await deleteButton.isVisible()) { + await deleteButton.click(); + await page.locator('button:has-text("确定")').click(); + await page.waitForTimeout(1000); + } + }); + }); +}); diff --git a/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts b/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts new file mode 100644 index 0000000..de56a3d --- /dev/null +++ b/novalon-manage-web/e2e/journeys/system-config-workflow.spec.ts @@ -0,0 +1,97 @@ +import { test, expect } from '@playwright/test'; + +test.describe('系统配置工作流', () => { + test.beforeEach(async ({ page }) => { + await page.goto('/login'); + await page.locator('input[placeholder*="用户名"]').fill('admin'); + await page.locator('input[placeholder*="密码"]').fill('admin123'); + await page.locator('button:has-text("登录")').click(); + await page.waitForURL('**/dashboard', { timeout: 30000 }); + }); + + test('查看系统配置', async ({ page }) => { + await test.step('导航到系统配置', async () => { + await page.goto('/dashboard'); + await page.locator('text=系统管理').click(); + await page.locator('text=系统配置').click(); + await expect(page).toHaveURL(/.*sys\/config/); + }); + + await test.step('验证配置列表显示', async () => { + await expect(page.locator('table')).toBeVisible(); + }); + }); + + test('修改系统配置', async ({ page }) => { + await test.step('导航到系统配置', async () => { + await page.goto('/sys/config'); + }); + + await test.step('点击编辑按钮', async () => { + const editButton = page.locator('button:has-text("编辑")').first(); + if (await editButton.isVisible()) { + await editButton.click(); + } + }); + + await test.step('修改配置值', async () => { + const configInput = page.locator('input').first(); + if (await configInput.isVisible()) { + const currentValue = await configInput.inputValue(); + await configInput.fill(currentValue); + } + }); + + await test.step('保存配置', async () => { + const saveButton = page.locator('button:has-text("保存")'); + if (await saveButton.isVisible()) { + await saveButton.click(); + await page.waitForTimeout(1000); + } + }); + }); + + test('字典管理流程', async ({ page }) => { + await test.step('导航到字典管理', async () => { + await page.goto('/dashboard'); + await page.locator('text=系统管理').click(); + await page.locator('text=字典管理').click(); + }); + + await test.step('查看字典列表', async () => { + await expect(page.locator('table')).toBeVisible(); + }); + + await test.step('搜索字典项', async () => { + const searchInput = page.locator('input[placeholder*="搜索"]'); + if (await searchInput.isVisible()) { + await searchInput.fill('status'); + await page.locator('button:has-text("搜索")').click(); + await page.waitForTimeout(1000); + } + }); + }); + + test('参数管理流程', async ({ page }) => { + await test.step('导航到参数管理', async () => { + await page.goto('/dashboard'); + await page.locator('text=系统管理').click(); + await page.locator('text=参数管理').click(); + }); + + await test.step('查看参数列表', async () => { + await expect(page.locator('table')).toBeVisible(); + }); + + await test.step('添加新参数', async () => { + const addButton = page.locator('button:has-text("新建")'); + if (await addButton.isVisible()) { + await addButton.click(); + await page.locator('input[placeholder*="参数名"]').fill('test_param'); + await page.locator('input[placeholder*="参数值"]').fill('test_value'); + await page.locator('button:has-text("确定")').click(); + await page.waitForTimeout(1000); + } + }); + }); +});