From 5bbcec1ef446e6977d41ec10c3af5f9fb5784b44 Mon Sep 17 00:00:00 2001 From: G r e y Date: Wed, 16 Mar 2022 02:49:19 +0000 Subject: [PATCH 1/2] feat(site): add healthz page Summary: This is a port of v1 healthz page to v2 Impact: A simple way to check site health (requires no auth). Good smoke test for e2e. --- site/app.tsx | 2 ++ site/e2e/pom/HealthzPage.ts | 13 +++++++++++++ site/e2e/tests/healthz.spec.ts | 8 ++++++++ site/pages/healthz.tsx | 8 ++++++++ 4 files changed, 31 insertions(+) create mode 100644 site/e2e/pom/HealthzPage.ts create mode 100644 site/e2e/tests/healthz.spec.ts create mode 100644 site/pages/healthz.tsx diff --git a/site/app.tsx b/site/app.tsx index 51e0872b09eb5..0178b992b2018 100644 --- a/site/app.tsx +++ b/site/app.tsx @@ -14,6 +14,7 @@ import { ProjectsPage } from "./pages/projects" import { ProjectPage } from "./pages/projects/[organization]/[project]" import { CreateWorkspacePage } from "./pages/projects/[organization]/[project]/create" import { WorkspacePage } from "./pages/workspaces/[workspace]" +import { HealthzPage } from "./pages/healthz" export const App: React.FC = () => { return ( @@ -45,6 +46,7 @@ export const App: React.FC = () => { } /> } /> + } /> } /> diff --git a/site/e2e/pom/HealthzPage.ts b/site/e2e/pom/HealthzPage.ts new file mode 100644 index 0000000000000..7a85ec38fb07b --- /dev/null +++ b/site/e2e/pom/HealthzPage.ts @@ -0,0 +1,13 @@ +import { Locator, Page } from "@playwright/test" +import { BasePom } from "./BasePom" + +export class HealthzPage extends BasePom { + constructor(baseURL: string | undefined, page: Page) { + super(baseURL, "/healthz", page) + } + + getOk(): Locator { + const locator = this.page.locator("text=ok") + return locator + } +} diff --git a/site/e2e/tests/healthz.spec.ts b/site/e2e/tests/healthz.spec.ts new file mode 100644 index 0000000000000..c58ede2503bd3 --- /dev/null +++ b/site/e2e/tests/healthz.spec.ts @@ -0,0 +1,8 @@ +import { test } from "@playwright/test" +import { HealthzPage } from "../pom/HealthzPage" + +test("Healthz is available without authentication", async ({ baseURL, page }) => { + const healthzPage = new HealthzPage(baseURL, page) + await page.goto(healthzPage.url, { waitUntil: "networkidle" }) + await healthzPage.getOk().waitFor({ state: "visible" }) +}) diff --git a/site/pages/healthz.tsx b/site/pages/healthz.tsx new file mode 100644 index 0000000000000..76b000e10261b --- /dev/null +++ b/site/pages/healthz.tsx @@ -0,0 +1,8 @@ +import React from "react" + +/** + * HealthzPage is a page that is available without authentication that is used + * for reporting whether or not the Dashboard is online. It should be + * accessible by humans and services. + */ +export const HealthzPage: React.FC = () =>
ok
From 8e0c32ce46bc8b8ac723c3d6d3ef3483277f1eef Mon Sep 17 00:00:00 2001 From: G r e y Date: Wed, 16 Mar 2022 07:03:06 +0000 Subject: [PATCH 2/2] fixup: move healthz page --- site/{ => src}/pages/healthz.tsx | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename site/{ => src}/pages/healthz.tsx (100%) diff --git a/site/pages/healthz.tsx b/site/src/pages/healthz.tsx similarity index 100% rename from site/pages/healthz.tsx rename to site/src/pages/healthz.tsx