fix(ui): сохранять черновики и результат настроек ACME
This commit is contained in:
1 parent
1c407b77de
commit
594e60a1f4
7 files changed
+223
-161
No files matched your search
@@ -31,3 +31,23 @@ for (const fails of [false, true]) test("Сертификаты: позднее
|
||||
await expect(toggle).toBeChecked(); await expect(page.getByText("СТАРОЕ СОХРАНЕНИЕ ОТКАЗ", { exact: true })).toHaveCount(0)
|
||||
await expect(page.getByText("Автообновление выключено", { exact: true })).toHaveCount(0)
|
||||
})
|
||||
|
||||
for (const fails of [false, true]) test("Сертификаты: позднее сохранение ACME/" + fails, async ({ page }) => {
|
||||
let started = false, completed = false, release!: () => void; const gate = new Promise<void>(r => release = r)
|
||||
await page.route("**/health", r => r.fulfill({ headers, json: { ok: true } }))
|
||||
await page.route("**/api/**", r => {
|
||||
const path = new URL(r.request().url()).pathname
|
||||
return r.fulfill({ headers, json: path === "/api/auth/config" ? { required: false } : path === "/api/servers" ? [server] : path === "/api/certificates/state" ? state() : path === "/api/certificates/renew-settings" ? { enabled: true, intervalSec: 21600, renewBeforeDays: 30 } : { directoryUrl: "https://acme.example.test/directory", tokenConfigured: false } })
|
||||
})
|
||||
await page.route("**/api/certificates/acme-settings", async r => {
|
||||
if (r.request().method() !== "PUT") return r.fallback()
|
||||
started = true; await gate
|
||||
try { await r.fulfill(fails ? { headers, status: 503, json: { error: "СТАРОЕ СОХРАНЕНИЕ ACME ОТКАЗ" } } : { headers, json: { directoryUrl: "https://old.example.test/directory", tokenConfigured: true } }) } catch {} finally { completed = true }
|
||||
})
|
||||
await page.goto("/certificates"); const directory = page.getByRole("textbox", { name: "ACME directory URL", exact: true })
|
||||
await expect(directory).toHaveValue("https://acme.example.test/directory"); await directory.fill("https://old.example.test/directory"); await page.getByRole("button", { name: "Сохранить настройки", 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("/certificates"); await expect(directory).toHaveValue("https://acme.example.test/directory"); release(); await expect.poll(() => completed).toBe(true)
|
||||
await expect(directory).toHaveValue("https://acme.example.test/directory"); await expect(page.getByText("СТАРОЕ СОХРАНЕНИЕ ACME ОТКАЗ", { exact: true })).toHaveCount(0)
|
||||
await expect(page.getByText("Настройки ACME сохранены", { exact: true })).toHaveCount(0)
|
||||
})
|
||||
Reference in new issue
Block a user