Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,145 @@
|
||||
import { expect, test } from "./utils/test";
|
||||
import { expectNoCriticalA11yViolations } from "./utils/axe";
|
||||
import { getTenantCredentials, loginAsTenantUser } from "./utils/auth";
|
||||
import { compactMobileViewport, expectNoHorizontalOverflow, narrowMobileViewport } from "./utils/mobile";
|
||||
import { escapeRegExp, skipIfUnavailable } from "./utils/navigation";
|
||||
import { skipOrFailWhenE2eFixtureMissing, skipOrFailWhenE2eInputsMissing } from "./utils/readiness";
|
||||
|
||||
const credentials = getTenantCredentials();
|
||||
const apiPath = process.env.E2E_TENANT_API_PATH;
|
||||
const apiDocsPath = process.env.E2E_TENANT_API_DOCS_PATH;
|
||||
const apiKeysPath = process.env.E2E_TENANT_API_KEYS_PATH;
|
||||
const apiLogsPath = process.env.E2E_TENANT_API_LOGS_PATH;
|
||||
const readinessEndpoint = "/v1/e2e-readiness";
|
||||
|
||||
test.describe("tenant API docs and logs mobile a11y", () => {
|
||||
test.use({ viewport: narrowMobileViewport, isMobile: true, hasTouch: true });
|
||||
|
||||
test.beforeEach(() => {
|
||||
skipOrFailWhenE2eInputsMissing(
|
||||
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_API_PATH", "E2E_TENANT_API_KEYS_PATH", "E2E_TENANT_API_DOCS_PATH", "E2E_TENANT_API_LOGS_PATH"],
|
||||
"Tenant API docs/logs E2E inputs not configured"
|
||||
);
|
||||
});
|
||||
|
||||
test("shows seeded API log summary and navigates to details", async ({ page }) => {
|
||||
await loginAsTenantUser(page, credentials!);
|
||||
|
||||
const response = await page.goto(`${apiPath!}?groupBy=method&groupBy=endpoint`, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, `Tenant API overview path ${apiPath}`);
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(apiPath!)}(?:[?#].*)?$`, "u"));
|
||||
await expectApiTabs(page);
|
||||
|
||||
await expect(page.getByText(readinessEndpoint, { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("GET", { exact: true }).first()).toBeVisible();
|
||||
const detailsLink = page.getByRole("link", { name: /details|details\s*→|details\s*->/iu }).first();
|
||||
if ((await detailsLink.count()) === 0) {
|
||||
skipOrFailWhenE2eFixtureMissing("Tenant API summary details link is not visible for this fixture");
|
||||
}
|
||||
await detailsLink.click();
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(apiLogsPath!)}.*(?:method=GET|endpoint=%2Fv1%2Fe2e-readiness)`, "u"));
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
});
|
||||
|
||||
test("shows seeded API logs without tenant delete controls", async ({ page }) => {
|
||||
await loginAsTenantUser(page, credentials!);
|
||||
|
||||
const response = await page.goto(`${apiLogsPath!}?method=GET&endpoint=%2Fv1%2Fe2e-readiness`, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, `Tenant API logs path ${apiLogsPath}`);
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(apiLogsPath!)}(?:[?#].*)?$`, "u"));
|
||||
await expectApiTabs(page);
|
||||
|
||||
await expect(page.getByText(readinessEndpoint, { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("GET", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("200", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.locator('input[type="search"], input[name="q"], input[name="search"]').first()).toBeVisible();
|
||||
await expect(page.locator('form button:has-text("Delete"), form button:has-text("Löschen")')).toHaveCount(0);
|
||||
|
||||
const methodLink = page.getByRole("link", { name: /^GET$/u }).first();
|
||||
if ((await methodLink.count()) > 0) {
|
||||
await methodLink.click();
|
||||
await expect(page).toHaveURL(/method=GET/u);
|
||||
}
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
});
|
||||
|
||||
test("renders API docs editor and keeps API tabs reachable", async ({ page }) => {
|
||||
await loginAsTenantUser(page, credentials!);
|
||||
|
||||
const response = await page.goto(apiDocsPath!, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, response, `Tenant API docs path ${apiDocsPath}`);
|
||||
await expect(page).toHaveURL(new RegExp(`${escapeRegExp(apiDocsPath!)}(?:[?#].*)?$`, "u"));
|
||||
await expectApiTabs(page);
|
||||
|
||||
await expect(page.getByRole("link", { name: /openapi/i }).first()).toBeVisible();
|
||||
const editor = page.locator(".monaco-editor, textarea").first();
|
||||
// The docs editor is Monaco, lazy-loaded client-only (React.lazy + Suspense),
|
||||
// so the server render emits only an empty fallback div. Wait for it to attach
|
||||
// after hydration before the one-shot count() guard.
|
||||
await editor.waitFor({ state: "attached", timeout: 15_000 }).catch(() => undefined);
|
||||
if ((await editor.count()) === 0) {
|
||||
skipOrFailWhenE2eFixtureMissing("Tenant API docs editor is not visible for this fixture");
|
||||
}
|
||||
await expect(editor).toBeVisible();
|
||||
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
});
|
||||
});
|
||||
|
||||
test.describe("tenant API docs and logs compact mobile a11y", () => {
|
||||
test.use({ viewport: compactMobileViewport, isMobile: true, hasTouch: true });
|
||||
|
||||
test.beforeEach(() => {
|
||||
skipOrFailWhenE2eInputsMissing(
|
||||
["E2E_TENANT_EMAIL", "E2E_TENANT_PASSWORD", "E2E_TENANT_API_PATH", "E2E_TENANT_API_KEYS_PATH", "E2E_TENANT_API_DOCS_PATH", "E2E_TENANT_API_LOGS_PATH"],
|
||||
"Tenant API docs/logs E2E inputs not configured"
|
||||
);
|
||||
});
|
||||
|
||||
test("keeps logs and docs usable at 320px", async ({ page }) => {
|
||||
await loginAsTenantUser(page, credentials!);
|
||||
|
||||
const logsResponse = await page.goto(`${apiLogsPath!}?method=GET&endpoint=%2Fv1%2Fe2e-readiness`, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, logsResponse, `Tenant API logs path ${apiLogsPath}`);
|
||||
await expectApiTabs(page);
|
||||
await expect(page.getByText(readinessEndpoint, { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("GET", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.getByText("200", { exact: true }).first()).toBeVisible();
|
||||
await expect(page.locator('input[type="search"], input[name="q"], input[name="search"]').first()).toBeVisible();
|
||||
await expect(page.locator('form button:has-text("Delete"), form button:has-text("Löschen")')).toHaveCount(0);
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
|
||||
const docsResponse = await page.goto(apiDocsPath!, { waitUntil: "domcontentloaded" });
|
||||
await skipIfUnavailable(page, docsResponse, `Tenant API docs path ${apiDocsPath}`);
|
||||
await expectApiTabs(page);
|
||||
await expect(page.getByRole("link", { name: /openapi/i }).first()).toBeVisible();
|
||||
const editor = page.locator(".monaco-editor, textarea").first();
|
||||
// The docs editor is Monaco, lazy-loaded client-only (React.lazy + Suspense),
|
||||
// so the server render emits only an empty fallback div. Wait for it to attach
|
||||
// after hydration before the one-shot count() guard.
|
||||
await editor.waitFor({ state: "attached", timeout: 15_000 }).catch(() => undefined);
|
||||
if ((await editor.count()) === 0) {
|
||||
skipOrFailWhenE2eFixtureMissing("Tenant API docs editor is not visible for this fixture");
|
||||
}
|
||||
await expect(editor).toBeVisible({ timeout: 10_000 });
|
||||
await expectNoHorizontalOverflow(page);
|
||||
await expectNoCriticalA11yViolations(page);
|
||||
});
|
||||
});
|
||||
|
||||
async function expectApiTabs(page: import("@playwright/test").Page) {
|
||||
// The API sub-nav tab bar is responsive (hidden lg:flex): the four tab links
|
||||
// are rendered but collapsed on mobile viewports, so assert they are present
|
||||
// in the markup rather than visibly displayed. The content assertions in each
|
||||
// test prove the active sub-page actually rendered.
|
||||
await expect(page.locator(`a[href="${apiPath!}"]`).first()).toBeAttached();
|
||||
await expect(page.locator(`a[href="${apiLogsPath!}"]`).first()).toBeAttached();
|
||||
await expect(page.locator(`a[href="${apiKeysPath!}"]`).first()).toBeAttached();
|
||||
await expect(page.locator(`a[href="${apiDocsPath!}"]`).first()).toBeAttached();
|
||||
}
|
||||
Reference in new issue
Block a user