fix(frontend): clarify workspace information

This commit is contained in:
User
2026-08-22 20:48:03 +02:00
parent 9c47fb5f3d
commit 35aafc5e4c
2 changed files with 92 additions and 30 deletions
+46 -15
View File
@@ -169,7 +169,7 @@ test("offers a button above the workspace list that returns to Level 1", async (
expect(screen.queryByRole("heading", { name: "Workspace-specific actions" })).not.toBeInTheDocument();
});
test("level one explains the read-only Git sequence and the repository update button", async () => {
test("level one explains workspace files, shared repositories, and the read-only Git flow", async () => {
const user = userEvent.setup();
server.use(http.post("/api/workspace-registry/pull", () => HttpResponse.json({
branch: "main", head: "b".repeat(40), ahead: 0, behind: 0, degraded: false,
@@ -178,30 +178,56 @@ test("level one explains the read-only Git sequence and the repository update bu
expect(await screen.findByRole("heading", { name: "Workspace management" })).toBeVisible();
const overview = screen.getByTestId("workspace-overview");
expect(within(overview).getByText(/Git server such as GitHub, GitLab, or Gitea/i)).toBeVisible();
expect(within(overview).getByText(/configured during ThothII installation/i)).toBeVisible();
const repositoryStep = within(overview).getAllByRole("listitem")[0];
expect(repositoryStep).toHaveTextContent(/create a workspace repository/i);
expect(repositoryStep).toHaveTextContent(/one directory for each workspace/i);
expect(repositoryStep).toHaveTextContent(/thoth-workspaces\.yaml/i);
expect(repositoryStep).toHaveTextContent(/database connection/i);
expect(repositoryStep).toHaveTextContent(/Evidence sources/i);
expect(repositoryStep).toHaveTextContent(/vector-database collection/i);
expect(within(overview).getByRole("heading", { name: "What workspace files tell ThothII" })).toBeVisible();
expect(within(overview).getByText(/A workspace file describes one data environment/i)).toBeVisible();
expect(within(overview).getByText(/one Git repository can contain many workspaces/i)).toBeVisible();
expect(within(overview).getByText(/each workspace has its own directory/i)).toHaveTextContent(/database target/i);
expect(within(overview).getByText(/each workspace has its own directory/i)).toHaveTextContent(/Evidence/i);
const repositorySteps = within(overview).getByRole("list");
expect(repositorySteps).toHaveClass("gap-0");
expect(within(repositorySteps).getAllByRole("listitem")).toHaveLength(3);
expect(within(overview).getByRole("link", { name: /workspace authoring instructions on GitHub/i })).toHaveAttribute(
"href",
"https://github.com/mptyl/ThothII/blob/main/docs/install/local-workspace-registry.md#prepare-and-publish-a-workspace-source",
);
const repositoryLink = await within(overview).findByRole("link", {
name: "git.example.test/analytics/thoth-workspaces",
});
expect(repositoryLink).toHaveAttribute("href", "https://git.example.test/analytics/thoth-workspaces");
expect(repositoryLink).toHaveAttribute("target", "_blank");
expect(repositoryLink).toHaveAttribute("rel", "noreferrer");
expect(within(overview).getByText(/configured during ThothII installation/i)).toBeVisible();
expect(within(overview).getAllByText(/managed read-only checkout/i)).toHaveLength(2);
expect(within(overview).getByText(/current active revision remains unchanged/i)).toBeVisible();
expect(within(overview).getByText(/No workspace selection is required/i)).toBeVisible();
expect(await within(overview).findByText("git.example.test/analytics/thoth-workspaces")).toBeVisible();
await user.click(screen.getByRole("button", { name: "Update workspace repository" }));
expect(await screen.findByText("Workspace repository updated and validated.")).toBeVisible();
expect(screen.getByText(/create a workspace repository/i)).toBeInTheDocument();
expect(screen.getByText(/A workspace file describes one data environment/i)).toBeInTheDocument();
expect(screen.queryByText(/create a workspace repository/i)).not.toBeInTheDocument();
expect(screen.queryByText(/import|export|bundle/i)).not.toBeInTheDocument();
});
test("shows a local workspace repository as text instead of an invalid web link", async () => {
server.use(http.get("/api/workspace-registry/status", () => HttpResponse.json({
branch: "main",
head: "a".repeat(40),
ahead: 0,
behind: 0,
degraded: false,
repository: {
host: "local",
repository: "configured-repository",
transport: "local",
},
})));
renderManager();
const overview = await screen.findByTestId("workspace-overview");
expect(await within(overview).findByText("local/configured-repository")).toBeVisible();
expect(within(overview).queryByRole("link", { name: "local/configured-repository" })).not.toBeInTheDocument();
});
test("workspace-specific commands remain isolated until a workspace is selected", async () => {
const user = userEvent.setup();
renderManager();
@@ -209,10 +235,15 @@ test("workspace-specific commands remain isolated until a workspace is selected"
expect(screen.queryByRole("heading", { name: "Workspace-specific actions" })).not.toBeInTheDocument();
await user.click(await screen.findByRole("button", { name: "PSD Clinical" }));
expect(await screen.findByRole("heading", { name: "About this workspace" })).toBeVisible();
expect(await screen.findByRole("heading", { name: "Workspace-specific actions" })).toBeVisible();
expect(screen.getByText(/reads this revision without modifying or publishing it/i)).toBeVisible();
expect(screen.getByText(/checks workspace.yaml and the required workspace directories/i)).toBeVisible();
expect(screen.getByText(/temporary decrypted credentials/i)).toBeVisible();
expect(screen.getByText(/one workspace in the shared repository/i)).toHaveTextContent(/workspace.yaml/i);
expect(screen.getByText(/one workspace in the shared repository/i)).toHaveTextContent(/Evidence/i);
expect(screen.getByText(/exact version currently activated by ThothII/i)).toBeVisible();
expect(screen.getByText(/does not modify the repository/i)).toBeVisible();
expect(screen.getByText(/confirms that workspace.yaml and the directories/i)).toBeVisible();
expect(screen.getByText(/reach the data warehouse and Evidence sources/i)).toBeVisible();
expect(screen.getByText(/credentials only for the duration of the test/i)).toBeVisible();
const databaseField = screen.getByText("Database").parentElement;
expect(databaseField).not.toBeNull();
expect(databaseField).toHaveTextContent("engine: postgres");