fix(backups): сохранять расписание и хранилище независимо
This commit is contained in:
1 parent
5ce21e9a47
commit
8e01666e0e
12 files changed
+286
-104
No files matched your search
@@ -18,3 +18,21 @@ for (const change of ["backend", "mode"]) for (const fails of [false, true]) tes
|
||||
await expect(page.getByText("СТАРЫЙ БЭКАП.rsc", { exact: true })).toHaveCount(0)
|
||||
await expect(page.getByText(/СТАРАЯ ОШИБКА БЭКАПА/)).toHaveCount(0)
|
||||
})
|
||||
|
||||
for (const kind of ["schedule", "storage"]) for (const fails of [false, true]) test("Бэкапы: позднее сохранение/" + kind + "/" + fails, async ({ page }) => {
|
||||
await setupBackups(page, headers)
|
||||
let started = false, completed = false, release!: () => void; const gate = new Promise<void>(r => release = r)
|
||||
await page.route("**/api/backups/" + kind, async r => {
|
||||
if (r.request().method() !== "PUT") return r.fallback()
|
||||
started = true; await gate
|
||||
try { await r.fulfill(fails ? { headers, status: 503, json: { error: "СТАРОЕ СОХРАНЕНИЕ БЭКАПА" } } : { headers, json: { ...r.request().postDataJSON(), secretConfigured: false, serverIds: ["1"] } }) } catch {} finally { completed = true }
|
||||
})
|
||||
await page.goto("/backups"); await page.getByRole("tab", { name: "Настройки", exact: true }).click()
|
||||
const label = kind === "schedule" ? "Сохранить расписание" : "Сохранить хранилище"
|
||||
await page.getByRole("button", { name: label, exact: true }).click(); await expect.poll(() => started).toBe(true)
|
||||
await page.goto("/settings"); const input = page.getByPlaceholder("http://localhost:8000"); await input.fill("http://localhost:8101"); await input.press("Enter")
|
||||
await page.goto("/backups"); release(); await expect.poll(() => completed).toBe(true)
|
||||
await expect(page.getByText(backup.filename, { exact: true })).toBeVisible()
|
||||
await expect(page.getByText(/СТАРОЕ СОХРАНЕНИЕ БЭКАПА/)).toHaveCount(0)
|
||||
await expect(page.getByText(kind === "schedule" ? "Расписание сохранено" : "Хранилище сохранено", { exact: true })).toHaveCount(0)
|
||||
})
|
||||
Reference in new issue
Block a user