Skip to content

Commit efbae72

Browse files
test: FORMS- 2747 Changes for new floating action buttons in form designer page (bcgov#1763)
* 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 --------- Co-authored-by: RyanBirtch-aot <104386035+RyanBirtch-aot@users.noreply.github.com>
1 parent 570bd6b commit efbae72

17 files changed

Lines changed: 2017 additions & 2321 deletions
Lines changed: 66 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,122 +1,114 @@
1-
import "cypress-keycloak-commands";
2-
import { formsettings } from "../support/login.js";
1+
import 'cypress-keycloak-commands';
2+
import { formsettings } from '../support/login.js';
33

4-
const depEnv = Cypress.env("depEnv");
4+
const depEnv = Cypress.env('depEnv');
55

6-
Cypress.Commands.add("waitForLoad", () => {
6+
Cypress.Commands.add('waitForLoad', () => {
77
const loaderTimeout = 60000;
8-
cy.get(".nprogress-busy", { timeout: loaderTimeout }).should("not.exist");
8+
cy.get('.nprogress-busy', { timeout: loaderTimeout }).should('not.exist');
99
});
1010

11-
describe("Form Designer", () => {
12-
beforeEach(() => {
13-
cy.on("uncaught:exception", (err, runnable) => {
11+
describe('Form Designer', () => {
12+
13+
beforeEach(()=>{
14+
15+
cy.on('uncaught:exception', (err, runnable) => {
1416
// Form.io throws an uncaught exception for missing projectid
1517
// Cypress catches it as undefined: undefined so we can't get the text
1618
console.log(err);
1719
return false;
1820
});
1921
});
20-
it("Visits the form settings page", () => {
22+
it('Visits the form settings page', () => {
23+
2124
cy.viewport(1000, 1100);
2225
cy.waitForLoad();
2326
formsettings();
2427
});
25-
it("checks Apikey Settings", () => {
28+
it('checks Apikey Settings', () => {
2629
cy.viewport(1000, 1100);
2730
cy.waitForLoad();
28-
29-
cy.get("button").contains("BC Government").click();
30-
cy.get("div.formio-builder-form").then(($el) => {
31+
32+
cy.get('button').contains('BC Government').click();
33+
cy.get('div.formio-builder-form').then($el => {
3134
const coords = $el[0].getBoundingClientRect();
3235
cy.get('[data-key="simplebcaddress"]')
33-
.trigger("mousedown", { which: 1 }, { force: true })
34-
.trigger("mousemove", coords.x, -550, { force: true })
36+
.trigger('mousedown', { which: 1}, { force: true })
37+
.trigger('mousemove', coords.x, -550, { force: true })
3538
//.trigger('mousemove', coords.y, +100, { force: true })
36-
.trigger("mouseup", { force: true });
37-
cy.wait(2000);
38-
cy.get("button").contains("Save").click();
39+
.trigger('mouseup', { force: true });
40+
cy.wait(2000);
41+
cy.get('.btn-success').click();
3942
});
4043
// Form saving
41-
cy.wait(2000);
42-
let savedButton = cy.get("[data-cy=saveButton]");
44+
cy.wait(2000);
45+
let savedButton = cy.get('[data-cy=saveButton]');
4346
expect(savedButton).to.not.be.null;
44-
savedButton.trigger("click");
47+
savedButton.trigger('click');
4548
cy.wait(3000);
4649

4750
// Verify Api key functionality
48-
cy.get(".mdi-cog").click();
49-
cy.get(
50-
":nth-child(2) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay"
51-
).click();
52-
51+
cy.get('.mdi-dots-vertical').click();
52+
cy.get('[data-cy="settingsRouterLink"] > .v-btn > .v-btn__content').click();
53+
cy.get(':nth-child(2) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click();
54+
5355
cy.get('[data-test="canGenerateAPIKey"]').click();
5456
cy.get('[data-test="continue-btn-continue"]').click();
55-
cy.get('[data-test="continue-btn-cancel"]').should("be.enabled");
57+
cy.get('[data-test="continue-btn-cancel"]').should('be.enabled');
5658
cy.get('[data-test="canAllowCopyAPIKey"]').click();
5759
//Verify checkbox checked for access submitted files
58-
cy.contains("Allow this API key to access submitted files").click();
59-
cy.get(
60-
'input[aria-label="Allow this API key to access submitted files"]'
61-
).should("be.checked");
60+
cy.contains('Allow this API key to access submitted files').click();
61+
cy.get('input[aria-label="Allow this API key to access submitted files"]').should('be.checked');
6262
//Delete Apikey
63-
cy.get('[data-test="canDeleteApiKey"]');
64-
});
65-
it("checks Cdogs Upload", () => {
63+
cy.get('[data-test="canDeleteApiKey"]')
64+
65+
66+
})
67+
it('checks Cdogs Upload', () => {
6668
cy.viewport(1000, 1100);
6769
cy.waitForLoad();
68-
cy.get(
69-
":nth-child(3) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay"
70-
).click();
71-
let fileUploadInputField = cy.get("input[type=file]");
72-
cy.get("input[type=file]").should("not.to.be.null");
73-
fileUploadInputField.attachFile("add1.png");
70+
cy.get(':nth-child(3) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click();
71+
let fileUploadInputField = cy.get('input[type=file]');
72+
cy.get('input[type=file]').should('not.to.be.null');
73+
fileUploadInputField.attachFile('add1.png');
7474

7575
// Checking file type functionality
76-
cy.get("div")
77-
.contains(
78-
"The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx"
79-
)
80-
.should("be.visible");
81-
cy.get(".mdi-close-circle").click();
82-
cy.get("input[type=file]").should("not.to.be.null");
83-
fileUploadInputField.attachFile("SamplePPTx.pptx");
84-
cy.get("div")
85-
.contains(
86-
"The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx"
87-
)
88-
.should("not.exist");
89-
76+
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();
78+
cy.get('input[type=file]').should('not.to.be.null');
79+
fileUploadInputField.attachFile('SamplePPTx.pptx');
80+
cy.get('div').contains('The template must use one of the following extentions: .txt, .docx, .html, .odt, .pptx, .xlsx').should('not.exist');
81+
9082
cy.waitForLoad();
9183
cy.waitForLoad();
9284
cy.get('button[title="Upload"]').click();
93-
cy.wait(2000);
94-
cy.get(".mdi-minus-circle").click();
95-
cy.get("input[type=file]").should("not.to.be.null");
96-
fileUploadInputField.attachFile("file_example_XLSX_50.xlsx");
85+
cy.wait(2000);
86+
cy.get('.mdi-minus-circle').click();
87+
cy.get('input[type=file]').should('not.to.be.null');
88+
fileUploadInputField.attachFile('file_example_XLSX_50.xlsx');
9789
cy.waitForLoad();
9890
cy.get('button[title="Upload"]').click();
99-
cy.get(".mdi-minus-circle").click();
100-
cy.get("input[type=file]").should("not.to.be.null");
101-
fileUploadInputField.attachFile("Testing_files.txt");
91+
cy.get('.mdi-minus-circle').click();
92+
cy.get('input[type=file]').should('not.to.be.null');
93+
fileUploadInputField.attachFile('Testing_files.txt');
10294
cy.get('button[title="Upload"]').click();
103-
cy.get(".mdi-minus-circle").click();
104-
cy.get("input[type=file]").should("not.to.be.null");
105-
fileUploadInputField.attachFile("test.docx");
106-
cy.contains("div", "test.docx (11.9 kB)").should("be.visible");
95+
cy.get('.mdi-minus-circle').click();
96+
cy.get('input[type=file]').should('not.to.be.null');
97+
fileUploadInputField.attachFile('test.docx');
98+
cy.contains('div','test.docx (11.9 kB)').should('be.visible');
10799
cy.get('button[title="Upload"]').click();
108-
cy.contains("span", "test.docx").should("be.visible");
109-
cy.contains("div", "test.docx (11.9 kB)").should("not.exist");
100+
cy.contains('span','test.docx').should('be.visible');
101+
cy.contains('div','test.docx (11.9 kB)').should('not.exist');
110102

111103
// Verify cdogs template uplaod success message
112-
cy.get(".v-alert__content")
113-
.contains("div", "Template uploaded successfully.")
114-
.should("be.visible");
104+
cy.get('.v-alert__content').contains('div','Template uploaded successfully.').should('be.visible');
115105
//Delete form after test run
116-
106+
117107
cy.get('[data-test="canRemoveForm"]').click();
118108
cy.get('[data-test="continue-btn-continue"]').click();
119109
cy.wait(9000);
120-
cy.get("#logoutButton > .v-btn__content > span").click();
121-
});
122-
});
110+
cy.get('#logoutButton > .v-btn__content > span').click();
111+
112+
})
113+
114+
})

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

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ it('Checks the Container component', () => {
4545
cy.get('input[name="data[label]"]').clear().type('Application');
4646
cy.get('input[name="data[customClass]"]').type('bg-primary');
4747
cy.waitForLoad();
48-
cy.get('button').contains('Save').click();
48+
cy.get('.btn-success').click();
4949
});
5050

5151
});
@@ -62,7 +62,7 @@ it('Checks the Container component', () => {
6262
.trigger('mousedown', { which: 1}, { force: true })
6363
.trigger('mousemove', coords.x, -400, { force: true })
6464
.trigger('mouseup', { force: true });
65-
cy.get('button').contains('Save').click();
65+
cy.get('.btn-success').click();
6666
});
6767

6868
});
@@ -78,7 +78,7 @@ it('Checks the Container component', () => {
7878
.trigger('mousedown', { which: 1}, { force: true })
7979
.trigger('mousemove', coords.x, -300, { force: true })
8080
.trigger('mouseup', { force: true });
81-
cy.get('button').contains('Save').click();
81+
cy.get('.btn-success').click();
8282
});
8383

8484
});
@@ -96,7 +96,7 @@ it('Checks the Container component', () => {
9696
cy.get('input[name="data[label]"]').clear().type('Application');
9797
cy.get('input[name="data[customClass]"]').type('bg-primary');
9898
cy.waitForLoad();
99-
cy.get('button').contains('Save').click();
99+
cy.get('.btn-success').click();
100100

101101
});
102102
/*
@@ -166,7 +166,7 @@ it('Checks the Container component', () => {
166166
cy.get('input[name="data[label]"]').clear().type('Add more days');
167167
cy.get('input[name="data[customClass]"]').type('bg-primary');
168168
cy.waitForLoad();
169-
cy.get('button').contains('Save').click();
169+
cy.get('.btn-success').click();
170170
});
171171

172172
// Form saving
@@ -192,9 +192,6 @@ it('Checks the Container component', () => {
192192
cy.get('.list-group-item').should('exist');
193193
//cy.get('[ref="datagrid-dataGrid"]').should('be.visible');
194194
cy.get('.col-md-1').should('be.visible');
195-
196-
cy.visit(`/${depEnv}`);
197-
cy.get('[data-cy="userFormsLinks"]').click();
198195
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
199196
cy.waitForLoad();
200197
//Delete form after test run

0 commit comments

Comments
 (0)