From 4807927da72890067471f964d02dacbe6c22196d Mon Sep 17 00:00:00 2001 From: yujiezhang-ops Date: Tue, 4 Aug 2026 17:57:44 +0800 Subject: [PATCH] test: follow the empty overview's own call to action MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `refactor: use step-by-step guide for desktop agents` gated the header's "安装命令行 Agent" on `installed.length || desktopInstalled`, so with nothing installed it is deliberately absent -- the empty state owns the call to action as its own primary button. The test still clicked the header one and failed to find it. The test now clicks the button the empty state actually renders, and asserts the header's is absent, so the arrangement this refactor chose is pinned rather than left to be rediscovered. Confirmed it still catches a regression: disconnecting the empty state's onClick fails it. Co-Authored-By: Claude Fable 5 --- frontend/src/pages/EnvironmentOverviewPage.test.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/pages/EnvironmentOverviewPage.test.tsx b/frontend/src/pages/EnvironmentOverviewPage.test.tsx index 00502fa1..a4fcd390 100644 --- a/frontend/src/pages/EnvironmentOverviewPage.test.tsx +++ b/frontend/src/pages/EnvironmentOverviewPage.test.tsx @@ -84,7 +84,11 @@ describe("EnvironmentOverviewPage", () => { mockState = { status: empty, statusState: "success", statusError: "" }; renderPage(); expect(screen.getByText("尚未安装任何 Agent")).toBeTruthy(); - fireEvent.click(screen.getByRole("button", { name: "安装命令行 Agent" })); + // The header's "安装命令行 Agent" is deliberately absent here: with nothing + // installed the empty state owns the call to action, as its own primary + // button, rather than repeating it in the toolbar. + expect(screen.queryByRole("button", { name: "安装命令行 Agent" })).toBeNull(); + fireEvent.click(screen.getByRole("button", { name: "安装 Agent" })); expect(await screen.findByRole("heading", { name: "onboarding" })).toBeTruthy(); // A second run must not inherit the previous Agent, model or log. expect(dispatch).toHaveBeenCalledWith({ type: "START_SETUP" });