Skip to content

Commit fc29d05

Browse files
Merge branch 'main' into CCP-4138-empty-json-download
2 parents c6abcb0 + c762e07 commit fc29d05

9 files changed

Lines changed: 116 additions & 81 deletions

File tree

components/src/components/SimpleSelect/Component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export default class Component extends (ParentComponent as any) {
7272
'input[ref=autocompleteInput]'
7373
);
7474
if (!autocompleteInputs.length) return;
75-
autocompleteInputs.array.forEach((input, index) => {
75+
autocompleteInputs.array?.forEach((input, index) => {
7676
input.setAttribute('autocomplete', 'new-password');
7777
input.setAttribute('name', `${this.key}-dropdown-${index}`);
7878
});

components/src/components/SimpleSelectAdvanced/Component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export default class Component extends (ParentComponent as any) {
4141
'input[ref=autocompleteInput]'
4242
);
4343
if (!autocompleteInputs.length) return;
44-
autocompleteInputs.array.forEach((input, index) => {
44+
autocompleteInputs.array?.forEach((input, index) => {
4545
input.setAttribute('autocomplete', 'new-password');
4646
input.setAttribute('name', `${this.key}-dropdown-${index}`);
4747
});
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"formId": "707023d4-9d7f-4fce-ac4d-95b58942ac6a"
2+
"formId": "9668e1b2-bd7c-4034-a1e6-bd1b247cdc1a"
33
}

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

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ describe('Form Designer', () => {
2727
cy.checkA11yPage();
2828
});
2929
it('Getting page ready', () => {
30-
cy.viewport(1000, 1100);
30+
cy.viewport(1000, 1800);
3131
cy.get('button').contains('BC Government').click();
3232
});
3333
it('checks Data Retention Settings', () => {
34-
cy.viewport(1000, 1100);
34+
cy.viewport(1000, 1800);
3535
cy.waitForLoad();
3636
cy.get('div.formio-builder-form').then($el => {
3737
const coords = $el[0].getBoundingClientRect();
@@ -68,13 +68,41 @@ describe('Form Designer', () => {
6868
});
6969
// Form saving
7070
cy.wait(1000);
71+
cy.get('.mdi-dots-vertical').click();
72+
cy.get('[data-cy="previewRouterLink"] > .v-btn').trigger('mouseover', { force: true });
73+
cy.get('.v-overlay__content').contains('Save a version of the form to preview').should('exist');
74+
cy.get('[data-cy="publishRouterLink"] > .v-btn').trigger('mouseover', { force: true });
75+
cy.get('.v-overlay__content').contains('Publish form').should('exist');
7176
cy.get('[data-cy=saveButton]').click();
7277
cy.wait(2000);
7378
cy.get('.mdi-dots-vertical').click();
79+
cy.get('[data-cy="publishRouterLink"] > .v-btn').trigger('mouseover', { force: true });
80+
cy.get('.v-overlay__content').contains('Please save a new version to publish').should('exist');
7481
cy.get('[data-cy="settingsRouterLink"] > .v-btn > .v-btn__content').click();
7582
cy.get('span').contains('Please publish or delete your latest draft version before starting a new version.').should('exist');
7683
cy.get('.mdi-plus').should('not.be.enabled');
7784
cy.get('button[title="Delete Version"]').should('be.visible');
85+
cy.get('button[title="Edit Version"]').click();
86+
cy.wait(1000);
87+
//Add new component to version 1
88+
cy.get('div.formio-builder-form').then($el => {
89+
const coords = $el[0].getBoundingClientRect();
90+
cy.get('span.btn').contains('Text/Images')
91+
92+
.trigger('mousedown', { which: 1}, { force: true })
93+
.trigger('mousemove', coords.x, -50, { force: true })
94+
.trigger('mouseup', { force: true });
95+
cy.waitForLoad();
96+
cy.get('.btn-success').click();
97+
});
98+
cy.wait(1000);
99+
cy.get('.mdi-dots-vertical').click();
100+
//Tooiltip message for preview button for new version
101+
cy.get('[data-cy="previewRouterLink"] > .v-btn').trigger('mouseover', { force: true });
102+
cy.get('.v-overlay__content').contains('Save to preview updated form version').should('exist');
103+
//Delete old version
104+
cy.get('[data-cy="settingsRouterLink"] > .v-btn > .v-btn__content').click();
105+
cy.wait(1000);
78106
cy.get('button[title="Delete Version"]').click();
79107
cy.get('span').contains('Are you sure you wish to delete this Version?').should('be.visible');
80108
cy.get('button').contains('Delete').should('be.visible').click();

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

Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -180,10 +180,10 @@ describe('Form Designer', () => {
180180
});
181181
});
182182
it('Verify submission', () => {
183-
cy.viewport(1000, 1800);
184-
cy.waitForLoad();
185-
cy.waitForLoad();
186-
cy.intercept('GET', `/${depEnv}/api/v1/forms/*`).as('getForm');
183+
cy.viewport(1000, 1800);
184+
cy.waitForLoad();
185+
cy.waitForLoad();
186+
cy.intercept('GET', `/${depEnv}/api/v1/forms/*`).as('getForm');
187187
// Form saving
188188
let savedButton = cy.get('[data-cy=saveButton]');
189189
expect(savedButton).to.not.be.null;
@@ -192,37 +192,25 @@ describe('Form Designer', () => {
192192
// Filter the newly created form
193193
cy.location('search').then(search => {
194194
//let pathName = fullUrl.pathname
195-
let arr = search.split('=');
196-
let arrayValues = arr[1].split('&');
197-
cy.log(arrayValues[0]);
198-
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
199-
cy.waitForLoad();
200-
})
201-
195+
let arr = search.split('=');
196+
let arrayValues = arr[1].split('&');
197+
cy.log(arrayValues[0]);
198+
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
199+
cy.waitForLoad();
202200
//Publish the form
203201
cy.get('.v-label > span').click();
204202
cy.get('span').contains('Publish Version 1');
205203
cy.contains('Continue').should('be.visible');
206204
cy.contains('Continue').trigger('click');
207205

208206
//Share link verification
209-
let shareFormButton = cy.get('[data-cy=shareFormButton]');
210-
expect(shareFormButton).to.not.be.null;
211-
shareFormButton.trigger('click').then(()=>{
212-
//let shareFormLinkButton = cy.get('[data-cy=shareFormLinkButtonss]');
213-
let shareFormLinkButton=cy.get('.mx-2');
214-
expect(shareFormLinkButton).to.not.be.null;
215-
shareFormLinkButton.trigger('click');
216-
//Close form share window
217-
cy.get('.v-card-actions > .v-btn > .v-btn__content > span').click();
218-
});
207+
cy.get('[data-cy=shareFormButton]').should('be.visible').click();
208+
cy.get('.v-card-actions > .v-btn > .v-btn__content > span').click();
219209
cy.location('search').then(search => {
220210
//let pathName = fullUrl.pathname
221211
let arr = search.split('=');
222212
let arrayValues = arr[1].split('&');
223213
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
224-
cy.waitForLoad();
225-
226214
cy.waitForLoad();
227215
// for print option verification
228216
cy.get(':nth-child(2) > .d-print-none > :nth-child(1) > .v-btn').should('be.visible');
@@ -247,32 +235,55 @@ describe('Form Designer', () => {
247235
cy.get('.browse').should('have.attr', 'ref').and('include', 'fileBrowse');
248236
cy.get('.browse').should('have.attr', 'href').and('include', '#');
249237
cy.get('.browse').click();
250-
let fileUploadInputField = cy.get('input[type=file]');
251-
cy.get('input[type=file]').should('not.to.be.null');
252-
fileUploadInputField.attachFile('add1.png');
253-
cy.waitForLoad();
254-
//verify file uploads to object storage
238+
// Intercept POST upload
239+
cy.intercept('POST', '/api/v1/files').as('uploadFile');
240+
// Trigger upload (adjust selector as needed)
241+
cy.get('input[type="file"]').selectFile('fixtures/add1.png', {
242+
force: true
243+
});
244+
//verify file uploads to object storage and extract fileId
255245
cy.get('.col-md-9 > a').should('have.attr', 'ref').and('include', 'fileLink');
256246
cy.get('div.col-md-2').contains('61.48 kB');
257-
cy.wait(2000);
258-
//form submission
247+
cy.wait(1000);
248+
cy.get('.col-md-9 > a')
249+
.should('have.attr', 'href')
250+
.then((href) => {
251+
const fileId = href.split('/').pop(); // get last part
252+
cy.wrap(fileId).as('fileId');
253+
//form submission
259254
cy.get('button').contains('Submit').click();
260255
cy.wait(2000);
261256
cy.get('[data-test="continue-btn-continue"]').click();
257+
// Validate file exists via API
258+
cy.then(() => {
259+
cy.request({
260+
method: 'GET',
261+
url: `/api/v1/files/${fileId}`,
262+
failOnStatusCode: false
263+
}).then((res) => {
264+
expect(res.status).to.eq(503);
265+
});
266+
});
267+
});
262268
// verify the components after submission
263269
cy.get('span').contains('Canadian').should('be.visible');
264270
cy.get('span').contains('Eligible').should('be.visible');
265271
cy.get('.choices__inner > .choices__list > .choices__item').contains('hello');
266272
cy.get('.col-md-9 > a').contains('add1.png');
267273
cy.get('.ui > .choices__list > .choices__item').contains('THRIFTY FOODS');
274+
//Verify uploaded file is downloadable
275+
cy.get('.col-md-9 > a').contains('add1.png').click();
276+
const path = require("path");
277+
const downloadsFolder=Cypress.config("downloadsFolder");
278+
cy.readFile(path.join(downloadsFolder,'add1.png')).should('exist');
268279
//Delete form after test run
269280
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
270281
cy.waitForLoad();
271282
cy.waitForLoad();
272283
cy.get('.mdi-delete').click();
273284
cy.get('[data-test="continue-btn-continue"]').click();
274-
275285
})
286+
});
276287

277288
});
278289
});

tests/functional/cypress/e2e/form-design-export-import-design.cy.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ describe('Form Designer', () => {
7575
cy.get('.mdi-dots-vertical').click();
7676
//Preview button disabled before form saving
7777
cy.get('[data-cy="previewRouterLink"] > .v-btn').should('have.attr', 'disabled');
78+
cy.get('[data-cy="previewRouterLink"] > .v-btn').trigger('mouseover', { force: true });
79+
cy.get('.v-overlay__content').contains('Save a version of the form to preview').should('exist');
80+
cy.get('[data-cy="publishRouterLink"] > .v-btn').trigger('mouseover', { force: true });
81+
cy.get('.v-overlay__content').contains('Insufficient permissions to publish form').should('exist');
7882
cy.get('[data-cy="undoButton"] > .v-btn').should('not.have.attr', 'disabled');
7983
cy.get('[data-cy="redoButton"] > .v-btn').should('have.attr', 'disabled');
8084
cy.get('.mdi-undo').click();
@@ -92,6 +96,7 @@ describe('Form Designer', () => {
9296
cy.get('.mdi-dots-vertical').click();
9397
//Preview button enabled
9498
cy.get('[data-cy="previewRouterLink"] > .v-btn').should('not.have.attr', 'disabled');
99+
cy.get('.v-overlay__content').contains('Click to Preview Form').should('exist');
95100
// Filter the newly created form
96101
cy.location('search').then(search => {
97102
let arr = search.split('=');

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

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,31 +26,25 @@ describe('Form Designer', () => {
2626
formsettings();
2727
cy.checkA11yPage();
2828
});
29-
// Publish a simple form
30-
it('Verify draft submission', () => {
31-
cy.viewport(1000, 1100);
32-
cy.waitForLoad();
29+
it('Getting page', () => {
3330

31+
cy.viewport(1000, 1100);
32+
cy.get('div.builder-components.drag-container.formio-builder-form', { timeout: 30000 }).should('be.visible');
3433
cy.get('button').contains('Basic Fields').click();
34+
});
35+
// Publish a simple form
36+
it('Verify draft submission', () => {
37+
cy.viewport(1000, 1100);
38+
cy.wait(2000);
3539
cy.get('div.formio-builder-form').then($el => {
3640
const coords = $el[0].getBoundingClientRect();
3741
cy.get('span.btn').contains('Text Field')
3842

3943
.trigger('mousedown', { which: 1}, { force: true })
40-
.trigger('mousemove', coords.x, -1, { force: true })
44+
.trigger('mousemove', coords.x, -150, { force: true })
4145
.trigger('mouseup', { force: true });
4246
cy.get('.btn-success').click();
4347
});
44-
//Multiline Text
45-
cy.get('div.formio-builder-form').then($el => {
46-
const coords = $el[0].getBoundingClientRect();
47-
cy.get('span.btn').contains('Multi-line Text')
48-
49-
.trigger('mousedown', { which: 1}, { force: true })
50-
.trigger('mousemove', coords.x, +1, { force: true })
51-
.trigger('mouseup', { force: true });
52-
cy.get('.btn-success').click();
53-
});
5448

5549
// Form saving
5650
let savedButton = cy.get('[data-cy=saveButton]');

tests/functional/cypress/e2e/form-edit-submission-data.cy.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,26 @@ describe("Form Designer", () => {
2323
formsettings();
2424
cy.checkA11yPage();
2525
});
26-
it("Add some fields for submission", () => {
27-
cy.viewport(1000, 1800);
28-
cy.waitForLoad();
29-
cy.get("button").contains("Basic Fields").click();
30-
cy.get("div.formio-builder-form").then(($el) => {
26+
it('Getting page', () => {
27+
28+
cy.viewport(1000, 1100);
29+
cy.get('div.builder-components.drag-container.formio-builder-form', { timeout: 30000 }).should('be.visible');
30+
cy.get('button').contains('Basic Fields').click();
31+
});
32+
// Publish a simple form
33+
it('Verify draft submission', () => {
34+
cy.viewport(1000, 1100);
35+
cy.wait(2000);
36+
cy.get('div.formio-builder-form').then($el => {
3137
const coords = $el[0].getBoundingClientRect();
3238
cy.get('span.btn').contains('Text Field')
3339

3440
.trigger('mousedown', { which: 1}, { force: true })
35-
.trigger('mousemove', coords.x, -1, { force: true })
41+
.trigger('mousemove', coords.x, -150, { force: true })
3642
.trigger('mouseup', { force: true });
3743
cy.get('.btn-success').click();
3844
});
39-
//Multiline Text
40-
cy.get('div.formio-builder-form').then($el => {
41-
const coords = $el[0].getBoundingClientRect();
42-
cy.get('span.btn').contains('Multi-line Text')
43-
44-
.trigger('mousedown', { which: 1}, { force: true })
45-
.trigger('mousemove', coords.x, +1, { force: true })
46-
.trigger('mouseup', { force: true });
47-
cy.get('.btn-success').click();
48-
});
45+
4946
// Form saving
5047
});
5148
it("Form Submission and Updation", () => {
@@ -68,6 +65,16 @@ describe("Form Designer", () => {
6865
cy.get("span").contains("Publish Version 1");
6966
cy.contains("Continue").should("be.visible");
7067
cy.contains("Continue").trigger("click");
68+
//Share link verification
69+
let shareFormButton = cy.get('[data-cy=shareFormButton]');
70+
expect(shareFormButton).to.not.be.null;
71+
shareFormButton.trigger('click').then(()=>{
72+
let shareFormLinkButton=cy.get('.mx-2');
73+
expect(shareFormLinkButton).to.not.be.null;
74+
shareFormLinkButton.trigger('click');
75+
//Close form share window
76+
cy.get('.v-card-actions > .v-btn > .v-btn__content > span').click();
77+
});
7178
//Submit the form
7279
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
7380
cy.wait(2000);

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

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,8 @@ it('Verify draft submission', () => {
7474
cy.contains('Continue').should('be.visible');
7575
cy.contains('Continue').trigger('click');
7676
//Share link verification
77-
let shareFormButton = cy.get('[data-cy=shareFormButton]');
78-
expect(shareFormButton).to.not.be.null;
79-
shareFormButton.trigger('click').then(()=>{
80-
//let shareFormLinkButton = cy.get('[data-cy=shareFormLinkButtonss]');
81-
let shareFormLinkButton=cy.get('.mx-2');
82-
expect(shareFormLinkButton).to.not.be.null;
83-
shareFormLinkButton.trigger('click');
84-
cy.get('.mx-2 > .v-btn').click();
85-
})
86-
//Draft submission and verification
77+
cy.get('[data-cy=shareFormButton]').should('be.visible').click();
78+
//Draft submission and verification
8779
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
8880
cy.waitForLoad();
8981
cy.get('button').contains('Submit').should('be.visible');
@@ -164,10 +156,8 @@ it('Submission revise status Assignment', () => {
164156
cy.contains('REVISING').click();
165157
//cy.get('.v-selection-control > .v-label').click();
166158
cy.get('.v-chip__content').contains('chefs.testing@gov.bc.ca').should('be.visible');
167-
cy.get('input[type="text"]').then($el => {
168-
const text_btn=$el[2];
169-
cy.get(text_btn).type('ZX');
170-
});
159+
//Add a team member for revise status assignment
160+
cy.contains('.v-chip__content', 'chefs.testing@gov.bc.ca').closest('.v-field').find('input').click().type('ZX');
171161
//Verify validation message to add another member for revise status assignment
172162
cy.contains('No results found. Please add team members in the draft/submission manage page.').should('be.visible');
173163
cy.get('[data-test="showRecipientEmail"] > .v-input__control > .v-field > .v-field__append-inner > .mdi-menu-down').click();

0 commit comments

Comments
 (0)