Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add story
  • Loading branch information
BrunoQuaresma committed Aug 25, 2025
commit 19c7b4f35084dbeaabfd073305d54ed86378dd4f
67 changes: 49 additions & 18 deletions site/src/pages/TaskPage/TaskPage.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ import {
MockFailedWorkspace,
MockStartingWorkspace,
MockStoppedWorkspace,
MockTemplate,
MockWorkspace,
MockWorkspaceAgent,
MockWorkspaceAgentLogSource,
MockWorkspaceAgentStarting,
MockWorkspaceApp,
MockWorkspaceAppStatus,
MockWorkspaceResource,
mockApiError,
} from "testHelpers/entities";
import { withProxyProvider } from "testHelpers/storybook";
import { withProxyProvider, withWebSocket } from "testHelpers/storybook";
import type { Meta, StoryObj } from "@storybook/react-vite";
import { API } from "api/api";
import type {
Workspace,
WorkspaceApp,
Expand Down Expand Up @@ -61,56 +61,87 @@ export const WaitingOnBuild: Story = {
},
};

export const WaitingOnBuildWithTemplate: Story = {
export const FailedBuild: Story = {
beforeEach: () => {
spyOn(API, "getTemplate").mockResolvedValue(MockTemplate);
spyOn(data, "fetchTask").mockResolvedValue({
prompt: "Create competitors page",
workspace: MockStartingWorkspace,
workspace: MockFailedWorkspace,
});
},
};

export const WaitingOnStatus: Story = {
export const TerminatedBuild: Story = {
beforeEach: () => {
spyOn(data, "fetchTask").mockResolvedValue({
prompt: "Create competitors page",
workspace: {
...MockWorkspace,
latest_app_status: null,
},
workspace: MockStoppedWorkspace,
});
},
};

export const FailedBuild: Story = {
export const TerminatedBuildWithStatus: Story = {
beforeEach: () => {
spyOn(data, "fetchTask").mockResolvedValue({
prompt: "Create competitors page",
workspace: MockFailedWorkspace,
workspace: {
...MockStoppedWorkspace,
latest_app_status: MockWorkspaceAppStatus,
},
});
},
};

export const TerminatedBuild: Story = {
export const WaitingOnStatus: Story = {
beforeEach: () => {
spyOn(data, "fetchTask").mockResolvedValue({
prompt: "Create competitors page",
workspace: MockStoppedWorkspace,
workspace: {
...MockWorkspace,
latest_app_status: null,
},
});
},
};

export const TerminatedBuildWithStatus: Story = {
export const WaitingStartupScripts: Story = {
beforeEach: () => {
spyOn(data, "fetchTask").mockResolvedValue({
prompt: "Create competitors page",
workspace: {
...MockStoppedWorkspace,
latest_app_status: MockWorkspaceAppStatus,
...MockWorkspace,
latest_build: {
...MockWorkspace.latest_build,
has_ai_task: true,
resources: [
{ ...MockWorkspaceResource, agents: [MockWorkspaceAgentStarting] },
],
},
},
});
},
decorators: [withWebSocket],
parameters: {
webSocket: [
{
event: "message",
data: JSON.stringify(
[
"\x1b[91mCloning Git repository...",
"\x1b[2;37;41mStarting Docker Daemon...",
"\x1b[1;95mAdding some 🧙magic🧙...",
"Starting VS Code...",
"\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0\r100 1475 0 1475 0 0 4231 0 --:--:-- --:--:-- --:--:-- 4238",
].map((line, index) => ({
id: index,
level: "info",
output: line,
source_id: MockWorkspaceAgentLogSource.id,
created_at: new Date().toISOString(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be on the safe side, do we want to hard-code the date here, since new Date() would create a non-deterministic value for each story run?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!

})),
),
},
],
},
};

export const SidebarAppHealthDisabled: Story = {
Expand Down
2 changes: 1 addition & 1 deletion site/src/pages/TaskPage/TaskPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ const TaskStartingAgent: FC<TaskStartingAgentProps> = ({ agent }) => {
<div className="flex flex-col gap-8 items-center w-full">
<header className="flex flex-col items-center text-center">
<h3 className="m-0 font-medium text-content-primary text-xl">
Running your apps
Running startup scripts
</h3>
<div className="text-content-secondary">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think we could use a p here, too

Your task will be running in a few moments
Expand Down
Loading