@@ -17,6 +17,7 @@ import {
17
17
withProxyProvider ,
18
18
} from "testHelpers/storybook" ;
19
19
import TasksPage , { data } from "./TasksPage" ;
20
+ import { reactRouterParameters } from "storybook-addon-remix-react-router" ;
20
21
21
22
const meta : Meta < typeof TasksPage > = {
22
23
title : "pages/TasksPage" ,
@@ -132,6 +133,23 @@ const newTaskData = {
132
133
133
134
export const CreateTaskSuccessfully : Story = {
134
135
decorators : [ withProxyProvider ( ) ] ,
136
+ parameters : {
137
+ reactRouter : reactRouterParameters ( {
138
+ location : {
139
+ path : "/tasks" ,
140
+ } ,
141
+ routing : [
142
+ {
143
+ path : "/tasks" ,
144
+ useStoryElement : true ,
145
+ } ,
146
+ {
147
+ path : "/tasks/:ownerName/:workspaceName" ,
148
+ element : < h1 > Task page</ h1 > ,
149
+ } ,
150
+ ] ,
151
+ } ) ,
152
+ } ,
135
153
beforeEach : ( ) => {
136
154
spyOn ( data , "fetchAITemplates" ) . mockResolvedValue ( [ MockTemplate ] ) ;
137
155
spyOn ( data , "fetchTasks" )
@@ -150,10 +168,8 @@ export const CreateTaskSuccessfully: Story = {
150
168
await userEvent . click ( submitButton ) ;
151
169
} ) ;
152
170
153
- await step ( "Verify task in the table" , async ( ) => {
154
- await canvas . findByRole ( "row" , {
155
- name : new RegExp ( newTaskData . prompt , "i" ) ,
156
- } ) ;
171
+ await step ( "Redirects to the task page" , async ( ) => {
172
+ await canvas . findByText ( / t a s k p a g e / i) ;
157
173
} ) ;
158
174
} ,
159
175
} ;
@@ -187,7 +203,7 @@ export const CreateTaskError: Story = {
187
203
} ,
188
204
} ;
189
205
190
- export const WithExternalAuth : Story = {
206
+ export const WithAuthenticatedExternalAuth : Story = {
191
207
decorators : [ withProxyProvider ( ) ] ,
192
208
beforeEach : ( ) => {
193
209
spyOn ( data , "fetchTasks" )
@@ -201,26 +217,17 @@ export const WithExternalAuth: Story = {
201
217
play : async ( { canvasElement, step } ) => {
202
218
const canvas = within ( canvasElement ) ;
203
219
204
- await step ( "Run task" , async ( ) => {
205
- const prompt = await canvas . findByLabelText ( / p r o m p t / i) ;
206
- await userEvent . type ( prompt , newTaskData . prompt ) ;
207
- const submitButton = canvas . getByRole ( "button" , { name : / r u n t a s k / i } ) ;
208
- await waitFor ( ( ) => expect ( submitButton ) . toBeEnabled ( ) ) ;
209
- await userEvent . click ( submitButton ) ;
210
- } ) ;
211
-
212
- await step ( "Verify task in the table" , async ( ) => {
213
- await canvas . findByRole ( "row" , {
214
- name : new RegExp ( newTaskData . prompt , "i" ) ,
215
- } ) ;
216
- } ) ;
217
-
218
220
await step ( "Does not render external auth" , async ( ) => {
219
221
expect (
220
222
canvas . queryByText ( / e x t e r n a l a u t h e n t i c a t i o n / ) ,
221
223
) . not . toBeInTheDocument ( ) ;
222
224
} ) ;
223
225
} ,
226
+ parameters : {
227
+ chromatic : {
228
+ disableSnapshot : true ,
229
+ } ,
230
+ } ,
224
231
} ;
225
232
226
233
export const MissingExternalAuth : Story = {
0 commit comments