File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
site/src/pages/WorkspacePage Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 11import type { Meta , StoryObj } from "@storybook/react" ;
2+ import { userEvent , within } from "@storybook/test" ;
23import type { WorkspaceAppStatus } from "api/typesGenerated" ;
34import {
45 MockWorkspace ,
@@ -82,6 +83,37 @@ export const SingleStatus: Story = {
8283 } ,
8384} ;
8485
86+ export const MultipleStatuses : Story = {
87+ args : {
88+ agent : mockAgent ( [
89+ {
90+ ...MockWorkspaceAppStatus ,
91+ id : "status-1" ,
92+ icon : "" ,
93+ message : "Initial setup complete." ,
94+ created_at : createTimestamp ( 5 , 10 ) , // 15:05:10 (after referenceDate)
95+ uri : "" ,
96+ state : "complete" as const ,
97+ } ,
98+ {
99+ ...MockWorkspaceAppStatus ,
100+ id : "status-2" ,
101+ icon : "" ,
102+ message : "Working..." ,
103+ created_at : createTimestamp ( 5 , 0 ) , // 15:05:00 (after referenceDate)
104+ uri : "" ,
105+ state : "working" as const ,
106+ } ,
107+ ] ) ,
108+ } ,
109+ play : async ( { canvasElement } ) => {
110+ const canvas = within ( canvasElement ) ;
111+ const submitButton = canvas . getByRole ( "button" ) ;
112+ await userEvent . click ( submitButton ) ;
113+ await canvas . findByText ( / w o r k i n g / i) ;
114+ } ,
115+ } ;
116+
85117function mockAgent ( statuses : WorkspaceAppStatus [ ] ) {
86118 return {
87119 ...MockWorkspaceAgent ,
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ export const AppStatuses: FC<AppStatusesProps> = ({
156156 < div className = "flex items-center justify-between w-full text-content-secondary" >
157157 < span className = "text-xs flex items-center gap-2" >
158158 < AppStatusStateIcon
159- state = { latestStatus . state }
159+ state = { status . state }
160160 latest = { false }
161161 className = "size-icon-xs w-[18px]"
162162 />
You can’t perform that action at this time.
0 commit comments