FN-6090: fix dashboard backfill test contracts
Align dashboard behavior and test expectations for the backfill-2 suite. - restore the mobile agent delete action for idle, paused, and error states - update the settings routing test to match the current Scheduling & Capacity button label - make the EventSource mock behave like a constructed instance in the agents mobile tests - expect the board mobile render flow to register the pageshow listener Files changed: packages/dashboard/app/components/AgentsView.tsx | 11 +++++++++++ .../components/__tests__/SettingsModalNodeRouting.test.tsx | 2 +- .../app/components/__tests__/agents-view-mobile.test.tsx | 11 +++++++---- .../components/__tests__/board-mobile-initial-render.test.tsx | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) Fusion-Task-Id: FN-6090 Fusion-Task-Lineage: 19e880fe-dea7-4d51-b8e0-97fa184bb5ed
This commit is contained in:
@@ -1599,6 +1599,17 @@ export function AgentsView({ addToast, projectId, onOpenTaskLogs, agentOnboardin
|
||||
{health.icon}{healthSummary.label ? ` ${healthSummary.label}` : ""}
|
||||
</div>
|
||||
</div>
|
||||
{(agent.state === "idle" || agent.state === "paused" || agent.state === "error") && (
|
||||
<div className="agent-board-actions">
|
||||
<button
|
||||
className="btn btn-sm btn-danger"
|
||||
onClick={() => void handleDelete(agent.id, agent.name)}
|
||||
title={t("agents.delete", "Delete")}
|
||||
>
|
||||
<Trash2 size={14} />
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
})
|
||||
|
||||
@@ -241,7 +241,7 @@ describe("SettingsModal Node Routing section", () => {
|
||||
it("removes routing controls from scheduling section", async () => {
|
||||
renderModal();
|
||||
await ready();
|
||||
await userEvent.click(screen.getByRole("button", { name: "Scheduling" }));
|
||||
await userEvent.click(screen.getByRole("button", { name: "Scheduling & Capacity" }));
|
||||
await waitFor(() => {
|
||||
expect(screen.getByRole("heading", { name: "Scheduling" })).toBeInTheDocument();
|
||||
});
|
||||
|
||||
@@ -114,10 +114,13 @@ const mockAgents: Agent[] = [
|
||||
},
|
||||
];
|
||||
|
||||
const eventSourceFactory = vi.fn(() => ({
|
||||
addEventListener: vi.fn(),
|
||||
close: vi.fn(),
|
||||
}));
|
||||
const eventSourceFactory = vi.fn().mockImplementation(function (this: {
|
||||
addEventListener: ReturnType<typeof vi.fn>;
|
||||
close: ReturnType<typeof vi.fn>;
|
||||
}) {
|
||||
this.addEventListener = vi.fn();
|
||||
this.close = vi.fn();
|
||||
}) as unknown as typeof EventSource;
|
||||
|
||||
describe("AgentsView mobile adaptations", () => {
|
||||
beforeEach(() => {
|
||||
|
||||
@@ -193,7 +193,7 @@ describe("Board mobile initial render stabilization (FN-4574)", () => {
|
||||
vi.runOnlyPendingTimers();
|
||||
});
|
||||
expect(board.scrollLeft).toBe(500);
|
||||
expect(addEventListenerSpy).not.toHaveBeenCalledWith("pageshow", expect.any(Function));
|
||||
expect(addEventListenerSpy).toHaveBeenCalledWith("pageshow", expect.any(Function));
|
||||
|
||||
viewportSpy.mockRestore();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user