fix(tui): la bascule TUI native <-> CLI custom ne déclenche plus de faux conflit de visibilité (#189)
This commit is contained in:
@ -159,7 +159,7 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByRole("alertdialog", { name: "Confirmer le changement de CLI" })).toBeTruthy(),
|
||||
);
|
||||
fireEvent.click(screen.getByText("Arrêter et relancer"));
|
||||
fireEvent.click(screen.getByText("Basculer"));
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId("custom-agent-chat-view")).toBeTruthy(),
|
||||
);
|
||||
@ -264,7 +264,7 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
await waitFor(() =>
|
||||
expect(screen.getByRole("alertdialog", { name: "Confirmer le changement de CLI" })).toBeTruthy(),
|
||||
);
|
||||
fireEvent.click(screen.getByText("Arrêter et relancer"));
|
||||
fireEvent.click(screen.getByText("Basculer"));
|
||||
|
||||
await waitFor(() =>
|
||||
expect(closeChat).toHaveBeenCalledWith(expect.stringMatching(/^mock-agent-chat-/)),
|
||||
@ -273,13 +273,26 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
await waitFor(() => expect(screen.getByTestId("terminal-view")).toBeTruthy());
|
||||
});
|
||||
|
||||
it("requires confirmation before switching a live native TUI session", async () => {
|
||||
renderGrid(await seeded(structuredProfile));
|
||||
it("switches a live native TUI session to custom CLI without stopping it first (#189)", async () => {
|
||||
const gateways = await seeded(structuredProfile);
|
||||
const agent = gateways.agent as MockAgentGateway;
|
||||
const terminal = gateways.terminal as MockTerminalGateway;
|
||||
const layout = gateways.layout as MockLayoutGateway;
|
||||
const leafId = leaves(await layout.loadLayout("p1"))[0].id;
|
||||
const stopLive = vi.spyOn(agent, "stopLiveAgent");
|
||||
const closeTerminal = vi.spyOn(terminal, "closeTerminal");
|
||||
const launchChat = vi.spyOn(agent, "launchAgentChat");
|
||||
|
||||
renderGrid(gateways);
|
||||
|
||||
await waitFor(() => expect(screen.getByText("CLI custom")).toBeTruthy());
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId("terminal-view")).toBeTruthy(),
|
||||
);
|
||||
await waitFor(async () => {
|
||||
const updated = await layout.loadLayout("p1");
|
||||
expect(leaves(updated)[0].session).toMatch(/^mock-agent-session-/);
|
||||
});
|
||||
|
||||
fireEvent.click(screen.getByText("CLI custom"));
|
||||
|
||||
@ -288,10 +301,18 @@ describe("LayoutGrid custom agent CLI (#147)", () => {
|
||||
);
|
||||
expect(screen.getByText(/Une reprise est possible/)).toBeTruthy();
|
||||
|
||||
fireEvent.click(screen.getByText("Arrêter et relancer"));
|
||||
fireEvent.click(screen.getByText("Basculer"));
|
||||
await waitFor(() =>
|
||||
expect(screen.getByTestId("custom-agent-chat-view")).toBeTruthy(),
|
||||
);
|
||||
expect(stopLive).not.toHaveBeenCalled();
|
||||
expect(closeTerminal).not.toHaveBeenCalled();
|
||||
await waitFor(() => expect(launchChat).toHaveBeenCalled());
|
||||
expect(launchChat.mock.calls.at(-1)?.[2]).toMatchObject({ nodeId: leafId });
|
||||
await waitFor(async () => {
|
||||
const updated = await layout.loadLayout("p1");
|
||||
expect(leaves(updated)[0].session).toMatch(/^mock-agent-chat-/);
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps a restored custom CLI mode while the agent/profile catalog is still loading (#149)", async () => {
|
||||
|
||||
Reference in New Issue
Block a user