49b1264df1
- 更新网关配置以符合Spring Boot 3.x最佳实践 - 修复数据字典和系统配置测试的UI元素定位问题 - 改进Playwright测试配置,增加超时时间和日志 - 新增TestDataCleaner工具类用于测试数据清理 - 更新全局设置使用test profile禁用签名验证 测试通过率从59.57%提升至97.30%,提升了37.73%
124 lines
5.0 KiB
TypeScript
124 lines
5.0 KiB
TypeScript
import { test, expect } from '@playwright/test';
|
|
|
|
test.describe('系统配置管理完整工作流', () => {
|
|
test.describe.configure({ mode: 'serial' });
|
|
|
|
const timestamp = Date.now();
|
|
const configName = `测试配置_${timestamp}`;
|
|
const configKey = `test_config_${timestamp}`;
|
|
const configValue = `test_value_${timestamp}`;
|
|
|
|
test('创建系统配置', async ({ page }) => {
|
|
await test.step('导航到参数配置', async () => {
|
|
await page.goto('/dashboard');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.locator('text=系统管理').click();
|
|
await page.waitForTimeout(500);
|
|
await page.locator('text=参数管理').click();
|
|
await page.waitForLoadState('networkidle');
|
|
await expect(page).toHaveURL(/.*config/, { timeout: 10000 });
|
|
});
|
|
|
|
await test.step('点击新增配置按钮', async () => {
|
|
await page.locator('button:has-text("新增配置")').click();
|
|
await page.waitForSelector('.el-dialog', { state: 'visible', timeout: 5000 });
|
|
});
|
|
|
|
await test.step('填写配置信息', async () => {
|
|
const dialog = page.locator('.el-dialog');
|
|
await dialog.locator('input').first().fill(configName);
|
|
await dialog.locator('input').nth(1).fill(configKey);
|
|
await dialog.locator('input').nth(2).fill(configValue);
|
|
});
|
|
|
|
await test.step('提交配置表单', async () => {
|
|
await page.locator('.el-dialog button:has-text("确定")').click();
|
|
await page.waitForSelector('.el-dialog', { state: 'hidden', timeout: 10000 });
|
|
await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 });
|
|
});
|
|
|
|
await test.step('验证配置已创建', async () => {
|
|
await page.waitForTimeout(1000);
|
|
const configRow = page.locator(`tr:has-text("${configName}")`);
|
|
await expect(configRow).toBeVisible({ timeout: 10000 });
|
|
});
|
|
});
|
|
|
|
test('编辑系统配置', async ({ page }) => {
|
|
const updatedValue = `updated_value_${timestamp}`;
|
|
|
|
await test.step('导航到参数配置', async () => {
|
|
await page.goto('/dashboard');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.locator('text=系统管理').click();
|
|
await page.waitForTimeout(500);
|
|
await page.locator('text=参数管理').click();
|
|
await page.waitForLoadState('networkidle');
|
|
});
|
|
|
|
await test.step('编辑配置', async () => {
|
|
const configRow = page.locator(`tr:has-text("${configName}")`);
|
|
await configRow.locator('button:has-text("编辑")').click();
|
|
await page.waitForSelector('.el-dialog', { state: 'visible', timeout: 5000 });
|
|
});
|
|
|
|
await test.step('修改配置值', async () => {
|
|
const dialog = page.locator('.el-dialog');
|
|
await dialog.locator('input').nth(2).fill(updatedValue);
|
|
});
|
|
|
|
await test.step('提交更新', async () => {
|
|
await page.locator('.el-dialog button:has-text("确定")').click();
|
|
await page.waitForSelector('.el-dialog', { state: 'hidden', timeout: 10000 });
|
|
await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 });
|
|
});
|
|
|
|
await test.step('验证配置已更新', async () => {
|
|
await page.waitForTimeout(1000);
|
|
const configRow = page.locator(`tr:has-text("${configName}")`);
|
|
await expect(configRow).toBeVisible({ timeout: 10000 });
|
|
});
|
|
});
|
|
|
|
test('删除系统配置', async ({ page }) => {
|
|
await test.step('导航到参数配置', async () => {
|
|
await page.goto('/dashboard');
|
|
await page.waitForLoadState('networkidle');
|
|
await page.locator('text=系统管理').click();
|
|
await page.waitForTimeout(500);
|
|
await page.locator('text=参数管理').click();
|
|
await page.waitForLoadState('networkidle');
|
|
});
|
|
|
|
await test.step('删除配置', async () => {
|
|
const configRow = page.locator(`tr:has-text("${configName}")`);
|
|
await configRow.locator('button:has-text("删除")').click();
|
|
await page.waitForSelector('.el-message-box', { state: 'visible', timeout: 5000 });
|
|
});
|
|
|
|
await test.step('确认删除', async () => {
|
|
await page.locator('.el-message-box button:has-text("确定")').click();
|
|
await page.waitForSelector('.el-message-box', { state: 'hidden', timeout: 10000 });
|
|
await expect(page.locator('.el-message--success')).toBeVisible({ timeout: 5000 });
|
|
});
|
|
});
|
|
|
|
test('配置管理权限验证', async ({ page }) => {
|
|
await test.step('验证配置管理页面访问权限', async () => {
|
|
await page.goto('/sys/config');
|
|
await page.waitForLoadState('networkidle');
|
|
|
|
await page.waitForTimeout(2000);
|
|
|
|
await expect(page.locator('.card-title')).toBeVisible({ timeout: 10000 });
|
|
await expect(page.locator('button:has-text("新增配置")')).toBeVisible();
|
|
});
|
|
|
|
await test.step('验证表格列', async () => {
|
|
await expect(page.locator('th:has-text("参数名称")')).toBeVisible();
|
|
await expect(page.locator('th:has-text("参数键名")')).toBeVisible();
|
|
await expect(page.locator('th:has-text("参数值")')).toBeVisible();
|
|
});
|
|
});
|
|
});
|