fix: standardize unavailable page responses
This commit is contained in:
@@ -11,6 +11,10 @@ for (const path of [
|
||||
"/tackle",
|
||||
"/tackle/analytics",
|
||||
"/tackle/items/00000000-0000-0000-0000-000000000000",
|
||||
"/records",
|
||||
"/spots/unknown-0x0",
|
||||
"/report",
|
||||
"/status",
|
||||
]) {
|
||||
test(`${path} exposes a cache-safe unavailable state`, async ({ page }) => {
|
||||
test.skip(!unavailableRun, "Run with EXPECT_UNAVAILABLE=1 and an API-unavailable web process.");
|
||||
@@ -18,7 +22,8 @@ for (const path of [
|
||||
expect(response?.status(), `${path} status`).toBe(503);
|
||||
expect(response?.headers()["retry-after"], `${path} retry header`).toBe("60");
|
||||
expect(response?.headers()["cache-control"], `${path} cache header`).toBe("no-store");
|
||||
await expect(page.getByRole("alert")).toContainText(/временно недоступ|недоступен/i);
|
||||
await expect(page.getByRole("alert")).toContainText(/временно недоступ|недоступ/i);
|
||||
await expect(page.locator('meta[name="robots"]')).toHaveAttribute("content", "noindex, nofollow");
|
||||
await expect(page.locator("body")).not.toContainText(/Traceback|localhost:8000|API \d+/i);
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user