From 6bd1940f5eb06bdb3296e5d8ac3c158123dab4ea Mon Sep 17 00:00:00 2001 From: mihir Date: Fri, 20 Nov 2026 18:00:25 +0530 Subject: [PATCH] test: make sample approval and dispatch fixtures deterministic --- test/samples.ui.test.tsx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/samples.ui.test.tsx b/test/samples.ui.test.tsx index 0c3a4c5..1197249 100644 --- a/test/samples.ui.test.tsx +++ b/test/samples.ui.test.tsx @@ -155,10 +155,11 @@ test("an independent reviewer can approve a request and retry a manual dispatch" const user = userEvent.setup(); await user.click(screen.getByRole("button", { name: "Test login" })); await user.selectOptions(await screen.findByRole("combobox", { name: /Review decision/ }), "APPROVED"); - await user.type(screen.getByRole("textbox", { name: /Review note/ }), approved.note); + fireEvent.change(screen.getByRole("textbox", { name: /Review note/ }), { target: { value: approved.note } }); await user.click(screen.getByRole("button", { name: "Record sample decision" })); - await user.type(await screen.findByRole("textbox", { name: /Dispatch reference/ }), dispatched.dispatchReference); - await user.type(screen.getByRole("textbox", { name: /Dispatch note/ }), dispatched.note); + expect(decision).toEqual({ decision: "APPROVED", note: approved.note, idempotencyKey: expect.any(String) }); + fireEvent.change(await screen.findByRole("textbox", { name: /Dispatch reference/ }), { target: { value: dispatched.dispatchReference } }); + fireEvent.change(screen.getByRole("textbox", { name: /Dispatch note/ }), { target: { value: dispatched.note } }); await user.click(screen.getByRole("button", { name: "Record dispatch" })); await user.click(await screen.findByRole("button", { name: "Retry dispatch" })); await screen.findByRole("cell", { name: dispatched.dispatchReference });