From 5613f36770c0420a3cedfe9a4d0bac4ab5bb800f Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Thu, 15 Oct 2026 17:10:39 +1100 Subject: [PATCH] test(web): look up the reply quote after the chat reloads The Reply To A Message story kept the quote button it found while the message was sending. When the chat reloads, that row is replaced, so on a slow runner the story waited on a detached element and failed. --- packages/web/src/screens/AgentPage.stories.tsx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/packages/web/src/screens/AgentPage.stories.tsx b/packages/web/src/screens/AgentPage.stories.tsx index 9f65b122..e81db2c6 100644 --- a/packages/web/src/screens/AgentPage.stories.tsx +++ b/packages/web/src/screens/AgentPage.stories.tsx @@ -179,11 +179,15 @@ export const ReplyToAMessage = meta.story({ await expect(canvas.getByRole("button", { name: "Cancel reply" })).toBeVisible(); await userEvent.keyboard("Only the Northwind one{Enter}"); - const quote = await within(log).findByRole("button", { - name: /^Replying to Growth Desk: The two Northwind accounts/, - }); - // A message the chat reloads with rises into place. - await waitFor(() => expect(quote).toBeVisible()); + // Look the quote up each time: the row shown while the message sends is + // replaced when the chat reloads, and the new one rises into place. + await waitFor(() => + expect( + within(log).getByRole("button", { + name: /^Replying to Growth Desk: The two Northwind accounts/, + }), + ).toBeVisible(), + ); await expect(canvas.queryByRole("button", { name: "Cancel reply" })).toBeNull(); }, });