AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): look for the workspace file inside the picker in attachment tests (#15792)
Krzysztof Czerwinskief10af12d20b
diff --git a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/__tests__/attachments.test.tsx b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/__tests__/attachments.test.tsxindex e033baefda..be12d72206 100644--- a/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/__tests__/attachments.test.tsx+++ b/autogpt_platform/frontend/src/app/(platform)/team/components/ExpertChatDrawer/__tests__/attachments.test.tsx@@ -217,8 +217,16 @@ async function pickWorkspaceFile() {fireEvent.click(await screen.findByRole("menuitem", { name: /Use File from Workspace/ }),);- fireEvent.click(await screen.findByRole("button", { name: /brief\.pdf/ }));- fireEvent.click(screen.getByRole("button", { name: "Add 1 file" }));+ // Query inside the picker, not the whole page: after each DOM change a+ // page-wide role query makes happy-dom recompute every element's style,+ // which under load can outlast findBy's default 1 s.+ const picker = screen.getByRole("dialog", {+ name: "Use a file from your workspace",+ });+ fireEvent.click(+ await within(picker).findByRole("button", { name: /brief\.pdf/ }),+ );+ fireEvent.click(within(picker).getByRole("button", { name: "Add 1 file" }));await screen.findByText("brief.pdf");}