Skip to content

Commit 7891510

Browse files
authored
test: FORMS- 2711Cypress test scripts for adding new form design version from previous base version (bcgov#1764)
* Added Submitter revision form check * Added submission recall ability * Added recall functionality * Added public form check * Added validations for BC SC card login type on form settings * Added scripts to reuse formid in multiple tests * updated public form to access formid * Updated other tests to reuse same formid * Updated * Added updated scripts for Flating button changes on designer page * Updated * Added validations for updating design versions * Added cypress tests for permanent delete feature settings * Update form-apikey-cdogs.cy.js * Updated with latest changes * Updated scripts
1 parent 69fe16f commit 7891510

4 files changed

Lines changed: 64 additions & 17 deletions

File tree

tests/functional/cypress/e2e/form-apikey-cdogs.cy.js

Lines changed: 60 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Form Designer', () => {
3737
.trigger('mousemove', coords.x, -550, { force: true })
3838
//.trigger('mousemove', coords.y, +100, { force: true })
3939
.trigger('mouseup', { force: true });
40-
cy.wait(2000);
40+
cy.wait(1000);
4141
cy.get('.btn-success').click();
4242
});
4343
// Form saving
@@ -46,12 +46,64 @@ describe('Form Designer', () => {
4646
expect(savedButton).to.not.be.null;
4747
savedButton.trigger('click');
4848
cy.wait(3000);
49-
50-
// Verify Api key functionality
49+
//Publish form
50+
cy.get('.mdi-dots-vertical').click();
51+
cy.get('[data-cy="publishRouterLink"] > .v-btn > .v-btn__content').click();
52+
cy.get('span').contains('Publish Version 1');
53+
cy.contains('Continue').should('be.visible');
54+
cy.contains('Continue').trigger('click');
55+
//Update form design version
56+
cy.get('.mdi-plus').click();
57+
//Add new component to version 1
58+
cy.get('div.formio-builder-form').then($el => {
59+
const coords = $el[0].getBoundingClientRect();
60+
cy.get('span.btn').contains('Columns - 2')
61+
.trigger('mousedown', { which: 1}, { force: true })
62+
.trigger('mousemove', coords.x, -140, { force: true })
63+
.trigger('mouseup', { force: true });
64+
cy.get('.btn-success').click();
65+
});
66+
// Form saving
67+
cy.wait(1000);
68+
cy.get('[data-cy=saveButton]').click();
69+
cy.wait(1000);
5170
cy.get('.mdi-dots-vertical').click();
5271
cy.get('[data-cy="settingsRouterLink"] > .v-btn > .v-btn__content').click();
72+
cy.get('span').contains('Please publish or delete your latest draft version before starting a new version.').should('exist');
73+
cy.get('.mdi-plus').should('not.be.enabled');
74+
cy.get('button[title="Delete Version"]').should('be.visible');
75+
cy.get('button[title="Delete Version"]').click();
76+
cy.get('span').contains('Are you sure you wish to delete this Version?').should('be.visible');
77+
cy.get('button').contains('Delete').should('be.visible').click();
78+
cy.get('button[title="Delete Version"]').should('not.exist');
79+
//Update form design version
80+
cy.get('.mdi-plus').click();
81+
cy.get('div.formio-builder-form').then($el => {
82+
const coords = $el[0].getBoundingClientRect();
83+
cy.get('span.btn').contains('Columns - 3')
84+
.trigger('mousedown', { which: 1}, { force: true })
85+
.trigger('mousemove', coords.x, -140, { force: true })
86+
.trigger('mouseup', { force: true });
87+
cy.get('.btn-success').click();
88+
});
89+
//Form saving
90+
cy.wait(1000);
91+
cy.get('[data-cy=saveButton]').click();
92+
cy.wait(1000);
93+
cy.get('.mdi-dots-vertical').click();
94+
cy.get('[data-cy="publishRouterLink"] > .v-btn > .v-btn__content').click();
95+
cy.get('span').contains('Publish Version 2');
96+
cy.contains('Continue').should('be.visible');
97+
cy.contains('Continue').trigger('click');
98+
cy.get('button[title="Use version 2 as the base for a new version"]').should('be.visible');
99+
cy.get('button[title="Use version 1 as the base for a new version"]').should('be.visible');
100+
cy.get(':nth-child(1) > .v-data-table-column--align-end > :nth-child(1) > .v-btn > .v-btn__content > .mdi-download').should('be.visible');
101+
cy.get(':nth-child(2) > .v-data-table-column--align-end > :nth-child(1) > .v-btn > .v-btn__content > .mdi-download').should('be.visible');
102+
// Verify Api key functionality
103+
cy.get(':nth-child(1) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click();
104+
cy.get('[lang="en"] > .v-btn > .v-btn__content > .mdi-pencil').click();
53105
cy.get(':nth-child(2) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click();
54-
106+
//Generate Apikey
55107
cy.get('[data-test="canGenerateAPIKey"]').click();
56108
cy.get('[data-test="continue-btn-continue"]').click();
57109
cy.get('[data-test="continue-btn-cancel"]').should('be.enabled');
@@ -60,8 +112,9 @@ describe('Form Designer', () => {
60112
cy.contains('Allow this API key to access submitted files').click();
61113
cy.get('input[aria-label="Allow this API key to access submitted files"]').should('be.checked');
62114
//Delete Apikey
63-
cy.get('[data-test="canDeleteApiKey"]')
64-
115+
cy.get('[data-test="canDeleteApiKey"]').click();
116+
cy.get('[data-test="continue-btn-continue"]').click();
117+
cy.get('.v-alert__content').contains('div','The API Key for this form has been deleted.').should('be.visible');
65118

66119
})
67120
it('checks Cdogs Upload', () => {
@@ -74,7 +127,7 @@ describe('Form Designer', () => {
74127

75128
// Checking file type functionality
76129
cy.get('div').contains('The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx').should('be.visible');
77-
cy.get('.mdi-close-circle').click();
130+
//cy.get('.mdi-close-circle').click();
78131
cy.get('input[type=file]').should('not.to.be.null');
79132
fileUploadInputField.attachFile('SamplePPTx.pptx');
80133
cy.get('div').contains('The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx').should('not.exist');
@@ -99,15 +152,11 @@ describe('Form Designer', () => {
99152
cy.get('button[title="Upload"]').click();
100153
cy.contains('span','test.docx').should('be.visible');
101154
cy.contains('div','test.docx (11.9 kB)').should('not.exist');
102-
103155
// Verify cdogs template uplaod success message
104156
cy.get('.v-alert__content').contains('div','Template uploaded successfully.').should('be.visible');
105157
//Delete form after test run
106-
107158
cy.get('[data-test="canRemoveForm"]').click();
108159
cy.get('[data-test="continue-btn-continue"]').click();
109-
cy.wait(9000);
110-
cy.get('#logoutButton > .v-btn__content > span').click();
111160

112161
})
113162

tests/functional/cypress/e2e/form-design-basicfields.cy.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ describe('Form Designer', () => {
129129
.trigger('mouseup', { force: true });
130130
cy.get('.btn-success').click();
131131
});
132+
cy.wait(1000);
132133
//Phone Number
133134
cy.get('div.formio-builder-form').then($el => {
134135
const coords = $el[0].getBoundingClientRect();
@@ -137,10 +138,6 @@ describe('Form Designer', () => {
137138
.trigger('mousedown', { which: 1}, { force: true })
138139
.trigger('mousemove', coords.x, -50, { force: true })
139140
.trigger('mouseup', { force: true });
140-
//cy.get('p').contains('Multi-line Text Component');
141-
cy.get('input[name="data[label]"]').clear();
142-
cy.get('input[name="data[label]"]').clear();
143-
cy.get('input[name="data[label]"]').type('Phone Number');
144141
cy.get('.btn-success').click();
145142
});
146143
//Email

tests/functional/cypress/e2e/form-draft-submission-management.cy.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,8 @@ it('Verify draft submission', () => {
9393
cy.contains('Text Field').click();
9494
cy.contains('Text Field').type('Alex');
9595
cy.get('.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span').click();
96-
cy.get('div > .bg-primary').click();
96+
//cy.get('div > .bg-primary').click();
97+
cy.get('.v-card-actions > div > .bg-primary').click();
9798
cy.get('.v-data-table__tr > :nth-child(4)').contains('DRAFT');
9899
//Verify draft delete button exist
99100
cy.get('[icon-size="x-small"] > .v-btn').should('be.exist');

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ it('Verify draft submission', () => {
8686
cy.contains('Text Field').click();
8787
cy.contains('Text Field').type('Alex');
8888
cy.get('.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span').click();
89-
cy.get('div > .bg-primary').click();
89+
cy.get('.v-card-actions > div > .bg-primary').click();
9090
cy.get('.v-data-table__tr > :nth-child(4)').contains('DRAFT');
9191
});
9292

0 commit comments

Comments
 (0)