mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(site): add healthz page (#458)
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.
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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" })
|
||||
})
|
||||
@@ -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 = () => {
|
||||
<Route index element={<IndexPage />} />
|
||||
|
||||
<Route path="login" element={<SignInPage />} />
|
||||
<Route path="healthz" element={<HealthzPage />} />
|
||||
<Route path="cli-auth" element={<CliAuthenticationPage />} />
|
||||
|
||||
<Route path="projects">
|
||||
|
||||
@@ -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 = () => <div>ok</div>
|
||||
Reference in New Issue
Block a user