Repository navigation
test(e2e): add tab-specific Playwright specs (H3D-CLAUDE-PLAYWRIGHT) #55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Ghenghis
merged 1 commit into
feat/hermes3d-7-complete-gui-repo-wiring
from
claude/playwright
May 7, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,117 @@ | ||
| import { expect, type Page, type Route } from "@playwright/test"; | ||
|
|
||
| /** | ||
| * Shared helpers for tab-specific Playwright specs. | ||
| * | ||
| * No-fake contract: | ||
| * - These helpers never invent backend payloads. They only forward real backend | ||
| * responses or assert visible blocked/empty states truthfully. | ||
| * - Specs that need to stub a route should pass real-shape JSON and call | ||
| * fulfillJson directly; helpers here keep to navigation, error capture, and | ||
| * forbidden-term scans of the rendered DOM. | ||
| */ | ||
|
|
||
| export const FORBIDDEN_VISIBLE_TERMS = [ | ||
| "TODO", | ||
| "FIXME", | ||
| "lorem ipsum", | ||
| "placeholder text", | ||
| "sample data", | ||
| "mock data", | ||
| "dummy data", | ||
| "fake data", | ||
| ] as const; | ||
|
|
||
| export interface TabFixture { | ||
| /** Sidebar button label as rendered in routes.tsx. */ | ||
| label: string; | ||
| /** Root element data-testid emitted by the tab component. */ | ||
| rootTestId: string; | ||
| } | ||
|
|
||
| export const TAB_FIXTURES: Record<string, TabFixture> = { | ||
| dashboard: { label: "Dashboard", rootTestId: "dashboard-root" }, | ||
| source_os: { label: "Source OS", rootTestId: "source-os-root" }, | ||
| autopilot: { label: "Autopilot", rootTestId: "autopilot-root" }, | ||
| design: { label: "Design", rootTestId: "design-root" }, | ||
| gen3d: { label: "3D Generation", rootTestId: "gen3d-root" }, | ||
| jobs: { label: "Jobs", rootTestId: "jobs-root" }, | ||
| printers: { label: "Printers", rootTestId: "printers-root" }, | ||
| observe: { label: "Observe", rootTestId: "observe-root" }, | ||
| voice: { label: "Voice", rootTestId: "voice-root" }, | ||
| agents: { label: "Agents", rootTestId: "agents-root" }, | ||
| learning: { label: "Learning", rootTestId: "learning-root" }, | ||
| artifacts: { label: "Artifacts", rootTestId: "artifacts-root" }, | ||
| approvals: { label: "Approvals", rootTestId: "approvals-root" }, | ||
| plugins: { label: "Plugins", rootTestId: "plugins-root" }, | ||
| settings: { label: "Settings", rootTestId: "settings-root" }, | ||
| roadmap: { label: "Roadmap", rootTestId: "roadmap-root" }, | ||
| }; | ||
|
|
||
| /** Attach console + pageerror capture and expose a window getter. */ | ||
| export async function attachErrorCapture(page: Page): Promise<void> { | ||
| const errors: string[] = []; | ||
| page.on("pageerror", (error) => errors.push(error.message)); | ||
| page.on("console", (message) => { | ||
| if (message.type() === "error") { | ||
| errors.push(message.text()); | ||
| } | ||
| }); | ||
| await page.exposeFunction("__hermes3dErrors", () => errors); | ||
| } | ||
|
|
||
| export async function readErrors(page: Page): Promise<string[]> { | ||
| return page.evaluate(async () => { | ||
| const reader = window as unknown as { __hermes3dErrors: () => Promise<string[]> }; | ||
| return reader.__hermes3dErrors(); | ||
| }); | ||
| } | ||
|
|
||
| export async function fulfillJson(route: Route, json: unknown, status = 200): Promise<void> { | ||
| await route.fulfill({ | ||
| status, | ||
| contentType: "application/json", | ||
| body: JSON.stringify(json), | ||
| }); | ||
| } | ||
|
|
||
| /** | ||
| * Click the left-rail sidebar button for a given tab and assert its root mounts. | ||
| * Uses the Roadmap hash route when label === "Roadmap" since it is excluded | ||
| * from primary navigation. | ||
| */ | ||
| export async function openTab(page: Page, fixture: TabFixture): Promise<void> { | ||
| if (fixture.label === "Roadmap") { | ||
| await page.goto("/#roadmap"); | ||
| } else { | ||
| const button = page.getByRole("button", { name: fixture.label, exact: true }); | ||
| await expect(button, `${fixture.label} sidebar button`).toBeVisible(); | ||
| await button.click(); | ||
| } | ||
| await expect( | ||
| page.getByTestId(fixture.rootTestId), | ||
| `${fixture.label} root mounts as ${fixture.rootTestId}`, | ||
| ).toBeVisible({ timeout: 15_000 }); | ||
| } | ||
|
|
||
| /** | ||
| * Read the visible text of the active tab root and assert that no | ||
| * forbidden mock/placeholder phrases appear in production surfaces. | ||
| * Forbidden terms are checked case-insensitively as standalone substrings. | ||
| */ | ||
| export async function assertNoFakeVisibleText(page: Page, rootTestId: string): Promise<void> { | ||
| const text = await page.getByTestId(rootTestId).innerText(); | ||
| const lowered = text.toLowerCase(); | ||
| for (const term of FORBIDDEN_VISIBLE_TERMS) { | ||
| expect( | ||
| lowered.includes(term.toLowerCase()), | ||
| `forbidden term "${term}" must not appear in ${rootTestId}`, | ||
| ).toBe(false); | ||
| } | ||
| } | ||
|
|
||
| /** Assert the page has no JS errors captured by attachErrorCapture. */ | ||
| export async function assertNoErrors(page: Page): Promise<void> { | ||
| const errors = await readErrors(page); | ||
| expect(errors, errors.join("\n")).toEqual([]); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Agents tab mounts and shows Hermes Agent operator surface", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.agents); | ||
| const root = page.getByTestId(TAB_FIXTURES.agents.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.agents.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| fulfillJson, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Approvals tab mounts and renders an honest empty queue when no approvals are pending", async ({ page }) => { | ||
| await page.route("**/api/approvals**", (route) => fulfillJson(route, { approvals: [] })); | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.approvals); | ||
| const root = page.getByTestId(TAB_FIXTURES.approvals.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.approvals.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| fulfillJson, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Artifacts tab mounts and renders empty-state when no artifacts exist", async ({ page }) => { | ||
| await page.route("**/api/artifacts**", (route) => fulfillJson(route, { artifacts: [] })); | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.artifacts); | ||
| const root = page.getByTestId(TAB_FIXTURES.artifacts.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.artifacts.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| fulfillJson, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Autopilot tab mounts and surfaces honest readiness rows", async ({ page }) => { | ||
| await page.route("**/api/autopilot/readiness", (route) => | ||
| fulfillJson(route, [ | ||
| { id: "printer_connectivity", name: "Printer Connectivity", ready: true, message: "" }, | ||
| { | ||
| id: "api_token_set", | ||
| name: "API Token Set", | ||
| ready: false, | ||
| message: "Token missing from runtime env.", | ||
| fix_target: "settings", | ||
| }, | ||
| ]), | ||
| ); | ||
| await page.route("**/api/autopilot/guardrails", (route) => fulfillJson(route, [])); | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.autopilot); | ||
| const root = page.getByTestId(TAB_FIXTURES.autopilot.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| // Truthful empty-state for guardrails plus a readiness row should appear. | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.autopilot.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Dashboard renders live root and exposes the Hermes Agent chat mirror", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.dashboard); | ||
| // Hermes Agent chat mirror is required from every dashboard surface. | ||
| // We assert the chat-mirror trigger is reachable rather than fabricating any content. | ||
| const root = page.getByTestId(TAB_FIXTURES.dashboard.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.dashboard.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); | ||
|
|
||
| test("Dashboard direct hash route mounts dashboard root", async ({ page }) => { | ||
| await page.goto("/#dashboard"); | ||
| await expect(page.getByTestId(TAB_FIXTURES.dashboard.rootTestId)).toBeVisible({ timeout: 15_000 }); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Design tab mounts and exposes parametric template surface", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.design); | ||
| const root = page.getByTestId(TAB_FIXTURES.design.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.design.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("3D Generation tab mounts and exposes the generation entry surface", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.gen3d); | ||
| const root = page.getByTestId(TAB_FIXTURES.gen3d.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.gen3d.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| fulfillJson, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Jobs tab mounts and renders an honest empty queue when backend reports none", async ({ page }) => { | ||
| await page.route("**/api/jobs", (route) => fulfillJson(route, { jobs: [] })); | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.jobs); | ||
| const root = page.getByTestId(TAB_FIXTURES.jobs.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.jobs.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Learning tab mounts and exposes the idle workbench surface", async ({ page }) => { | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.learning); | ||
| const root = page.getByTestId(TAB_FIXTURES.learning.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.learning.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import { expect, test } from "@playwright/test"; | ||
| import { | ||
| TAB_FIXTURES, | ||
| assertNoErrors, | ||
| assertNoFakeVisibleText, | ||
| attachErrorCapture, | ||
| fulfillJson, | ||
| openTab, | ||
| } from "./_helpers"; | ||
|
|
||
| test.beforeEach(async ({ page }) => { | ||
| await attachErrorCapture(page); | ||
| }); | ||
|
|
||
| test("Observe tab mounts and renders the camera surface root", async ({ page }) => { | ||
| // Stub printers so Observe never tries to reach the real S1/T1/V400 fleet. | ||
| await page.route("**/api/printers", (route) => fulfillJson(route, { printers: [] })); | ||
| await page.goto("/"); | ||
| await openTab(page, TAB_FIXTURES.observe); | ||
| const root = page.getByTestId(TAB_FIXTURES.observe.rootTestId); | ||
| await expect(root).toBeVisible(); | ||
| await assertNoFakeVisibleText(page, TAB_FIXTURES.observe.rootTestId); | ||
| await assertNoErrors(page); | ||
| }); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current implementation uses
includes()for forbidden term checks, which can lead to false positives if a term appears as a substring of a legitimate word (e.g., "mock" matching in "hammock" or "sample" in "resample"). Since the intent is to find "standalone substrings", using a regular expression with word boundaries (\b) would be more reliable.