@@ -211,26 +211,47 @@ from(bucket: "defbuck")
211211 } )
212212
213213 it ( 'can clone a task and activate just the cloned one' , ( ) => {
214- createTask ( 'task1' , 'buckets()' )
214+ const firstLabel = 'very important task'
215+ const secondLabel = 'mission critical'
215216
216- cy . getByTestID ( 'task-card' )
217- . eq ( 1 )
218- . then ( ( ) => {
219- cy . getByTestID ( 'context-menu-task' )
220- . eq ( 1 )
221- . click ( )
222- cy . getByTestID ( 'context-clone-task' ) . click ( )
223- } )
217+ cy . get ( 'button.cf-button[title="Add labels"]' ) . click ( )
218+ cy . getByTestID ( 'inline-labels--popover--dialog' ) . should ( 'be.visible' )
219+ cy . getByTestID ( 'inline-labels--popover-field' ) . type (
220+ `${ firstLabel } {enter}`
221+ )
222+ cy . getByTestID ( 'overlay--container' ) . should ( 'be.visible' )
223+ cy . getByTestID ( 'create-label-form--submit' ) . click ( )
224224
225+ cy . getByTestID ( 'overlay--container' ) . should ( 'not.exist' )
226+ cy . get ( 'button.cf-button[title="Add labels"]' ) . click ( )
227+ cy . getByTestID ( 'inline-labels--popover--dialog' ) . should ( 'be.visible' )
228+ cy . getByTestID ( 'inline-labels--popover-field' ) . type (
229+ `${ secondLabel } {enter}`
230+ )
231+ cy . getByTestID ( 'overlay--container' ) . should ( 'be.visible' )
232+ cy . getByTestID ( 'create-label-form--submit' ) . click ( )
233+
234+ // ensure the two labels are present before cloning
235+ cy . getByTestID ( 'overlay--container' ) . should ( 'not.exist' )
236+ cy . getByTestID ( `label--pill ${ firstLabel } ` ) . should ( 'be.visible' )
237+ cy . getByTestID ( `label--pill ${ secondLabel } ` ) . should ( 'be.visible' )
238+
239+ // clone the task
240+ cy . getByTestID ( 'context-menu-task' ) . click ( )
241+ cy . getByTestID ( 'context-clone-task' ) . click ( )
242+ cy . getByTestID ( 'task-card--slide-toggle' ) . should ( 'have.length' , 2 )
243+ cy . getByTestID ( `label--pill ${ firstLabel } ` ) . should ( 'have.length' , 2 )
244+ cy . getByTestID ( `label--pill ${ secondLabel } ` ) . should ( 'have.length' , 2 )
245+
246+ // disable the first task
225247 cy . getByTestID ( 'task-card--slide-toggle' )
226248 . eq ( 0 )
227249 . should ( 'have.class' , 'active' )
228250 cy . getByTestID ( 'task-card--slide-toggle' )
229251 . eq ( 0 )
230252 . click ( )
231- cy . getByTestID ( 'task-card--slide-toggle' )
232- . eq ( 0 )
233- . should ( 'not.have.class' , 'active' )
253+
254+ // only the clone should be active
234255 cy . getByTestID ( 'task-card--slide-toggle' )
235256 . eq ( 1 )
236257 . should ( 'have.class' , 'active' )
@@ -688,22 +709,3 @@ from(bucket: "defbuck")
688709 } )
689710 } )
690711} )
691-
692- const createTask = (
693- name : string ,
694- task : string ,
695- every = '3h' ,
696- offset = '20m'
697- ) => {
698- cy . getByTestID ( 'create-task--button' )
699- . first ( )
700- . click ( )
701-
702- cy . getByTestID ( 'flux-editor' ) . monacoType ( task )
703-
704- cy . getByTestIDAndSetInputValue ( 'task-form-name' , name )
705- cy . getByTestIDAndSetInputValue ( 'task-form-offset-input' , offset )
706- cy . getByTestIDAndSetInputValue ( 'task-form-schedule-input' , every )
707- cy . getByTestID ( 'task-save-btn' ) . click ( )
708- cy . getByTestID ( 'notification-success--dismiss' ) . click ( )
709- }
0 commit comments