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 1
1
import type { Meta , StoryObj } from "@storybook/react" ;
2
+ import { userEvent , within } from "@storybook/test" ;
2
3
import type { WorkspaceAppStatus } from "api/typesGenerated" ;
3
4
import {
4
5
MockWorkspace ,
@@ -82,6 +83,37 @@ export const SingleStatus: Story = {
82
83
} ,
83
84
} ;
84
85
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
+
85
117
function mockAgent ( statuses : WorkspaceAppStatus [ ] ) {
86
118
return {
87
119
...MockWorkspaceAgent ,
Original file line number Diff line number Diff line change @@ -156,7 +156,7 @@ export const AppStatuses: FC<AppStatusesProps> = ({
156
156
< div className = "flex items-center justify-between w-full text-content-secondary" >
157
157
< span className = "text-xs flex items-center gap-2" >
158
158
< AppStatusStateIcon
159
- state = { latestStatus . state }
159
+ state = { status . state }
160
160
latest = { false }
161
161
className = "size-icon-xs w-[18px]"
162
162
/>
You can’t perform that action at this time.
0 commit comments