be5d5ede90
refactor: 重构后端查询逻辑和API响应处理 fix: 修复用户角色更新和文件上传问题 test: 添加前端性能测试脚本和E2E测试用例 chore: 更新依赖版本和配置文件 docs: 添加环境检查脚本和测试文档 style: 统一表格标签样式和路由命名 perf: 优化前端页面加载速度和响应时间
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { Page, expect } from '@playwright/test';
|
|
|
|
export class OperationLogPage {
|
|
readonly page: Page;
|
|
readonly searchInput;
|
|
readonly searchButton;
|
|
readonly table;
|
|
readonly exportButton;
|
|
|
|
constructor(page: Page) {
|
|
this.page = page;
|
|
this.searchInput = page.getByPlaceholder('搜索操作人或操作模块');
|
|
this.searchButton = page.getByRole('button', { name: '搜索' });
|
|
this.table = page.locator('.el-table');
|
|
this.exportButton = page.getByRole('button', { name: '导出' });
|
|
}
|
|
|
|
async goto() {
|
|
await this.page.goto('/oplog');
|
|
await this.page.waitForLoadState('networkidle');
|
|
}
|
|
|
|
async searchByKeyword(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;
|
|
}
|
|
|
|
async exportData() {
|
|
await this.exportButton.click();
|
|
}
|
|
} |