Skip to content

Commit

Permalink
Test/forms 1313 (bcgov#1428)
Browse files Browse the repository at this point in the history
* #FORMS-974

* bcgov#974 updates

* bcgov#980 modification to cypress config

* FORMS-980

* bcgov#992

* bcgov#992 Fix cypress scripts

* bcgov#1011 Form design page

* bcgov#1011 test scripts

* bcgov#1023 cypress scripts

* bcgov#1023 advanced data components

* bcgov#1023 Updated scripts

* bcgov#1023 updation

* Updated json file

* Test/forms (bcgov#1011)(bcgov#1023) (bcgov#1307)

* #FORMS-974

* bcgov#974 updates

* bcgov#980 modification to cypress config

* FORMS-980

* bcgov#992

* bcgov#992 Fix cypress scripts

* bcgov#1011 Form design page

* bcgov#1011 test scripts

* bcgov#1023 cypress scripts

* bcgov#1023 advanced data components

* bcgov#1023 Updated scripts

* bcgov#1023 updation

* Updated json file

* bcgov#1059 workflow file for cypress

* bcgov#1059 updated the base url

* bcgov#1059 updated workflow

* Updated node version

* updated

* updated

* Updation

* updated file

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* updated package file

* Update cypress-ci.yaml

* Updated config file

* Update cypress-ci.yaml

* bcgov#1059 updated package

* bcgov#1060 scripts for Advanced fields and BC Gov components

* Fixing review comments

* Updated changes

* # Updated with PR comments

* updated

* Update form-design-basicfields.cy.js

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Modifies test scripts

* Updated files

* Fixed errors during CI/CD Run

* Updated browser type

* Updated Simple BC address component

* Updated

* Fields updated

* Test script changed

* Updated

* Updated fields

* Updated env variable

* Update form-design-basicfields.cy.js

* Updated

* Update cypress-ci.yaml

* Updated email input

* screenshots

* Updated path

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Updated version on workflow

* Fix to failed tests

* Fix to BC address component

* Updated the  component

* Changed button element

* Fixed BC components

* Modified submission

* Modified components

* Updated attribute

* Updated

* Changed simpleBC address component

* Update package.json

* Update package-lock.json

* Test scripts

* Updated

* Pushed the changes

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Env change

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Update cypress-ci.yaml

* Updated

* Updated to take default env variable

* Updated with current workflow

* updated

* Formatted

* Update cypress.config.js

* updated

* Test scripts for updating submission data

* Scripts for adding notes

* Added scripts for logout after each run

---------

Co-authored-by: jasonchung1871 <101672465+jasonchung1871@users.noreply.github.com>
Co-authored-by: Vijaivir Dhaliwal <91633223+vijaivir@users.noreply.github.com>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent ede7f95 commit 5b398c6
Show file tree
Hide file tree
Showing 9 changed files with 229 additions and 7 deletions.
3 changes: 3 additions & 0 deletions tests/functional/cypress/e2e/form-apikey-cdogs.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,9 @@ describe('Form Designer', () => {

cy.get('[data-test="canRemoveForm"]').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.waitForLoad();
cy.waitForLoad();
cy.get('#logoutButton > .v-btn__content > span').click();

})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ it('Checks the Container component', () => {
//cy.get('.mdi-delete').click();
cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();

})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ describe('Form Designer', () => {
cy.waitForLoad();
cy.get('.mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();

})

Expand Down
17 changes: 10 additions & 7 deletions tests/functional/cypress/e2e/form-design-basicfields.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,14 +243,15 @@ describe('Form Designer', () => {

cy.get('button').contains('Save').click();
});
cy.get('[ref=removeComponent]').then($el => {
//cy.get('[ref=removeComponent]').then($el => {

const rem=$el[11];
rem.click();
// const rem=$el[11];
//rem.click();

});

//});

cy.waitForLoad();
cy.waitForLoad();
cy.get('[data-cy=saveButton]').click();
cy.waitForLoad();

Expand Down Expand Up @@ -288,9 +289,11 @@ describe('Form Designer', () => {
cy.visit(`/${depEnv}/form/design?d=${arrayValues[0]}&f=${dval[0]}`);
cy.waitForLoad();
cy.waitForLoad();
//cy.get('[data-cy="settingsRouterLink"] > .text').click();

cy.get('[data-cy="settingsRouterLink"] > .v-btn').click();
cy.get('.mt-6 > :nth-child(2) > div > :nth-child(5) > .v-btn').click();
cy.waitForLoad();
cy.get('[data-test="canRemoveForm"]').click();

cy.get('[data-test="continue-btn-continue"]').click();

});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ it('Checks the Table', () => {
//cy.get('.mdi-delete').click();
cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();

})

Expand Down
210 changes: 210 additions & 0 deletions tests/functional/cypress/e2e/form-edit-submission-data.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,210 @@
import 'cypress-keycloak-commands';
import 'cypress-drag-drop';
import { formsettings } from '../support/login.js';

const depEnv = Cypress.env('depEnv');


Cypress.Commands.add('waitForLoad', () => {
const loaderTimeout = 60000;

cy.get('.nprogress-busy', { timeout: loaderTimeout }).should('not.exist');
});
describe('Form Designer', () => {

beforeEach(()=>{


cy.on('uncaught:exception', (err, runnable) => {
// Form.io throws an uncaught exception for missing projectid
// Cypress catches it as undefined: undefined so we can't get the text
console.log(err);
return false;
});
});
it('Visits the form settings page', () => {


cy.viewport(1000, 1100);
cy.waitForLoad();
formsettings();

});
it('Add some fields for submission', () => {

cy.viewport(1000, 1800);
cy.waitForLoad();
cy.get('button').contains('Basic Fields').click();
let textFields = ["First Name", "Middle Name", "Last Name"];

for(let i=0; i<textFields.length; i++) {
cy.get('button').contains('Basic Fields').click();
cy.get('div.formio-builder-form').then($el => {
const bounds = $el[0].getBoundingClientRect();
cy.get('span.btn').contains('Text Field')
.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', bounds.x, -100, { force: true })
.trigger('mouseup', { force: true });
cy.get('p').contains('Text Field Component');
cy.get('input[name="data[label]"]').clear();
cy.get('input[name="data[label]"]').clear();
cy.get('input[name="data[label]"]').type(textFields[i]);
cy.get('button').contains('Save').click();
});
}


});
it('Form Submission and Updation', () => {
cy.viewport(1000, 1100);
cy.waitForLoad();
cy.waitForLoad();
cy.get('div.formio-builder-form').then($el => {
const coords2 = $el[0].getBoundingClientRect();
cy.get('span.btn').contains('Checkbox')

.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', coords2.x, -50, { force: true })
.trigger('mouseup', { force: true });
cy.get('p').contains('Checkbox Component');
cy.get('input[name="data[label]"]').clear();
cy.get('input[name="data[label]"]').clear();
cy.get('input[name="data[label]"]').type('Applying for self');
cy.get('button').contains('Save').click();
});
cy.intercept('GET', `/${depEnv}/api/v1/forms/*`).as('getForm');
// Form saving
let savedButton = cy.get('[data-cy=saveButton]');
expect(savedButton).to.not.be.null;
savedButton.trigger('click');
cy.waitForLoad();



// Go to My forms
cy.wait('@getForm').then(()=>{
let userFormsLinks = cy.get('[data-cy=userFormsLinks]');
expect(userFormsLinks).to.not.be.null;
userFormsLinks.trigger('click');
});
// Filter the newly created form
cy.location('search').then(search => {
//let pathName = fullUrl.pathname
let arr = search.split('=');
let arrayValues = arr[1].split('&');
cy.log(arrayValues[0]);
//cy.log(arrayValues[1]);
//cy.log(arrayValues[2]);
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();


//Publish the form
cy.get('.v-label > span').click();

cy.get('span').contains('Publish Version 1');

cy.contains('Continue').should('be.visible');
cy.contains('Continue').trigger('click');
//Submit the form
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.waitForLoad();
cy.waitForLoad();
cy.get('button').contains('Submit').should('be.visible');
cy.waitForLoad();
cy.waitForLoad();
cy.get('input[name="data[simpletextfield1]"').click();
cy.get('input[name="data[simpletextfield1]"').type('Alex');
cy.get('input[name="data[simpletextfield2]"').click();
cy.get('input[name="data[simpletextfield2]"').type('Smith');
//cy.get('.form-check-input').click();
//form submission
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.waitForLoad();
cy.waitForLoad();
cy.get('label').contains('First Name').should('be.visible');
cy.get('label').contains('Last Name').should('be.visible');
cy.get('label').contains('Applying for self').should('be.visible');


//Update submission
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.waitForLoad();
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.waitForLoad();
cy.waitForLoad();
cy.get('button').contains('Submit').should('be.visible');
cy.get('input[name="data[simpletextfield1]"').click();
cy.get('input[name="data[simpletextfield1]"').type('Alex');
cy.get('input[name="data[simpletextfield2]"').click();
cy.get('input[name="data[simpletextfield2]"').type('Smith');
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.get('button').contains('Submit').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('label').contains('First Name').should('be.visible');
cy.get('label').contains('Last Name').should('be.visible');
cy.get('label').contains('Applying for self').should('be.visible')
//view submission
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.waitForLoad();

cy.get('.mdi-list-box-outline').click();
cy.waitForLoad();
cy.get(':nth-child(1) > :nth-child(6) > a > .v-btn > .v-btn__content > .mdi-eye').click();
//Edit submission
cy.get('.mdi-pencil').click();
//check visibility of cancel button
cy.get('.v-col-2 > .v-btn').should('be.visible');
cy.get('button').contains('Submit').should('be.visible');

//Edit submission data
cy.get('input[name="data[simpletextfield1]"').click();
cy.get('input[name="data[simpletextfield1]"').clear();
cy.get('input[name="data[simpletextfield1]"').type('Nancy');
cy.get('input[name="data[simpletextfield2]"').click();
cy.get('input[name="data[simpletextfield2]"').type('Smith');
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.get('[data-test="continue-btn-continue"]').click();
cy.waitForLoad();
cy.waitForLoad();
cy.get('label').contains('First Name').should('be.visible');
cy.get('label').contains('Last Name').should('be.visible');
//Adding notes to submission
cy.get('.mdi-plus').click();
cy.get('div').find('textarea').then($el => {

const rem=$el[0];
rem.click();
cy.get(rem).type('some notes');


});
cy.get('[data-test="canCancelNote"]').should('be.visible');
cy.get('[data-test="btn-add-note"]').click();
cy.get('.notes-text').contains('1');
//Delete form after test run
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.waitForLoad();
cy.get('.mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();


})


});

});
1 change: 1 addition & 0 deletions tests/functional/cypress/e2e/form-manage-form.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ describe('Form Designer', () => {
//Delete form after test run
cy.get('.mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ describe('Form Designer', () => {
//cy.get('.mdi-delete').click();
cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();


});
Expand Down
1 change: 1 addition & 0 deletions tests/functional/cypress/e2e/form-team-management.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ describe('Form Designer', () => {
//Delete form after test run
cy.get('.mdi-delete').click();
cy.get('[data-test="continue-btn-continue"]').click();
cy.get('#logoutButton > .v-btn__content > span').click();
})

});
Expand Down

0 comments on commit 5b398c6

Please sign in to comment.