Skip to content

Commit

Permalink
bcgov#1371 Updated the scripts according to the changes with revising…
Browse files Browse the repository at this point in the history
… status
  • Loading branch information
nimya-aot committed Sep 19, 2024
1 parent 6916d01 commit 020332e
Showing 1 changed file with 29 additions and 48 deletions.
77 changes: 29 additions & 48 deletions tests/functional/cypress/e2e/form-submission-assign-status.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,38 +35,16 @@ describe('Form Designer', () => {
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();
});
}
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();
});


const coords = $el[0].getBoundingClientRect();
cy.get('span.btn').contains('Text Field')

.trigger('mousedown', { which: 1}, { force: true })
.trigger('mousemove', coords.x, -50, { force: true })
.trigger('mouseup', { force: true });
cy.get('button').contains('Save').click();
});

});

it('Form Submission and Updation', () => {
Expand Down Expand Up @@ -115,23 +93,22 @@ describe('Form Designer', () => {
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.contains('Text Field').click();
cy.contains('Text Field').type('Alex');
//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.get('label').contains('Text Field').should('be.visible');
cy.get('label').contains('Text Field').should('be.visible');
cy.location('pathname').should('eq', `/${depEnv}/form/success`);
cy.contains('h1', 'Your form has been submitted successfully');
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
Expand All @@ -143,17 +120,19 @@ describe('Form Designer', () => {
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.contains('Text Field').click();
cy.contains('Text Field').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');
//cy.get('[data-test="continue-btn-continue"]').click();
cy.get('label').contains('Text Field').should('be.visible');
//cy.get('label').contains('Applying for self').should('be.visible');
cy.location('pathname').should('eq', `/${depEnv}/form/success`);

cy.contains('h1', 'Your form has been submitted successfully');
cy.waitForLoad();
cy.waitForLoad();
cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.waitForLoad();
Expand Down Expand Up @@ -194,9 +173,11 @@ describe('Form Designer', () => {
//cy.get('[data-test="showStatusList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').click();
cy.get('[data-test="showStatusList"] > .v-input__control > .v-field > .v-field__append-inner > .mdi-menu-down').click();
cy.contains('REVISING').click();
cy.get('.v-selection-control > .v-label').click();
//cy.get('.v-selection-control > .v-label').click();
cy.get('[data-test="canAttachCommentToEmail"] > .v-input__control > .v-selection-control > .v-label').click();
cy.get('textarea[rows="1"]').type('some comments');
cy.get('button').contains('REVISE').click();
cy.get(':nth-child(1) > .v-checkbox > .v-input__control > .v-selection-control > .v-label').click();
cy.waitForLoad();
cy.waitForLoad();
//Verify Edit submission button is disabled
Expand Down

0 comments on commit 020332e

Please sign in to comment.