From a281e38620faffd840d7db99d3f8410ec5ccfd4e Mon Sep 17 00:00:00 2001 From: majdyz Date: Wed, 15 Apr 2026 19:59:26 +0700 Subject: [PATCH] test(frontend): cover LogsTable clipboard copy for exec ID cell --- .../__tests__/PlatformCostContent.test.tsx | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx b/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx index 2b3845f53c..8808f1280d 100644 --- a/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx +++ b/autogpt_platform/frontend/src/app/(platform)/admin/platform-costs/__tests__/PlatformCostContent.test.tsx @@ -419,6 +419,28 @@ describe("PlatformCostContent", () => { expect(input.value).toBe("exec-abc"); }); + it("copies execution ID to clipboard on cell click in logs tab", async () => { + const writeText = vi.fn().mockResolvedValue(undefined); + vi.stubGlobal("navigator", { ...navigator, clipboard: { writeText } }); + mockUseGetDashboard.mockReturnValue({ + data: dashboardWithData, + isLoading: false, + }); + mockUseGetLogs.mockReturnValue({ + data: logsWithData, + isLoading: false, + }); + renderComponent({ tab: "logs" }); + await waitFor(() => + expect(document.querySelector(".animate-pulse")).toBeNull(), + ); + // The exec ID cell shows first 8 chars of "gx-123" + const execIdCell = screen.getByText("gx-123".slice(0, 8)); + fireEvent.click(execIdCell); + expect(writeText).toHaveBeenCalledWith("gx-123"); + vi.unstubAllGlobals(); + }); + it("renders by-user tab when specified", async () => { mockUseGetDashboard.mockReturnValue({ data: dashboardWithData,