Skip to content

Commit 5590712

Browse files
test: forms-2498 Cypress scripts for export submission functionality validation after unpublish the form (bcgov#1738)
* Added multiple draft functionality * Changes to enable multiple draft uplaod * sample drfat file * Removed unused code * Validate export functionality after unpublish * Added check for export button * Update form-submission-assign-status.cy.js * Update form-submission-assign-status.cy.js * Removed unused codes * Fixed some running issues --------- Co-authored-by: usingtechnology <39388115+usingtechnology@users.noreply.github.com>
1 parent 46f3f4d commit 5590712

2 files changed

Lines changed: 42 additions & 28 deletions

File tree

tests/functional/cypress/e2e/form-submission-assign-status.cy.js

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ describe('Form Designer', () => {
3030

3131
});
3232
it('Form Submission and Updation', () => {
33-
34-
cy.viewport(1000, 1100);
35-
cy.waitForLoad();
3633
cy.viewport(1000, 1800);
3734
cy.waitForLoad();
3835
cy.get('button').contains('Basic Fields').click();
@@ -45,12 +42,12 @@ describe('Form Designer', () => {
4542
.trigger('mouseup', { force: true });
4643
cy.get('button').contains('Save').click();
4744
});
48-
cy.wait(4000);
45+
cy.wait(2000);
4946
// Form saving
5047
let savedButton = cy.get('[data-cy=saveButton]');
5148
expect(savedButton).to.not.be.null;
5249
savedButton.should('be.visible').trigger('click');
53-
cy.wait(4000);
50+
cy.wait(2000);
5451
// Filter the newly created form
5552
cy.location('search').then(search => {
5653

@@ -68,7 +65,7 @@ describe('Form Designer', () => {
6865
cy.contains('Continue').trigger('click');
6966
//Submit the form
7067
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
71-
cy.wait(4000);
68+
cy.wait(2000);
7269
cy.get('button').contains('Submit').should('be.visible');
7370
cy.waitForLoad();
7471
cy.contains('Text Field').click();
@@ -77,31 +74,29 @@ describe('Form Designer', () => {
7774
cy.get('button').contains('Submit').click();
7875
cy.waitForLoad();
7976
cy.get('button').contains('Submit').click();
80-
cy.wait(4000);
77+
cy.wait(2000);
8178
cy.get('label').contains('Text Field').should('be.visible');
8279
cy.get('label').contains('Text Field').should('be.visible');
8380
cy.location('pathname').should('eq', `/${depEnv}/form/success`);
8481
cy.contains('h1', 'Your form has been submitted successfully');
85-
cy.wait(4000);
82+
cy.wait(2000);
8683
//Update submission
8784
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
88-
cy.wait(4000);
85+
cy.wait(2000);
8986
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
90-
cy.wait(4000);
87+
cy.wait(2000);
9188
cy.get('button').contains('Submit').should('be.visible');
9289
cy.contains('Text Field').click();
9390
cy.contains('Text Field').type('Smith');
9491
cy.get('button').contains('Submit').click();
9592
cy.waitForLoad();
9693
cy.get('button').contains('Submit').click();
97-
//cy.get('[data-test="continue-btn-continue"]').click();
9894
cy.get('label').contains('Text Field').should('be.visible');
99-
//cy.get('label').contains('Applying for self').should('be.visible');
10095
cy.location('pathname').should('eq', `/${depEnv}/form/success`);
10196
cy.contains('h1', 'Your form has been submitted successfully');
102-
cy.wait(4000);
97+
cy.wait(2000);
10398
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
104-
cy.wait(4000);
99+
cy.wait(2000);
105100
cy.get('.mdi-list-box-outline').click();
106101
cy.waitForLoad();
107102
//Verify pagination for submission
@@ -116,13 +111,13 @@ describe('Form Designer', () => {
116111
cy.get('button[title="Delete Submission"]').should('exist');
117112
//view submission
118113
cy.get(':nth-child(1) > :nth-child(7) > a > .v-btn').click();
119-
cy.wait(4000);
114+
cy.wait(2000);
120115
});
121116

122117
});
123118
it('Submission status Assignment', () => {
124119
cy.viewport(1000, 1100);
125-
cy.wait(4000);
120+
cy.wait(2000);
126121
//Assign status submission
127122
cy.get('.status-heading > .mdi-chevron-right').click();
128123
cy.get('[data-test="showStatusList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').click();
@@ -132,7 +127,7 @@ describe('Form Designer', () => {
132127
cy.get('[data-test="showAssigneeList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').type('ch');
133128
cy.get('div').contains('CHEFS Testing').click();
134129
cy.get('[data-test="updateStatusToNew"] > .v-btn__content > span').click();
135-
cy.wait(4000);
130+
cy.wait(2000);
136131
cy.get('.mdi-list-box-outline').click();
137132
cy.get('input[type="checkbox"]').then($el => {
138133
const rem1=$el[2];////Assigned to me checkbox
@@ -148,7 +143,7 @@ describe('Form Designer', () => {
148143
cy.get(':nth-child(1) > :nth-child(7) > a > .v-btn').click();
149144
cy.wait(2000);
150145
});
151-
//Assign remaing statuses
146+
//Assign remaining statuses
152147
cy.get('.status-heading > .mdi-chevron-right').click();
153148
cy.get('[data-test="showStatusList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').click();
154149
cy.contains('REVISING').click();
@@ -157,7 +152,7 @@ describe('Form Designer', () => {
157152
cy.get('textarea[rows="1"]').type('some comments');
158153
cy.get('button').contains('REVISE').click();
159154
cy.get(':nth-child(1) > .v-checkbox > .v-input__control > .v-selection-control > .v-label').click();
160-
cy.wait(4000);
155+
cy.wait(2000);
161156
//Verify Edit submission button is disabled
162157
cy.get('button[title="Edit This Submission"]').should('be.disabled');
163158
//Verify Submission edit users history
@@ -202,7 +197,7 @@ describe('Form Designer', () => {
202197
cy.get('.v-data-table__tbody > :nth-child(2) > :nth-child(2)').should('not.exist');
203198
//Delete form after test run
204199
cy.visit(`/${depEnv}/form/manage?f=${arr[1]}`);
205-
cy.wait(4000);
200+
cy.wait(2000);
206201
cy.get('.mdi-delete').click();
207202
cy.get('[data-test="continue-btn-continue"]').click();
208203
cy.get('#logoutButton > .v-btn__content > span').click();
@@ -211,4 +206,4 @@ describe('Form Designer', () => {
211206

212207
});
213208

214-
});
209+
});

tests/functional/cypress/e2e/form-submission-export.cy.js

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ describe("Form Designer", () => {
3232
.contains("Text Field")
3333

3434
.trigger("mousedown", { which: 1 }, { force: true })
35-
.trigger("mousemove", coords.x, -50, { force: true })
35+
.trigger("mousemove", coords.x, -110, { force: true })
3636
.trigger("mouseup", { force: true });
3737
cy.get("button").contains("Save").click();
3838
});
@@ -187,9 +187,7 @@ describe("Form Designer", () => {
187187
cy.get('input[type="checkbox"]').should('not.be.checked');
188188
cy.get('input[type="checkbox"]').click();
189189
cy.get('input[type="checkbox"]').should('be.checked');
190-
191190
cy.get('.v-window-item--active > .flex-container > .more-info-link').should('exist');
192-
193191
//print option for submission files
194192
cy.get('[tabindex="-1"] > .v-btn__content').click();
195193
let fileUploadInputField = cy.get('input[type=file]');
@@ -199,7 +197,6 @@ describe("Form Designer", () => {
199197
cy.get('label').contains('Upload template file').click({multiple:true,force:true});
200198
cy.get('.v-messages__message').contains('The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx');
201199
cy.get('#file-input-submit').should('not.be.enabled');
202-
//
203200
cy.waitForLoad();
204201
//Upload print template
205202
cy.get('.v-slide-group__content > [tabindex="-1"]').click();
@@ -208,10 +205,8 @@ describe("Form Designer", () => {
208205
cy.get('.mdi-close-circle').click();
209206
cy.get('input[type=file]').attachFile('test.docx');
210207
cy.waitForLoad();
211-
//cy.get('.v-selection-control-group > .v-input--dirty > .v-input__control > .v-field > .v-field__append-inner > .mdi-menu-down').click();
212208
cy.get('.v-selection-control-group > .v-text-field > .v-input__control > .v-field').click();
213209
cy.contains('pdf').should('be.visible');
214-
//cy.get('span').contains('docx').should('exist');
215210
cy.contains('pdf').click();
216211
cy.get('#file-input-submit').should('be.enabled');
217212
cy.get('.v-card-actions > .flex-container > .text-textLink').should('be.enabled');
@@ -222,7 +217,31 @@ describe("Form Designer", () => {
222217
cy.get('body').click(0,0);
223218
cy.wait(2000);
224219
cy.get('.v-alert__content').contains('Document generated successfully').should('be.visible');
225-
220+
cy.get('.mdi-list-box-outline').click();
221+
//Manage form settings
222+
cy.get('.mdi-cog').click();
223+
cy.wait(2000);
224+
//Unpublish the form
225+
cy.get(".v-label > span").click();
226+
cy.get('.v-card-title > span').contains('Unpublish Version 1');
227+
cy.contains("Continue").should("be.visible");
228+
cy.contains("Continue").trigger("click");
229+
//Go to Export Submissions
230+
cy.get('.mdi-list-box-outline').click();
231+
cy.wait(2000);
232+
cy.get('.mdi-download').click();
233+
cy.wait(2000);
234+
cy.get('span').contains('Submission Date').should('be.visible');
235+
cy.get('.mb-5 > .v-btn__content > span').contains('Export').should('be.visible');
236+
//Verify export button is enabled
237+
cy.get('.mb-5').should('be.enabled');
238+
//Validate form version is selected and visible
239+
cy.get('input[value="csv"]').click();
240+
cy.get('span[class="v-select__selection-text"]').then($el => {
241+
const rem=$el[0];
242+
//Verfiy form version is selected
243+
cy.get(rem).contains('1');
244+
});
226245
//Delete form after test run
227246
cy.get('.mdi-list-box-outline').click();
228247
cy.location("search").then((search) => {

0 commit comments

Comments
 (0)