Skip to content

Commit 5bc4dbc

Browse files
committed
fix(projects): streamline work queue focus
1 parent b4dc772 commit 5bc4dbc

3 files changed

Lines changed: 371 additions & 381 deletions

File tree

ui/src/features/projects/ProjectsView.test.tsx

Lines changed: 36 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1119,24 +1119,31 @@ describe("ProjectsView cockpit", () => {
11191119
);
11201120

11211121
expect(await screen.findByText("Work Queue")).toBeTruthy();
1122-
expect(screen.getByText(/1 work item · 1 assignments/)).toBeTruthy();
1122+
expect(screen.getByRole("button", { name: "Show all work items" })).toBeTruthy();
11231123
await userEvent.click(screen.getByRole("button", { name: "Show blocked assignments" }));
11241124
const queue = screen.getByLabelText("Work queue");
1125-
expect(within(queue).getAllByText("2 approval pending").length).toBeGreaterThan(0);
1126-
expect(within(queue).getByText("handoff: Runtime notes")).toBeTruthy();
1125+
expect(
1126+
within(queue).getByRole("button", { name: "Open work item Build cockpit UI" }),
1127+
).toBeTruthy();
1128+
expect(within(queue).getByText("1 assignment")).toBeTruthy();
1129+
1130+
const detail = screen.getByRole("region", { name: "Selected work item" });
1131+
expect(within(detail).getAllByText("2 approval pending").length).toBeGreaterThan(0);
11271132

1128-
await userEvent.click(within(queue).getByRole("button", { name: "Task" }));
1133+
await userEvent.click(within(detail).getByRole("button", { name: "Open task" }));
11291134
expect(onOpenTask).toHaveBeenCalledWith("task_1", "run_1");
11301135

1131-
await userEvent.click(within(queue).getByRole("button", { name: "Chat" }));
1136+
await userEvent.click(within(detail).getByRole("button", { name: "Open chat" }));
11321137
expect(onOpenChat).toHaveBeenCalledWith(
11331138
expect.objectContaining({
11341139
projectID: project.id,
11351140
model: "qwen2.5-coder",
11361141
}),
11371142
);
11381143

1139-
await userEvent.click(screen.getByRole("button", { name: "Details" }));
1144+
await userEvent.click(
1145+
within(queue).getByRole("button", { name: "Open work item Build cockpit UI" }),
1146+
);
11401147
expect(screen.getByRole("article", { name: "Build cockpit UI work item" })).toBeTruthy();
11411148
});
11421149

@@ -1458,7 +1465,9 @@ describe("ProjectsView cockpit", () => {
14581465

14591466
await userEvent.click(screen.getByRole("button", { name: "Show blocked assignments" }));
14601467
const activity = screen.getByLabelText("Work queue");
1461-
expect(within(activity).getByText(/2 approval pending/i)).toBeTruthy();
1468+
expect(
1469+
within(activity).getByRole("button", { name: "Open work item Build cockpit UI" }),
1470+
).toBeTruthy();
14621471
const health = await openProjectAttentionMenu();
14631472
expect(within(health).queryByText(/Approval waiting: Build cockpit UI/i)).toBeNull();
14641473
expect(within(health).getByText("No project attention items detected.")).toBeTruthy();
@@ -1615,7 +1624,9 @@ describe("ProjectsView cockpit", () => {
16151624
await screen.findByText("Work Queue");
16161625
await userEvent.click(screen.getByRole("button", { name: "Show blocked assignments" }));
16171626
const activity = screen.getByLabelText("Work queue");
1618-
expect(within(activity).getByText("execution failed")).toBeTruthy();
1627+
expect(
1628+
within(activity).getByRole("button", { name: "Open work item Build cockpit UI" }),
1629+
).toBeTruthy();
16191630
const health = await openProjectAttentionMenu();
16201631
expect(within(health).queryByText(/Execution needs review: Build cockpit UI/i)).toBeNull();
16211632
expect(within(health).getByText(/Stale or unknown assignment: Build cockpit UI/i)).toBeTruthy();
@@ -1862,7 +1873,11 @@ describe("ProjectsView cockpit", () => {
18621873
await userEvent.click(screen.getByRole("button", { name: "Show active assignments" }));
18631874

18641875
await waitFor(() => {
1865-
expect(screen.getAllByText("run live now").length).toBeGreaterThan(0);
1876+
expect(
1877+
within(screen.getByLabelText("Work queue")).getByRole("button", {
1878+
name: "Open work item Build cockpit UI",
1879+
}),
1880+
).toBeTruthy();
18661881
});
18671882
});
18681883

@@ -1988,7 +2003,7 @@ describe("ProjectsView cockpit", () => {
19882003

19892004
await userEvent.click(within(health).getByRole("button", { name: "View blocked" }));
19902005
await waitFor(() => {
1991-
expect(screen.getAllByText("linked run missing").length).toBeGreaterThan(1);
2006+
expect(screen.getByText("linked run missing")).toBeTruthy();
19922007
});
19932008
});
19942009

@@ -2135,6 +2150,14 @@ describe("ProjectsView cockpit", () => {
21352150
recent: [],
21362151
},
21372152
});
2153+
vi.mocked(getProjectWorkItems).mockResolvedValue({
2154+
object: "project_work_items",
2155+
data: [{ ...workItem, assignments: [notStartedAssignment] }],
2156+
});
2157+
vi.mocked(getProjectAssignments).mockResolvedValue({
2158+
object: "project_assignments",
2159+
data: [notStartedAssignment],
2160+
});
21382161
window.localStorage.setItem("hecate.project", project.id);
21392162
const state = createRuntimeConsoleFixture({
21402163
projects: [project],
@@ -2145,7 +2168,9 @@ describe("ProjectsView cockpit", () => {
21452168
await screen.findByText("Work Queue");
21462169
await userEvent.click(screen.getByRole("button", { name: "Show blocked assignments" }));
21472170
const activity = screen.getByLabelText("Work queue");
2148-
expect(within(activity).getAllByText("not started").length).toBeGreaterThan(0);
2171+
expect(
2172+
within(activity).getByRole("button", { name: "Open work item Build cockpit UI" }),
2173+
).toBeTruthy();
21492174
await openProjectWorkspaceTab(/Timeline \/ Decision Log/);
21502175
const timeline = screen.getByLabelText("Project timeline");
21512176
expect(within(timeline).queryByText("not started")).toBeNull();

0 commit comments

Comments
 (0)