test: e2e 选择器迁移为角色定位
This commit is contained in:
+4
-4
@@ -76,12 +76,12 @@ test.describe('Study page', () => {
|
||||
});
|
||||
|
||||
test('clicking add navigates to add-task form', async ({ page }) => {
|
||||
await page.locator('.action-card').locator('button', { hasText: '添加任务' }).click();
|
||||
await page.getByRole('button', { name: '添加任务' }).click();
|
||||
await expect(page).toHaveURL(/\/add-task/);
|
||||
});
|
||||
|
||||
test('clicking update navigates to update-task form', async ({ page }) => {
|
||||
await page.locator('.action-card').locator('button', { hasText: '更新任务' }).click();
|
||||
await page.getByRole('button', { name: '更新任务' }).click();
|
||||
await expect(page).toHaveURL(/\/update-task/);
|
||||
});
|
||||
|
||||
@@ -97,9 +97,9 @@ test.describe('Study page', () => {
|
||||
});
|
||||
});
|
||||
|
||||
await page.locator('.action-card').locator('button', { hasText: '删除任务' }).click();
|
||||
await page.getByRole('button', { name: '删除任务' }).click();
|
||||
// 处理确认弹窗
|
||||
const confirmBtn = page.locator('.el-message-box__btns button:has-text("确定删除")');
|
||||
const confirmBtn = page.getByRole('dialog').getByRole('button', { name: '确定删除' });
|
||||
await confirmBtn.waitFor({ timeout: 3000 });
|
||||
await confirmBtn.click();
|
||||
await expect(page.locator('.task-list-item')).toHaveCount(1, { timeout: 5000 });
|
||||
|
||||
Reference in New Issue
Block a user