diff --git a/tests/functional/cypress/e2e/form-design-export-import-design.cy.js b/tests/functional/cypress/e2e/form-design-export-import-design.cy.js index 7a3e33276..1727ed38a 100644 --- a/tests/functional/cypress/e2e/form-design-export-import-design.cy.js +++ b/tests/functional/cypress/e2e/form-design-export-import-design.cy.js @@ -80,7 +80,7 @@ describe('Form Designer', () => { }); //Verify visibility of right side buttons on design page cy.get('[data-cy="saveButton"] > .v-btn').should('be.enabled'); - cy.get('[data-cy="previewRouterLink"] > .v-btn').should('be.enabled'); + //cy.get('[data-cy="previewRouterLink"] > .v-btn').should('be.enabled'); cy.get('[data-cy="undoButton"] > .v-btn').should('be.enabled'); cy.get('[data-cy="redoButton"] > .v-btn').should('not.be.enabled'); cy.get('.mdi-undo').click(); @@ -105,6 +105,7 @@ describe('Form Designer', () => { expect(savedButton).to.not.be.null; savedButton.trigger('click'); cy.wait(2000); + //cy.get('[data-cy="previewRouterLink"] > .v-btn').should('be.enabled'); // Filter the newly created form cy.location('search').then(search => { diff --git a/tests/functional/cypress/e2e/form-design-map.cy.js b/tests/functional/cypress/e2e/form-design-map.cy.js new file mode 100644 index 000000000..9e35c9930 --- /dev/null +++ b/tests/functional/cypress/e2e/form-design-map.cy.js @@ -0,0 +1,122 @@ +import 'cypress-keycloak-commands'; +import 'cypress-drag-drop'; +import { formsettings } from '../support/login.js'; +//import { should } from 'chai'; + +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(); + + + }); +// Checks Map component functionalities +it('Checks Map component', () => { + cy.viewport(1000, 1100); + cy.waitForLoad(); + + cy.get('button').contains('BC Government').click(); + cy.get('div.formio-builder-form').then($el => { + const coords = $el[0].getBoundingClientRect(); + cy.get('[data-type="map"]') + .trigger('mousedown', { which: 1}, { force: true }) + .trigger('mousemove', coords.x, -550, { force: true }) + .trigger('mouseup', { force: true }); + cy.waitForLoad(); + cy.get('input[name="data[label]"]').type('s'); + cy.get('textarea[name="data[description]"]').should("have.attr","placeholder","This will appear below the map"); + cy.get('textarea[name="data[description]"]').type('Map location above'); + cy.wait(2000); + cy.contains('Map location above').should('exist'); + cy.get('textarea[placeholder="Add a tooltip beside the label"]').type('Add your desired location'); + cy.wait(2000); + cy.get('i[ref="tooltip"]').should('exist'); + cy.get('label').contains('Maps').should('exist'); + cy.get('div[data-value="top"]').should('exist'); + cy.get('input[name="data[customClass]"').should('exist'); + + cy.waitForLoad(); + cy.get('button').contains('Save').click(); + + + }); + + // Form saving + let savedButton = cy.get('[data-cy=saveButton]'); + expect(savedButton).to.not.be.null; + savedButton.trigger('click'); + cy.wait(2000); + + + + + // 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(); + }) + cy.visit(`/${depEnv}`); + cy.get('[data-cy="userFormsLinks"]').click(); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + //Delete form after test run + //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(); + + + }); + + }); + +}); diff --git a/tests/functional/cypress/e2e/form-draft-submission-management.cy.js b/tests/functional/cypress/e2e/form-draft-submission-management.cy.js index 027c6626b..f4c13dd7d 100644 --- a/tests/functional/cypress/e2e/form-draft-submission-management.cy.js +++ b/tests/functional/cypress/e2e/form-draft-submission-management.cy.js @@ -121,22 +121,6 @@ it('Verify draft submission', () => { 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(); - //Manage members for draft management - 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 (nimya.1.john@gov.bc.ca)').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'); - //Remove added member - cy.get(':nth-child(2) > :nth-child(4) > .v-btn > .v-btn__content > .mdi-minus').click(); - cy.get('[data-test="continue-btn-continue"] > .v-btn__content > span').click(); - cy.get('tbody > :nth-child(2) > :nth-child(1)').should('not.exist'); - cy.wait(4000); - - 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(); diff --git a/tests/functional/cypress/e2e/form-edit-submission-data.cy.js b/tests/functional/cypress/e2e/form-edit-submission-data.cy.js index 1849de1c0..0ca2422d7 100644 --- a/tests/functional/cypress/e2e/form-edit-submission-data.cy.js +++ b/tests/functional/cypress/e2e/form-edit-submission-data.cy.js @@ -105,9 +105,10 @@ describe('Form Designer', () => { //view submission cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); - cy.wait(2000); - //cy.get('.mdi-list-box-outline').click({multiple:true,force:true}); - cy.get('[data-test="canViewFormSubmissions"]').click({multiple:true,force:true}); + cy.wait(4000); + cy.get('.mdi-list-box-outline').click(); + cy.wait(4000); + //cy.get('[data-test="canViewFormSubmissions"]').click({multiple:true,force:true}); cy.waitForLoad(); cy.get('.v-data-table__tr > :nth-child(2)').should('exist'); cy.get('input[type="checkbox"]').then($el => { diff --git a/tests/functional/cypress/e2e/form-submission-public-no-status-assign.cy.js b/tests/functional/cypress/e2e/form-submission-public-no-status-assign.cy.js index 6dfc27d6f..706b9deaa 100644 --- a/tests/functional/cypress/e2e/form-submission-public-no-status-assign.cy.js +++ b/tests/functional/cypress/e2e/form-submission-public-no-status-assign.cy.js @@ -112,30 +112,7 @@ describe('Form Designer', () => { cy.get(rem5).should("be.enabled"); }); cy.get('[data-test="canEditForm"]').click(); - //Check team management functionality for public forms - cy.get('.mdi-account-multiple').click(); - cy.get('.mdi-account-plus').click(); - //Search for a member to add - cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); - cy.get('.v-col > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').type('NIM'); - cy.get('.v-slide-group__content > :nth-child(1)').should('be.visible')//designer role - cy.get(':nth-child(2) > .v-chip__content').should('be.visible');//submitter role - cy.get(':nth-child(3) > .v-chip__content').should('be.visible');//owner role - cy.get(':nth-child(4) > .v-chip__content').should('be.visible');//approver role - cy.get(':nth-child(5) > .v-chip__content').should('be.visible');//reviewer role - cy.get(':nth-child(6) > .v-chip__content').should('be.visible');//team manager role - cy.contains('John, Nimya 1 CITZ:EX (nimya.1.john@gov.bc.ca)').click(); - cy.get(':nth-child(2) > .v-chip__content').click(); - cy.get(':nth-child(4) > .v-chip__content').click(); - cy.get(':nth-child(5) > .v-chip__content').click(); - cy.get('.v-btn--elevated > .v-btn__content > span').click(); - cy.get(':nth-child(10) > span').should('not.exist');// verify Submitter role is not present on table view - // Verify member is added with proper roles - cy.get('[data-test="ApproverRoleCheckbox"]').should('be.visible'); - cy.get('[data-test="ReviewerRoleCheckbox"]').should('exist'); - cy.get('[data-test="TeamManagerRoleCheckbox"]').should('be.visible'); - cy.get('[data-test="ApproverRoleCheckbox"]').click({multiple:true,force:true}); cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); cy.wait(2000); //Logout to submit the public form