|
@@ -234,14 +234,16 @@ export class ActivityManagementPage {
|
|
|
const statusButton = activityRow.locator('[data-testid^="toggle-activity-"]');
|
|
const statusButton = activityRow.locator('[data-testid^="toggle-activity-"]');
|
|
|
await statusButton.waitFor({ state: 'visible', timeout: 10000 });
|
|
await statusButton.waitFor({ state: 'visible', timeout: 10000 });
|
|
|
|
|
|
|
|
- const currentStatus = await statusButton.textContent();
|
|
|
|
|
|
|
+ // 获取当前状态(从状态单元格获取,不是按钮文本)
|
|
|
|
|
+ const currentStatus = await this.getActivityStatus(name);
|
|
|
await statusButton.click();
|
|
await statusButton.click();
|
|
|
|
|
|
|
|
// 等待状态切换确认对话框出现 - 使用data-testid
|
|
// 等待状态切换确认对话框出现 - 使用data-testid
|
|
|
await this.page.waitForSelector('[data-testid="status-confirm-dialog"]', { state: 'visible', timeout: 10000 });
|
|
await this.page.waitForSelector('[data-testid="status-confirm-dialog"]', { state: 'visible', timeout: 10000 });
|
|
|
|
|
|
|
|
// 确认状态切换 - 点击禁用或启用按钮
|
|
// 确认状态切换 - 点击禁用或启用按钮
|
|
|
- const actionText = currentStatus === '禁用' ? '启用' : '禁用';
|
|
|
|
|
|
|
+ // 注意:按钮文本是当前要执行的操作,不是当前状态
|
|
|
|
|
+ const actionText = currentStatus === '启用' ? '禁用' : '启用';
|
|
|
await this.page.locator('[data-testid="status-confirm-dialog"]').getByRole('button', { name: actionText }).click();
|
|
await this.page.locator('[data-testid="status-confirm-dialog"]').getByRole('button', { name: actionText }).click();
|
|
|
|
|
|
|
|
// 等待操作完成
|
|
// 等待操作完成
|