Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Show the centered loading indicator while a run resolves (SKY-13416) (#8000)
Celal Zamanoğlu5266882b545b
diff --git a/skyvern-frontend/src/routes/runs/RunRouter.test.tsx b/skyvern-frontend/src/routes/runs/RunRouter.test.tsxindex a8ef4489e..ee0f481fa 100644--- a/skyvern-frontend/src/routes/runs/RunRouter.test.tsx+++ b/skyvern-frontend/src/routes/runs/RunRouter.test.tsx@@ -69,7 +69,21 @@ function renderAt(entry: string) {);}-describe("RunRouter workflow-run branch", () => {+function expectCenteredLoadingIndicator() {+ const logo = screen.getByAltText("Minimized Logo");+ const pulse = logo.parentElement;+ const wrapper = pulse?.parentElement;++ expect(screen.getByRole("status").textContent).toContain("Loading");+ expect(pulse?.classList.contains("animate-pulse")).toBe(true);+ expect(wrapper?.classList.contains("flex")).toBe(true);+ expect(wrapper?.classList.contains("h-screen")).toBe(true);+ expect(wrapper?.classList.contains("w-full")).toBe(true);+ expect(wrapper?.classList.contains("items-center")).toBe(true);+ expect(wrapper?.classList.contains("justify-center")).toBe(true);+}++describe("RunRouter", () => {beforeEach(() => {mocks.studioEnabled.mockReturnValue(true);mocks.taskV2.mockReturnValue({ data: undefined, isLoading: false });@@ -86,7 +100,14 @@ describe("RunRouter workflow-run branch", () => {test("studio on: shows the fetching treatment while the run resolves", () => {mocks.runQuery.mockReturnValue({ data: undefined, isLoading: true });renderAt("/runs/wr_1");- expect(screen.getByText("Fetching run details...")).toBeTruthy();+ expectCenteredLoadingIndicator();+ expect(screen.queryByTestId("studio")).toBeNull();+ });++ test("task v2: shows the centered loading indicator while the task resolves", () => {+ mocks.taskV2.mockReturnValue({ data: undefined, isLoading: true });+ renderAt("/runs/tsk_v2_1");+ expectCenteredLoadingIndicator();expect(screen.queryByTestId("studio")).toBeNull();});@@ -101,7 +122,7 @@ describe("RunRouter workflow-run branch", () => {isLoading: false,});renderAt("/runs/wr_1");- expect(screen.getByText("Fetching run details...")).toBeTruthy();+ expectCenteredLoadingIndicator();expect(screen.queryByTestId("studio")).toBeNull();});@@ -141,7 +162,7 @@ describe("RunRouter workflow-run branch", () => {});renderAt("/runs/wr_1");expect(screen.queryByTestId("studio")).toBeNull();- expect(screen.queryByText("Fetching run details...")).toBeNull();+ expect(screen.queryByAltText("Minimized Logo")).toBeNull();expect(screen.queryByTestId("legacy")).toBeNull();});@@ -156,6 +177,6 @@ describe("RunRouter workflow-run branch", () => {});renderAt("/runs/wr_1");expect(screen.getByTestId("studio").textContent).toBe("studio:wpid_123");- expect(screen.queryByText("Fetching run details...")).toBeNull();+ expect(screen.queryByAltText("Minimized Logo")).toBeNull();});});diff --git a/skyvern-frontend/src/routes/runs/RunRouter.tsx b/skyvern-frontend/src/routes/runs/RunRouter.tsxindex 94fc8918d..51445c811 100644--- a/skyvern-frontend/src/routes/runs/RunRouter.tsx+++ b/skyvern-frontend/src/routes/runs/RunRouter.tsx@@ -12,6 +12,7 @@ import {} from "react-router-dom";import { useMemo } from "react";+import { LogoMinimized } from "@/components/LogoMinimized";import { PageLayout } from "@/components/PageLayout";import { Status404 } from "@/components/Status404";import { StepArtifactsLayout } from "@/routes/tasks/detail/StepArtifactsLayout";@@ -32,6 +33,18 @@ import { useWorkflowRunWithWorkflowQuery } from "@/routes/workflows/hooks/useWorimport { useWorkflowStudioEnabled } from "@/hooks/useWorkflowStudioEnabled";import { useTaskV2Query } from "@/routes/runs/useTaskV2Query";+const loadingIndicator = (+ <div+ className="flex h-screen w-full items-center justify-center"+ role="status"+ >+ <div className="animate-pulse">+ <LogoMinimized />+ </div>+ <span className="sr-only">Loading</span>+ </div>+);+function RunRouter() {const { runId } = useParams();const studioEnabled = useWorkflowStudioEnabled();@@ -113,7 +126,7 @@ function RunRouter() {if (runId?.startsWith("tsk_v2")) {if (isLoading) {- return <div>Fetching task details...</div>;+ return loadingIndicator;}if (!task_v2) {@@ -145,7 +158,7 @@ function RunRouter() {if (studioRunFailed) {return <Status404 />;}- return <div>Fetching run details...</div>;+ return loadingIndicator;}const workflowPermanentId = resolvedRun.workflow?.workflow_permanent_id;if (!workflowPermanentId) {