merge develop into feature/85-fix-flaky-setcellagent-test

This commit is contained in:
2026-07-27 17:24:40 +02:00
parent 851f1f8f2c
commit 78f7c8fe2d
2 changed files with 16 additions and 0 deletions

View File

@ -33,6 +33,10 @@ function renderGrid(
);
}
async function waitForAgentOption(name = "MyAgent") {
await screen.findByRole("option", { name });
}
describe("setCellAgent (agent dropdown per cell)", () => {
it("renders an agent selector on each leaf cell", async () => {
const layout = new MockLayoutGateway();
@ -59,6 +63,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
await waitFor(() => {
expect(screen.getByRole("combobox")).toBeTruthy();
});
await waitForAgentOption();
const select = screen.getByRole("combobox") as HTMLSelectElement;
fireEvent.change(select, { target: { value: a.id } });
@ -72,6 +77,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
const leaf = leaves(tree)[0];
// The mutation should have persisted.
expect(leaf.id).toBe(leafId);
expect(leaf.agent).toBe(a.id);
// Since mutateLayout is async, give it a tick.
});
});
@ -151,6 +157,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent);
await waitFor(() => expect(screen.getByRole("combobox")).toBeTruthy());
await waitForAgentOption();
fireEvent.change(screen.getByRole("combobox"), { target: { value: a.id } });
@ -180,6 +187,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent, "p1", terminal);
await waitFor(() => expect(screen.getByRole("combobox")).toBeTruthy());
await waitForAgentOption();
fireEvent.change(screen.getByRole("combobox"), { target: { value: a.id } });
@ -197,6 +205,7 @@ describe("setCellAgent (agent dropdown per cell)", () => {
renderGrid(layout, agent, "p1", terminal);
await waitFor(() => expect(screen.getByRole("combobox")).toBeTruthy());
await waitForAgentOption();
fireEvent.change(screen.getByRole("combobox"), { target: { value: a.id } });