14 lines
1.1 KiB
TypeScript
14 lines
1.1 KiB
TypeScript
import { test, expect } from "@playwright/test"
|
|
import { backup, setupBackups } from "./fixtures/backups"
|
|
|
|
for (const confirmed of [true, false]) test(`Бэкапы: удаление отсутствующего файла требует record-only receipt ${confirmed}`, async ({ page }) => {
|
|
await setupBackups(page); await page.route("**/api/backups", r => r.fulfill({ json: [{ ...backup, localFileStatus: "missing" }] }))
|
|
let calls = 0
|
|
await page.route("**/api/backups/backup-1?recordOnly=true", r => { calls++; return r.fulfill({ status: 204, headers: confirmed ? { "X-Backup-Delete-Mode": "record-only" } : {} }) })
|
|
await page.goto("/backups"); await page.getByRole("button", { name: "Удалить " + backup.filename, exact: true }).click()
|
|
const dialog = page.getByRole("alertdialog"); await dialog.getByRole("button", { name: "Удалить", exact: true }).click()
|
|
if (confirmed) await expect(dialog).toBeHidden()
|
|
else { await expect(dialog).toBeVisible(); await expect(dialog).toContainText("Не подтверждено удаление только записи истории") }
|
|
expect(calls).toBe(1)
|
|
})
|