Files
novalon-manage-system/novalon-manage-web/e2e/pages/OperationLogPage.ts
T
张翔 e8f51309e5 test: E2E 测试用例更新与新增
- 更新 Page Object 模型适配新字段名
- 新增 UAT 测试套件与 journey 测试用例
- 优化测试辅助工具与数据工厂
- 更新 playwright 认证状态
2026-05-06 19:43:39 +08:00

48 lines
1.3 KiB
TypeScript

import { Page, Locator, expect } from '@playwright/test';
export class OperationLogPage {
readonly page: Page;
readonly searchInput: Locator;
readonly refreshButton: Locator;
readonly table: Locator;
constructor(page: Page) {
this.page = page;
this.searchInput = page.getByPlaceholder('搜索操作人/描述');
this.refreshButton = page.getByRole('button', { name: '刷新' });
this.table = page.locator('.ant-table').first();
}
async goto() {
await this.page.goto('/oplog');
await this.page.waitForLoadState('networkidle');
await this.table.waitFor({ state: 'visible', timeout: 15000 }).catch(() => {});
await expect(this.page).toHaveURL(/.*oplog/);
}
async searchByKeyword(keyword: string) {
await this.searchInput.fill(keyword);
await this.searchInput.press('Enter');
await this.page.waitForLoadState('networkidle');
}
async clearSearch() {
await this.searchInput.clear();
await this.searchInput.press('Enter');
await this.page.waitForLoadState('networkidle');
}
async getTableRowCount(): Promise<number> {
return this.table.locator('tbody tr').count();
}
async containsText(text: string): Promise<boolean> {
return this.table.getByText(text).count() > 0;
}
async reload() {
await this.refreshButton.click();
await this.page.waitForLoadState('networkidle');
}
}