@@ -3,21 +3,15 @@ import { formsettings } from '../support/login.js';
33
44const depEnv = Cypress . env ( 'depEnv' ) ;
55
6-
76Cypress . Commands . add ( 'waitForLoad' , ( ) => {
87 const loaderTimeout = 60000 ;
98
109 cy . get ( '.nprogress-busy' , { timeout : loaderTimeout } ) . should ( 'not.exist' ) ;
1110} ) ;
12-
13-
14-
1511describe ( 'Form Designer' , ( ) => {
1612
1713 beforeEach ( ( ) => {
1814
19-
20-
2115 cy . on ( 'uncaught:exception' , ( err , runnable ) => {
2216 // Form.io throws an uncaught exception for missing projectid
2317 // Cypress catches it as undefined: undefined so we can't get the text
@@ -42,7 +36,7 @@ it('Verify draft submission', () => {
4236 cy . get ( 'span.btn' ) . contains ( 'Text Field' )
4337
4438 . trigger ( 'mousedown' , { which : 1 } , { force : true } )
45- . trigger ( 'mousemove' , coords . x , - 50 , { force : true } )
39+ . trigger ( 'mousemove' , coords . x , - 110 , { force : true } )
4640 . trigger ( 'mouseup' , { force : true } ) ;
4741 cy . get ( 'button' ) . contains ( 'Save' ) . click ( ) ;
4842 } ) ;
@@ -106,7 +100,7 @@ it('Verify draft submission', () => {
106100 cy . get ( '[data-test="save-btn"] > .v-btn__content' ) . click ( ) ;
107101 cy . get ( '.v-data-table__tr > :nth-child(4)' ) . contains ( 'DRAFT' ) . should ( 'not.exist' ) ;
108102 cy . get ( '.mdi-pencil' ) . click ( ) ;
109- cy . get ( '.ml-auto > :nth-child(3 ) > .v-btn' ) . click ( ) ;
103+ cy . get ( ':nth-child(4 ) > .v-btn' ) . click ( ) ;
110104 cy . waitForLoad ( ) ;
111105 cy . get ( '.v-alert__content > div' ) . contains ( 'Draft Saved' ) ;
112106 // Edit draft submission
@@ -125,16 +119,51 @@ it('Verify draft submission', () => {
125119 cy . location ( 'pathname' ) . should ( 'eq' , `/${ depEnv } /form/success` ) ;
126120 cy . contains ( 'h1' , 'Your form has been submitted successfully' ) ;
127121 cy . get ( '.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span' ) . click ( ) ;
128- //cy.get('div > .bg-primary').click();
122+ //Verify status column removed
129123 cy . get ( '.v-data-table__tr > :nth-child(4)' ) . contains ( 'SUBMITTED' ) . should ( 'not.exist' ) ;
124+ //Verify multiple draft upload functionality
125+ cy . visit ( `/${ depEnv } /form/submit?f=${ arrayValues [ 0 ] } ` ) ;
126+ cy . waitForLoad ( ) ;
127+ cy . get ( 'button' ) . contains ( 'Submit' ) . should ( 'be.visible' ) ;
128+ cy . waitForLoad ( ) ;
129+ cy . waitForLoad ( ) ;
130+ cy . get ( 'button[title="Switch to multiple submissions"]' ) . click ( ) ;
131+ cy . get ( 'h1' ) . contains ( 'Select JSON file to upload' ) . click ( ) ;
132+ let fileUploadInputField = cy . get ( 'input[type=file]' ) ;
133+ cy . get ( 'input[type=file]' ) . should ( 'not.to.be.null' ) ;
134+ fileUploadInputField . attachFile ( 'test_schema.json' ) ;
135+ cy . get ( '.v-alert__content' ) . contains ( 'Wrong json file format' ) . should ( 'be.visible' ) ;
136+ cy . get ( 'h1' ) . contains ( 'Select JSON file to upload' ) . click ( ) ;
137+ cy . get ( 'input[type=file]' ) . attachFile ( 'test_submissions.json' ) ;
138+ cy . wait ( 1000 ) ;
139+ //Upload sucessful message
140+ cy . get ( '.v-alert__content' ) . contains ( 'Your multiple draft upload has been successful!' ) . should ( 'be.visible' ) ;
141+ cy . wait ( 1000 ) ;
142+ //Verify download template link
143+ cy . get ( 'i[class="mdi-download mdi v-icon notranslate v-theme--chefsTheme v-icon--size-default mr-1"]' ) . should ( 'exist' ) ;
144+ //Verify Draft upload
145+ cy . contains ( 'p' , ' Your multiple draft upload has been successful!' ) . should ( 'exist' ) ;
146+ cy . get ( '.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span' ) . click ( ) ;
147+ //Verify draft uploaded
148+ cy . get ( 'button[title="Edit This Draft"]' ) . then ( $el => {
149+ const rem = $el [ 0 ] ;
150+ cy . get ( rem ) . click ( ) ;
151+ } )
152+ //Edit the uploaded draft
153+ cy . get ( 'input[name="data[simpletextfield]"]' ) . should ( 'have.value' , 'simple' ) . should ( 'exist' ) ;
154+ cy . contains ( 'Text Field' ) . type ( '{selectall}{backspace}' ) ;
155+ cy . contains ( "Text Field" ) . type ( "Edit uploaded draft" ) ;
156+ //form submission
157+ cy . get ( "button" ) . contains ( "Submit" ) . click ( ) ;
158+ cy . waitForLoad ( ) ;
159+ cy . get ( '[data-test="continue-btn-continue"]' ) . click ( { force : true } ) ;
160+ cy . wait ( 2000 ) ;
130161 //Delete form after test run
131162 cy . visit ( `/${ depEnv } /form/manage?f=${ arrayValues [ 0 ] } ` ) ;
132163 cy . waitForLoad ( ) ;
133164 cy . get ( '.mdi-delete' ) . click ( ) ;
134165 cy . get ( '[data-test="continue-btn-continue"]' ) . click ( ) ;
135166 cy . get ( '#logoutButton > .v-btn__content > span' ) . click ( ) ;
136-
137-
138167 } ) ;
139168
140169 } ) ;
0 commit comments