Skip to content

Commit

Permalink
test: FORMS-1540 Cypress test scripts for revising status with adding…
Browse files Browse the repository at this point in the history
… recipients emails (bcgov#1526)

* #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

* Adding statuses to submission

* Fixed alert message for subscription settings

* Fixing CI/CD running issues

* Fixed issues on schedule date verification

* bcgov#1488 public form submission

* bcgov#1488 form for public

* form settings page for public form

* Added scripts for public forms with no status assign ability

* Changes with login page

* Removed additional login page

* bcgov#1478/Draft submission

* Scripts for draft submission

* bcgov#1478 Added column management functionality and delete button

* Fixed some CI/Cd issues

* bcgov#1478 Renamed public form

* Removed duplicate files

* # Fixed issues after implimenting custom metadata

* Updated settings button

* #1540 Test scripts for revise status changes

* Modified scripts

* Fixed CI/Cd issue

---------

Co-authored-by: jasonchung1871 <[email protected]>
  • Loading branch information
nimya-aot and jasonchung1871 authored Nov 1, 2024
1 parent de7389e commit a5eb1e8
Show file tree
Hide file tree
Showing 2 changed files with 193 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ it('Verify draft submission', () => {
cy.get('.v-card-actions > .v-btn > .v-btn__content > span').click();
cy.waitForLoad();
// Edit draft submission
cy.wait(4000);
cy.get('.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span').click();
cy.get('.mdi-pencil').click();
cy.waitForLoad();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
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();


});
// Publish a simple form
it('Verify draft submission', () => {
cy.viewport(1000, 1100);
cy.waitForLoad();

cy.get('button').contains('Basic Fields').click();
cy.get('div.formio-builder-form').then($el => {
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();
});
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.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');
//Share link verification
let shareFormButton = cy.get('[data-cy=shareFormButton]');
expect(shareFormButton).to.not.be.null;
shareFormButton.trigger('click').then(()=>{
//let shareFormLinkButton = cy.get('[data-cy=shareFormLinkButtonss]');
let shareFormLinkButton=cy.get('.mx-2');
expect(shareFormLinkButton).to.not.be.null;
shareFormLinkButton.trigger('click');
cy.get('.mx-2 > .v-btn').click();
})
//Draft submission and verification
cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`);
cy.waitForLoad();
cy.get('button').contains('Submit').should('be.visible');
cy.waitForLoad();
cy.waitForLoad();
cy.contains('Text Field').click();
cy.contains('Text Field').type('Alex');
cy.get('.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span').click();
cy.get('div > .bg-primary').click();
cy.get('.v-data-table__tr > :nth-child(4)').contains('DRAFT');
});

});
it('Submission revise status Assignment', () => {
cy.viewport(1000, 1100);
cy.wait(4000);
cy.location('search').then(search => {
//let pathName = fullUrl.pathname
let arr = search.split('=');
let arrayValues = arr[1].split('&');
cy.log(arrayValues[0]);
//Manage members for draft management
cy.get('.mdi-pencil').click();
cy.get('.mdi-content-save').click();
cy.get('.v-alert__content > div').contains('Draft Saved');
cy.get(':nth-child(2) > :nth-child(4) > :nth-child(1) > .v-btn').click();
cy.get('form > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click();
cy.get('form > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').type('NIM');
cy.contains('John, Nimya 1 CITZ:EX ([email protected])').click();
cy.get('.v-col-3').click();
cy.get('tbody > :nth-child(2) > :nth-child(1)').contains('John, Nimya 1 CITZ:EX').should('be.visible');
cy.get(':nth-child(1) > :nth-child(4) > .v-btn > .v-btn__content > .mdi-minus').should('not.be.enabled');
cy.wait(4000);

cy.get('.v-card-actions > .v-btn > .v-btn__content > span').click();
cy.waitForLoad();
// Edit draft submission
cy.get('.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span').click();
cy.get('.mdi-pencil').click();
cy.waitForLoad();

//Form submission
cy.contains('Text Field').click();
cy.contains('Text Field').type('{selectall}{backspace}');
cy.contains('Text Field').type('Nancy');
cy.get('button').contains('Submit').click();
cy.waitForLoad();
cy.get('[data-test="continue-btn-continue"]').click({force: true});
cy.waitForLoad();
cy.location('pathname').should('eq', `/${depEnv}/form/success`);
cy.contains('h1', 'Your form has been submitted successfully');
cy.get('.mt-6 > :nth-child(1) > .v-btn > .v-btn__content > span').click();

//Assign status submission

cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`);
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();
cy.get('.status-heading > .mdi-chevron-right').click();
cy.get('[data-test="showStatusList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').click();
cy.contains('ASSIGNED').click();
cy.get('[data-test="canAssignToMe"] > .v-btn__content > span').should('be.visible');
cy.get('[data-test="showAssigneeList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').click();
cy.get('[data-test="showAssigneeList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').type('ch');
cy.get('div').contains('CHEFS Testing').click();
cy.get('[data-test="updateStatusToNew"] > .v-btn__content > span').click();
cy.wait(4000);
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-chip__content').contains('[email protected]').should('be.visible');
cy.get('[data-test="showRecipientEmail"] > .v-input__control > .v-field > .v-field__append-inner > .mdi-menu-down').click();
cy.contains('John, Nimya 1 CITZ:EX ([email protected])').should('be.visible');
cy.get('label').contains('Notify all submitters').should('be.visible');
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.wait(4000);

//Verify Edit submission button is disabled
cy.get('button[title="Edit This Submission"]').should('be.disabled');

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


});


});

0 comments on commit a5eb1e8

Please sign in to comment.