feat: finish Pi and workspace management updates
This commit is contained in:
@@ -114,7 +114,13 @@ test("level one explains the read-only Git sequence and the repository update bu
|
||||
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();
|
||||
expect(within(overview).getAllByRole("listitem")[0]).toHaveTextContent(/choosing any local directory you prefer/i);
|
||||
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("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",
|
||||
@@ -126,7 +132,7 @@ test("level one explains the read-only Git sequence and the repository update bu
|
||||
|
||||
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 local workspace/i)).toBeInTheDocument();
|
||||
expect(screen.getByText(/create a workspace repository/i)).toBeInTheDocument();
|
||||
expect(screen.queryByText(/import|export|bundle/i)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -141,10 +147,61 @@ test("workspace-specific commands remain isolated until a workspace is selected"
|
||||
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();
|
||||
const databaseField = screen.getByText("Database").parentElement;
|
||||
expect(databaseField).not.toBeNull();
|
||||
expect(databaseField).toHaveTextContent("engine: postgres");
|
||||
expect(databaseField).toHaveTextContent("database: database");
|
||||
expect(databaseField).toHaveTextContent("schema: public");
|
||||
expect(screen.getByRole("button", { name: "Validate workspace source" })).toBeVisible();
|
||||
expect(screen.getByRole("button", { name: "Test workspace connections" })).toBeVisible();
|
||||
});
|
||||
|
||||
test("keeps validation and connection results inside their respective action cards", async () => {
|
||||
const user = userEvent.setup();
|
||||
server.use(
|
||||
http.post("/api/workspaces/validate", () => HttpResponse.json({ workspace, contract: {} })),
|
||||
http.post("/api/workspaces/psd-clinical/test", () => HttpResponse.json({
|
||||
activatable: false,
|
||||
diagnostics: [{ level: "error", code: "connector_unavailable", message: "Connector diagnostic failed." }],
|
||||
})),
|
||||
);
|
||||
renderManager();
|
||||
await user.click(await screen.findByRole("button", { name: "PSD Clinical" }));
|
||||
|
||||
const validationCard = screen.getByTestId("workspace-validation-card");
|
||||
const connectionCard = screen.getByTestId("workspace-connection-card");
|
||||
await user.click(within(validationCard).getByRole("button", { name: "Validate workspace source" }));
|
||||
const validationStatus = await within(validationCard).findByRole("status");
|
||||
expect(validationStatus).toHaveTextContent("Workspace source is valid.");
|
||||
expect(validationStatus).toHaveClass("text-emerald-700");
|
||||
expect(within(connectionCard).queryByText("Workspace source is valid.")).not.toBeInTheDocument();
|
||||
|
||||
await user.click(within(connectionCard).getByRole("button", { name: "Test workspace connections" }));
|
||||
expect(await within(connectionCard).findByRole("alert")).toHaveTextContent(
|
||||
"connector_unavailable: Connector diagnostic failed.",
|
||||
);
|
||||
expect(within(validationCard).queryByText("connector_unavailable: Connector diagnostic failed.")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("renders binding_ok as a green connection success", async () => {
|
||||
const user = userEvent.setup();
|
||||
server.use(
|
||||
http.post("/api/workspaces/psd-clinical/test", () => HttpResponse.json({
|
||||
activatable: true,
|
||||
diagnostics: [{ level: "info", code: "binding_ok", message: "Installation bindings and diagnostics succeeded." }],
|
||||
})),
|
||||
);
|
||||
renderManager();
|
||||
await user.click(await screen.findByRole("button", { name: "PSD Clinical" }));
|
||||
|
||||
const connectionCard = screen.getByTestId("workspace-connection-card");
|
||||
await user.click(within(connectionCard).getByRole("button", { name: "Test workspace connections" }));
|
||||
const connectionStatus = await within(connectionCard).findByRole("status");
|
||||
expect(connectionStatus).toHaveTextContent("binding_ok: Installation bindings and diagnostics succeeded.");
|
||||
expect(connectionStatus).toHaveClass("text-emerald-700");
|
||||
expect(within(connectionCard).queryByRole("alert")).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
test("secret fields are write-only, clear after blind save, and may be forgotten", async () => {
|
||||
const user = userEvent.setup();
|
||||
let savedBody: unknown;
|
||||
|
||||
Reference in New Issue
Block a user