Skip to content

Automate browser based workflows with AI

feat(SKY-12792): cue the studio title as a link to past runs (#7642)

Celal Zamanoğlu9e52729f8fec
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx
index 84728c41b..e5865f9a4 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.test.tsx
@@ -3,7 +3,16 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { cleanup, fireEvent, render, screen } from "@testing-library/react";
import { MemoryRouter, Route, Routes, useLocation } from "react-router-dom";
-import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
+import {
+ afterAll,
+ afterEach,
+ beforeAll,
+ beforeEach,
+ describe,
+ expect,
+ test,
+ vi,
+} from "vitest";
import { ProxyLocation, Status } from "@/api/types";
import { TooltipProvider } from "@/components/ui/tooltip";
@@ -39,6 +48,22 @@ import { useWorkflowYamlEditorStore } from "@/store/WorkflowYamlEditorStore";
import { RunStopButton, SaveButton, TitleSection } from "./StudioTopBar";
+// jsdom lacks ResizeObserver, which Radix's tooltip popper constructs once a
+// tooltip opens. Install it for this suite only and restore afterward.
+class MockResizeObserver {
+ observe() {}
+ unobserve() {}
+ disconnect() {}
+}
+
+beforeAll(() => {
+ vi.stubGlobal("ResizeObserver", MockResizeObserver);
+});
+
+afterAll(() => {
+ vi.unstubAllGlobals();
+});
+
function LocationProbe() {
const location = useLocation();
return (
@@ -404,6 +429,21 @@ describe("TitleSection title link + edit affordance", () => {
expect(link.getAttribute("href")).toBe("/agents/wpid_abc/runs");
});
+ test("cues the title as a link and tooltips its runs destination", async () => {
+ renderTitleSection();
+ const link = screen.getByRole("link", { name: "My Workflow" });
+ expect(link.getAttribute("href")).toBe("/agents/wpid_abc/runs");
+ // jsdom can't evaluate :hover; pin the color cue (mirrors WorkflowScriptsPage's runs link).
+ expect(link.className).toContain("hover:text-blue-700");
+ expect(link.className).toContain("dark:hover:text-blue-400");
+ // Radix mounts the tooltip content on focus (visible + a11y copies), so
+ // assert the destination label appears rather than a single node.
+ fireEvent.focusIn(link);
+ expect(
+ (await screen.findAllByText("View past runs")).length,
+ ).toBeGreaterThan(0);
+ });
+
test("enters the shared rename input from the edit button and commits into the title + dirty stores", () => {
renderTitleSection();
diff --git a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
index 50fc5f431..918e6536c 100644
--- a/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
+++ b/skyvern-frontend/src/routes/workflows/studio/StudioTopBar.tsx
@@ -78,12 +78,19 @@ export function TitleSection({ editable = true }: { editable?: boolean }) {
inputClassName="px-2 text-base"
renderIdle={({ startEditing }) => (
<>
- <Link
- to={`/agents/${workflowPermanentId}/runs`}
- className="min-w-0 truncate px-2 text-base hover:underline hover:underline-offset-2"
+ {/* min-w-0 shrink overrides ControlTooltip's default shrink-0 (cn/twMerge
+ drops shrink-0) so the wrapper stays shrinkable and the Link truncates. */}
+ <ControlTooltip
+ content="View past runs"
+ wrapperClassName="min-w-0 shrink"
>
- {title}
- </Link>
+ <Link
+ to={`/agents/${workflowPermanentId}/runs`}
+ className="min-w-0 truncate px-2 text-base hover:text-blue-700 hover:underline hover:underline-offset-2 dark:hover:text-blue-400"
+ >
+ {title}
+ </Link>
+ </ControlTooltip>
{canEdit && (
<ControlTooltip content="Click to edit title">
<button