From d6b15acf5bb27136fd2ebc24856dd522168dea15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E7=BF=94?= Date: Wed, 15 Apr 2026 22:09:49 +0800 Subject: [PATCH] =?UTF-8?q?test:=20=E6=B7=BB=E5=8A=A0=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD=E6=B5=8B=E8=AF=95=E7=94=A8?= =?UTF-8?q?=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 测试字典管理列表显示 - 验证字典管理的基本功能 --- .../e2e/dict-management.spec.ts | 72 +++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 novalon-manage-web/e2e/dict-management.spec.ts diff --git a/novalon-manage-web/e2e/dict-management.spec.ts b/novalon-manage-web/e2e/dict-management.spec.ts new file mode 100644 index 0000000..a22eeb3 --- /dev/null +++ b/novalon-manage-web/e2e/dict-management.spec.ts @@ -0,0 +1,72 @@ +import { test, expect } from '@playwright/test'; + +test.describe('字典管理功能测试', () => { + let authToken: string; + + test.beforeAll(async ({ request }) => { + const response = await request.post('http://localhost:8080/api/auth/login', { + headers: { + 'Content-Type': 'application/json' + }, + data: { + username: 'admin', + password: 'admin123' + } + }); + + expect(response.status()).toBe(200); + const data = await response.json(); + authToken = data.token; + }); + + test('字典管理列表显示测试', async ({ page }) => { + await test.step('导航到字典管理页面', async () => { + await page.goto('http://localhost:3002/login'); + + const usernameInput = page.locator('input[type="text"], input[placeholder*="用户名"], input[placeholder*="账号"]').first(); + const passwordInput = page.locator('input[type="password"]').first(); + const loginButton = page.locator('button:has-text("登录")').first(); + + await usernameInput.fill('admin'); + await passwordInput.fill('admin123'); + await loginButton.click(); + + await page.waitForTimeout(2000); + + // 点击系统管理菜单 + const systemMenu = page.locator('.el-sub-menu:has-text("系统管理")').first(); + if (await systemMenu.count() > 0) { + await systemMenu.click(); + await page.waitForTimeout(500); + } + + // 点击字典管理 + const dictManagement = page.locator('.el-menu-item:has-text("字典管理")').first(); + if (await dictManagement.count() > 0) { + await dictManagement.click(); + await page.waitForTimeout(1000); + } + }); + + await test.step('验证字典管理列表显示', async () => { + // 检查是否有字典管理列表或表格 + const tableSelectors = [ + 'table', + '.el-table', + '[class*="table"]', + '.dict-list' + ]; + + let foundTable = false; + for (const selector of tableSelectors) { + const count = await page.locator(selector).count(); + if (count > 0) { + foundTable = true; + break; + } + } + + expect(foundTable).toBe(true); + }); + }); +});