import { test, expect } from '@playwright/test'; import { LoginPage } from '../pages/LoginPage'; import { SystemConfigPage } from '../pages/SystemConfigPage'; import { DictionaryManagementPage } from '../pages/DictionaryManagementPage'; test.describe('User Journey: 系统配置与字典管理', () => { test.describe.configure({ mode: 'serial' }); const timestamp = Date.now(); test('UJ-04: 系统配置 CRUD', async ({ page }) => { const loginPage = new LoginPage(page); const configPage = new SystemConfigPage(page); await test.step('登录', async () => { await loginPage.goto(); await loginPage.login('admin', 'Test@123'); }); await test.step('导航到系统配置', async () => { await configPage.goto(); }); await test.step('创建配置', async () => { await configPage.addConfig( `E2E配置_${timestamp}`, `e2e.config.key_${timestamp}`, 'e2e_test_value', 'test', 'E2E测试配置' ); }); await test.step('验证配置已创建', async () => { const exists = await configPage.containsText(`e2e.config.key_${timestamp}`); expect(exists).toBe(true); }); await test.step('编辑配置值', async () => { await configPage.editConfig(`e2e.config.key_${timestamp}`, 'updated_value'); }); await test.step('删除配置', async () => { await configPage.deleteConfig(`e2e.config.key_${timestamp}`); }); }); test('UJ-05: 字典类型与数据 CRUD', async ({ page }) => { const loginPage = new LoginPage(page); const dictPage = new DictionaryManagementPage(page); const dictName = `E2E字典_${timestamp}`; const dictType = `e2e_dict_${timestamp}`; await test.step('登录', async () => { await loginPage.goto(); await loginPage.login('admin', 'Test@123'); }); await test.step('导航到字典管理', async () => { await dictPage.goto(); }); await test.step('创建字典类型', async () => { await dictPage.createDictType(dictName, dictType, 1, 'E2E测试字典'); }); await test.step('选择字典类型', async () => { await dictPage.selectDictType(dictType); }); await test.step('创建字典数据', async () => { await dictPage.createDictData('E2E选项A', 'option_a', 1, 1); }); await test.step('验证字典数据已创建', async () => { const exists = await dictPage.dataContainsText('E2E选项A'); expect(exists).toBe(true); }); }); });