|
|
@@ -200,11 +200,11 @@ export class ActivityManagementPage {
|
|
|
await deleteButton.waitFor({ state: 'visible', timeout: 10000 });
|
|
|
await deleteButton.click();
|
|
|
|
|
|
- // 等待删除确认对话框出现
|
|
|
- await this.page.waitForSelector('[role="dialog"]', { state: 'visible', timeout: 10000 });
|
|
|
+ // 等待删除确认对话框出现 - 使用data-testid
|
|
|
+ await this.page.waitForSelector('[data-testid="delete-confirm-dialog"]', { state: 'visible', timeout: 10000 });
|
|
|
|
|
|
// 确认删除 - 点击删除按钮
|
|
|
- await this.page.locator('[role="dialog"]').getByRole('button', { name: '删除' }).click();
|
|
|
+ await this.page.locator('[data-testid="delete-confirm-dialog"]').getByRole('button', { name: '删除' }).click();
|
|
|
|
|
|
// 等待删除操作完成
|
|
|
try {
|
|
|
@@ -221,8 +221,7 @@ export class ActivityManagementPage {
|
|
|
console.log('删除操作没有显示提示信息,继续执行');
|
|
|
}
|
|
|
|
|
|
- // 刷新页面确认活动是否被删除
|
|
|
- await this.page.reload();
|
|
|
+ // 等待页面状态稳定,不需要强制刷新
|
|
|
await this.page.waitForLoadState('networkidle');
|
|
|
await this.expectToBeVisible();
|
|
|
}
|
|
|
@@ -238,12 +237,12 @@ export class ActivityManagementPage {
|
|
|
const currentStatus = await statusButton.textContent();
|
|
|
await statusButton.click();
|
|
|
|
|
|
- // 等待状态切换确认对话框出现
|
|
|
- await this.page.waitForSelector('[role="dialog"]', { state: 'visible', timeout: 10000 });
|
|
|
+ // 等待状态切换确认对话框出现 - 使用data-testid
|
|
|
+ await this.page.waitForSelector('[data-testid="status-confirm-dialog"]', { state: 'visible', timeout: 10000 });
|
|
|
|
|
|
// 确认状态切换 - 点击禁用或启用按钮
|
|
|
const actionText = currentStatus === '禁用' ? '启用' : '禁用';
|
|
|
- await this.page.locator('[role="dialog"]').getByRole('button', { name: actionText }).click();
|
|
|
+ await this.page.locator('[data-testid="status-confirm-dialog"]').getByRole('button', { name: actionText }).click();
|
|
|
|
|
|
// 等待操作完成
|
|
|
await this.page.waitForLoadState('networkidle');
|
|
|
@@ -266,7 +265,8 @@ export class ActivityManagementPage {
|
|
|
const activityRow = await this.getActivityByName(name);
|
|
|
if (!activityRow) return null;
|
|
|
|
|
|
- const statusButton = activityRow.locator('button').nth(2);
|
|
|
- return await statusButton.textContent();
|
|
|
+ // 状态文本在第五列(索引4)
|
|
|
+ const statusCell = activityRow.locator('td').nth(4);
|
|
|
+ return await statusCell.textContent();
|
|
|
}
|
|
|
}
|