Files
baserow/e2e-tests/tests/api/redoc.spec.ts
Davide Silvestri ffa2884169 fix(api): serve api documentation in air-gapped installations (#6882)
* fix: serve the API reference on air-gapped installations

* test: verify the packaged ReDoc bundle renders offline

* perf: compress and cache versioned ReDoc assets
2026-11-26 15:35:49 +00:00

27 lines
781 B
TypeScript

import { expect, test } from "@playwright/test";
import { baserowConfig } from "../../playwright.config";
test("renders the API reference with only the backend reachable", async ({
page,
}) => {
const docs = new URL("/api/redoc/", baserowConfig.PUBLIC_BACKEND_URL);
await page.route(
(url) => /^https?:$/.test(url.protocol) && url.origin !== docs.origin,
(route) => route.abort()
);
await page.route(new URL("/api/schema.json", docs).href, (route) =>
route.fulfill({
json: {
openapi: "3.0.3",
info: { title: "Offline API reference", version: "1.0" },
paths: {},
},
})
);
await page.goto(docs.href);
await expect(
page.getByRole("heading", { level: 1, name: /Offline API reference/ })
).toBeVisible();
});