feat: 添加异常日志功能并优化UI样式
refactor: 重构后端查询逻辑和API响应处理 fix: 修复用户角色更新和文件上传问题 test: 添加前端性能测试脚本和E2E测试用例 chore: 更新依赖版本和配置文件 docs: 添加环境检查脚本和测试文档 style: 统一表格标签样式和路由命名 perf: 优化前端页面加载速度和响应时间
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
export class SystemConfigPage {
|
||||
readonly page: Page;
|
||||
readonly table;
|
||||
readonly addButton;
|
||||
readonly editButton;
|
||||
readonly deleteButton;
|
||||
readonly saveButton;
|
||||
readonly cancelButton;
|
||||
readonly searchInput;
|
||||
readonly searchButton;
|
||||
readonly configNameInput;
|
||||
readonly configKeyInput;
|
||||
readonly configValueInput;
|
||||
readonly configTypeSelect;
|
||||
|
||||
constructor(page: Page) {
|
||||
this.page = page;
|
||||
this.table = page.locator('.el-table');
|
||||
this.addButton = page.getByRole('button', { name: '新增配置' });
|
||||
this.editButton = page.getByRole('button', { name: '编辑' });
|
||||
this.deleteButton = page.getByRole('button', { name: '删除' });
|
||||
this.saveButton = page.getByRole('button', { name: '确定' });
|
||||
this.cancelButton = page.getByRole('button', { name: '取消' });
|
||||
this.searchInput = page.getByPlaceholder('搜索配置名称');
|
||||
this.searchButton = page.getByRole('button', { name: '搜索' });
|
||||
this.configNameInput = page.getByPlaceholder('请输入配置名称');
|
||||
this.configKeyInput = page.getByPlaceholder('请输入配置键名');
|
||||
this.configValueInput = page.getByPlaceholder('请输入配置键值');
|
||||
this.configTypeSelect = page.locator('.el-select');
|
||||
}
|
||||
|
||||
async goto() {
|
||||
await this.page.goto('/sys/config');
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async addConfig(configName: string, configKey: string, configValue: string, configType: string = 'Y') {
|
||||
await this.addButton.click();
|
||||
|
||||
await this.configNameInput.fill(configName);
|
||||
await this.configKeyInput.fill(configKey);
|
||||
await this.configValueInput.fill(configValue);
|
||||
|
||||
await this.saveButton.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async editConfig(configKey: string, newValue: string) {
|
||||
const row = this.table.locator('tr').filter({ hasText: configKey }).first();
|
||||
await row.locator('.el-button--primary').click();
|
||||
|
||||
await this.configValueInput.clear();
|
||||
await this.configValueInput.fill(newValue);
|
||||
|
||||
await this.saveButton.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async deleteConfig(configKey: string) {
|
||||
const row = this.table.locator('tr').filter({ hasText: configKey }).first();
|
||||
await row.locator('.el-button--danger').click();
|
||||
|
||||
await this.saveButton.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async searchConfig(keyword: string) {
|
||||
await this.searchInput.fill(keyword);
|
||||
await this.searchButton.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async clearSearch() {
|
||||
await this.searchInput.clear();
|
||||
await this.searchButton.click();
|
||||
await this.page.waitForLoadState('networkidle');
|
||||
}
|
||||
|
||||
async verifyTableContains(text: string) {
|
||||
await expect(this.table).toContainText(text);
|
||||
}
|
||||
|
||||
async verifyTableNotContains(text: string) {
|
||||
await expect(this.table).not.toContainText(text);
|
||||
}
|
||||
|
||||
async getTableRowCount() {
|
||||
const rows = await this.table.locator('.el-table__row').count();
|
||||
return rows;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user