From 89322412cc52cd7bf83717f117d5063f5ae389fb Mon Sep 17 00:00:00 2001 From: gsxdsm Date: Tue, 9 Jun 2026 03:12:56 -0700 Subject: [PATCH] FN-6049: stabilize TaskDetailModal GitHub tracking tests Harden TaskDetailModal integration and GitHub tracking coverage against async UI timing. - wait for source issue and GitHub tracking detail toggles to finish expanding before asserting contents - convert GitHub tracking helper call sites to async usage so linked issue, toggle, create, save, and unlink checks observe settled UI state - add the inline editing and integrations suite to the dashboard quality test project coverage Files changed: ...lModal.inline-editing-and-integrations.test.tsx | 34 ++++++++++++---------- packages/dashboard/vitest.config.ts | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) Fusion-Task-Id: FN-6049 Fusion-Task-Lineage: cad3324d-6208-4d5c-8dc8-4369265bc843 --- ...l.inline-editing-and-integrations.test.tsx | 34 +++++++++++-------- packages/dashboard/vitest.config.ts | 1 + 2 files changed, 20 insertions(+), 15 deletions(-) diff --git a/packages/dashboard/app/components/__tests__/TaskDetailModal.inline-editing-and-integrations.test.tsx b/packages/dashboard/app/components/__tests__/TaskDetailModal.inline-editing-and-integrations.test.tsx index 791ecaf674..b3b695aec2 100644 --- a/packages/dashboard/app/components/__tests__/TaskDetailModal.inline-editing-and-integrations.test.tsx +++ b/packages/dashboard/app/components/__tests__/TaskDetailModal.inline-editing-and-integrations.test.tsx @@ -111,14 +111,17 @@ describe("TaskDetailModal", () => { await user.click(toggle); - expect(screen.getByRole("button", { name: "Collapse source issue details" })).toHaveAttribute("aria-expanded", "true"); - expect(screen.getByText("Provider")).toBeTruthy(); + const collapseToggle = await screen.findByRole("button", { name: "Collapse source issue details" }); + await waitFor(() => { + expect(collapseToggle).toHaveAttribute("aria-expanded", "true"); + expect(screen.getByText("Provider")).toBeTruthy(); + }); expect(screen.getByText("github")).toBeTruthy(); expect(screen.getByText("runfusion/fusion")).toBeTruthy(); const sourceLink = screen.getByRole("link", { name: "https://github.com/runfusion/fusion/issues/2473" }); expect(sourceLink).toHaveAttribute("href", "https://github.com/runfusion/fusion/issues/2473"); expect(sourceLink).toHaveAttribute("target", "_blank"); - const expandedChevron = screen.getByRole("button", { name: "Collapse source issue details" }).querySelector("svg"); + const expandedChevron = collapseToggle.querySelector("svg"); expect(expandedChevron?.classList.contains("detail-source-chevron--expanded")).toBe(true); }); @@ -2197,11 +2200,12 @@ describe("TaskDetailModal", () => { }); describe("github tracking section", () => { - const expandGithubTracking = () => { + const expandGithubTracking = async () => { fireEvent.click(screen.getByRole("button", { name: "Expand GitHub tracking details" })); + return screen.findByRole("button", { name: "Collapse GitHub tracking details" }); }; - it("renders linked issue as link when url exists", () => { + it("renders linked issue as link when url exists", async () => { render( { expect(screen.getByLabelText("GitHub tracking status")).toHaveTextContent("Linked"); expect(screen.queryByRole("link", { name: "runfusion/fusion#123" })).toBeNull(); - expandGithubTracking(); + const collapseToggle = await expandGithubTracking(); - expect(screen.getByRole("button", { name: "Collapse GitHub tracking details" })).toHaveAttribute("aria-expanded", "true"); + expect(collapseToggle).toHaveAttribute("aria-expanded", "true"); expect(screen.getByRole("link", { name: "runfusion/fusion#123" })).toHaveAttribute("href", "https://github.com/runfusion/fusion/issues/123"); }); @@ -2279,8 +2283,8 @@ describe("TaskDetailModal", () => { expect(screen.getByLabelText("GitHub tracking status")).toHaveTextContent("Linked"); }); - expandGithubTracking(); - expect(screen.getByDisplayValue("runfusion/fusion")).toBeInTheDocument(); + await expandGithubTracking(); + expect(await screen.findByDisplayValue("runfusion/fusion")).toBeInTheDocument(); expect(screen.getByRole("link", { name: "runfusion/fusion#301" })).toHaveAttribute("href", "https://github.com/runfusion/fusion/issues/301"); }); @@ -2561,7 +2565,7 @@ describe("TaskDetailModal", () => { />, ); - expandGithubTracking(); + await expandGithubTracking(); fireEvent.click(screen.getByRole("button", { name: "Create tracking issue" })); await waitFor(() => { @@ -2602,7 +2606,7 @@ describe("TaskDetailModal", () => { />, ); - expandGithubTracking(); + await expandGithubTracking(); const toggle = screen.getByLabelText("Enable GitHub tracking") as HTMLInputElement; expect(toggle.checked).toBe(false); @@ -2638,7 +2642,7 @@ describe("TaskDetailModal", () => { />, ); - expandGithubTracking(); + await expandGithubTracking(); fireEvent.click(screen.getByLabelText("Enable GitHub tracking")); await waitFor(() => { @@ -2703,7 +2707,7 @@ describe("TaskDetailModal", () => { render(); - expandGithubTracking(); + await expandGithubTracking(); const toggle = screen.getByRole("checkbox", { name: "Enable GitHub tracking" }) as HTMLInputElement; expect(toggle.checked).toBe(true); @@ -2737,7 +2741,7 @@ describe("TaskDetailModal", () => { />, ); - expandGithubTracking(); + await expandGithubTracking(); fireEvent.change(screen.getByPlaceholderText("owner/repo"), { target: { value: "runfusion/cli" } }); fireEvent.click(screen.getByRole("button", { name: "Save" })); @@ -2785,7 +2789,7 @@ describe("TaskDetailModal", () => { />, ); - expandGithubTracking(); + await expandGithubTracking(); fireEvent.click(screen.getByRole("button", { name: "Unlink GitHub issue" })); await waitFor(() => { diff --git a/packages/dashboard/vitest.config.ts b/packages/dashboard/vitest.config.ts index 7e07e6eae4..448a0ee047 100644 --- a/packages/dashboard/vitest.config.ts +++ b/packages/dashboard/vitest.config.ts @@ -182,6 +182,7 @@ const qualityAppComponentTests = [ "TaskDetailModal.allow-resurrection", "TaskDetailModal.create-pr-e2e", "TaskDetailModal.custom-fields", + "TaskDetailModal.inline-editing-and-integrations", "TestModeBanner", "TaskDetailModal.create-pr-integration", "TaskDetailModal.github-tracking-header",