|
@@ -5,7 +5,6 @@ export class RouteManagementPage {
|
|
|
readonly pageTitle: Locator;
|
|
readonly pageTitle: Locator;
|
|
|
readonly createRouteButton: Locator;
|
|
readonly createRouteButton: Locator;
|
|
|
readonly searchInput: Locator;
|
|
readonly searchInput: Locator;
|
|
|
- readonly searchButton: Locator;
|
|
|
|
|
readonly routeTable: Locator;
|
|
readonly routeTable: Locator;
|
|
|
readonly editButtons: Locator;
|
|
readonly editButtons: Locator;
|
|
|
readonly deleteButtons: Locator;
|
|
readonly deleteButtons: Locator;
|
|
@@ -18,7 +17,6 @@ export class RouteManagementPage {
|
|
|
this.pageTitle = page.locator('[data-testid="route-management-title"]');
|
|
this.pageTitle = page.locator('[data-testid="route-management-title"]');
|
|
|
this.createRouteButton = page.locator('[data-testid="create-route-button"]');
|
|
this.createRouteButton = page.locator('[data-testid="create-route-button"]');
|
|
|
this.searchInput = page.locator('[data-testid="route-search-input"]');
|
|
this.searchInput = page.locator('[data-testid="route-search-input"]');
|
|
|
- this.searchButton = page.getByRole('button', { name: '搜索' });
|
|
|
|
|
this.routeTable = page.locator('[data-testid="route-table"]');
|
|
this.routeTable = page.locator('[data-testid="route-table"]');
|
|
|
this.editButtons = page.locator('[data-testid^="edit-route-"]');
|
|
this.editButtons = page.locator('[data-testid^="edit-route-"]');
|
|
|
this.deleteButtons = page.locator('[data-testid^="delete-route-"]');
|
|
this.deleteButtons = page.locator('[data-testid^="delete-route-"]');
|
|
@@ -54,7 +52,8 @@ export class RouteManagementPage {
|
|
|
|
|
|
|
|
async searchRoutes(keyword: string) {
|
|
async searchRoutes(keyword: string) {
|
|
|
await this.searchInput.fill(keyword);
|
|
await this.searchInput.fill(keyword);
|
|
|
- await this.searchButton.click();
|
|
|
|
|
|
|
+ // 防抖搜索,等待网络请求完成
|
|
|
|
|
+ await this.page.waitForTimeout(500); // 等待防抖延迟
|
|
|
await this.page.waitForLoadState('networkidle');
|
|
await this.page.waitForLoadState('networkidle');
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -134,6 +133,14 @@ export class RouteManagementPage {
|
|
|
|
|
|
|
|
async getRouteCount(): Promise<number> {
|
|
async getRouteCount(): Promise<number> {
|
|
|
const rows = await this.routeTable.locator('tbody tr').count();
|
|
const rows = await this.routeTable.locator('tbody tr').count();
|
|
|
|
|
+ // 如果只有一行且包含"暂无路线数据",则返回0
|
|
|
|
|
+ if (rows === 1) {
|
|
|
|
|
+ const firstRow = this.routeTable.locator('tbody tr').first();
|
|
|
|
|
+ const rowText = await firstRow.textContent();
|
|
|
|
|
+ if (rowText && rowText.includes('暂无路线数据')) {
|
|
|
|
|
+ return 0;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
return rows;
|
|
return rows;
|
|
|
}
|
|
}
|
|
|
|
|
|