[verified] harden trash actions and mobile details
ci / gitleaks (push) Successful in 26s
ci / docker (push) Successful in 5m5s

This commit is contained in:
2026-09-21 09:37:55 +08:00
parent 8a4d1de9be
commit 927e15cf17
5 changed files with 108 additions and 14 deletions
+5 -4
View File
@@ -103,24 +103,25 @@ test('task rows use the body for detail and Trash keeps distinct actions', async
await openSidebarView(page, '回收站')
await expect(page.locator('.trash-page-context')).toContainText('删除的任务保留在这里,可整组恢复或永久删除。')
await expect(page.getByRole('heading', { name: '无截止日期', exact: true })).toBeVisible()
await expect(page.locator('.trash-safety-note')).toContainText('不支持子任务脱离父任务单独恢复或删除')
const restoreRow = await taskRow(page, restoreTitle)
const purgeRow = await taskRow(page, purgeTitle)
for (const deletedRow of [restoreRow, purgeRow]) {
await expect(deletedRow.getByRole('button', { name: '恢复' })).toBeVisible()
await expect(deletedRow.getByRole('button', { name: '永久删除' })).toBeVisible()
await expect(deletedRow.getByRole('button', { name: '打开任务操作' })).toBeVisible()
await expect(deletedRow.locator('.task-main')).not.toHaveAttribute('role')
await expect(deletedRow.locator('.task-main')).not.toHaveAttribute('tabindex')
expect(await deletedRow.locator('.task-detail-trigger, .task-check').count()).toBe(0)
}
await restoreRow.getByRole('button', { name: '恢复' }).click()
await expect(restoreRow).toHaveCount(0)
await purgeRow.getByRole('button', { name: '永久删除' }).click()
await purgeRow.getByRole('button', { name: '打开任务操作' }).click()
await page.getByRole('menuitem', { name: '永久删除' }).click()
const purgeDialog = page.getByRole('dialog', { name: `永久删除“${purgeTitle}”?` })
await expect(purgeDialog).toBeVisible()
// The UI can abort the completed 204 request while the confirmation overlay closes.
allowExpectedError(page, `requestfailed: DELETE ${baseURL}/api/v1/trash/`)
await purgeDialog.getByRole('button', { name: '确认', exact: true }).click()
await purgeDialog.getByLabel(`输入任务名称“${purgeTitle}”确认`).fill(purgeTitle)
await purgeDialog.getByRole('button', { name: '永久删除', exact: true }).click()
await expect(purgeRow).toHaveCount(0)
await page.reload()
await expect(page.locator('.task-row').filter({ hasText: restoreTitle })).toHaveCount(0)