From 8e9f053993cae94e8e67e45627f260bf8d498000 Mon Sep 17 00:00:00 2001 From: Nimya John <78105113+nimya-aot@users.noreply.github.com> Date: Thu, 2 Jan 2025 12:20:53 -0800 Subject: [PATCH] test: FORMS-1621 Cypress test scripts for display tab for Map component (#1552) * #FORMS-974 * #974 updates * #980 modification to cypress config * FORMS-980 * #992 * #992 Fix cypress scripts * #1011 Form design page * #1011 test scripts * #1023 cypress scripts * #1023 advanced data components * #1023 Updated scripts * #1023 updation * Updated json file * Test/forms (#1011)(#1023) (#1307) * #FORMS-974 * #974 updates * #980 modification to cypress config * FORMS-980 * #992 * #992 Fix cypress scripts * #1011 Form design page * #1011 test scripts * #1023 cypress scripts * #1023 advanced data components * #1023 Updated scripts * #1023 updation * Updated json file * #1059 workflow file for cypress * #1059 updated the base url * #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 * #1059 updated package * #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 * #1488 public form submission * #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 * #1478/Draft submission * Scripts for draft submission * #1478 Added column management functionality and delete button * Fixed some CI/Cd issues * #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 * #1547 test scripts for export/imprt design * #1547 added preview form * Added downloads folder to config file * Added downloads folder * Fixed spacing issue * Removed downloaded files * Modified download folder path * Fixed some fornmatting issue * Updated component check * #1578 updated scripts * #1578 Added email notification * #1528 Scripts for email management * #1528 Fixed some running issues * Fixed running issues * Modified form-team-managememnt.cy.js file name * Fixed issue with export button click * #1346 Test scripts for API export functionality validation * #1346 Added External API existence checks * #1619 Added scripts for validatimg Meta form section * #1619 Added help link validations on form settings page * #1621 Test scripts for Map component display tab * #Added preview button validation along with this script * #1621 Added validations for custom css class * Fixed running issues * Fixed running issues with adding team member on PR env * Update form-design-map.cy.js --------- Co-authored-by: jasonchung1871 <101672465+jasonchung1871@users.noreply.github.com> --- .../form-design-export-import-design.cy.js | 3 +- .../cypress/e2e/form-design-map.cy.js | 122 ++++++++++++++++++ .../form-draft-submission-management.cy.js | 16 --- .../e2e/form-edit-submission-data.cy.js | 7 +- ...m-submission-public-no-status-assign.cy.js | 23 ---- 5 files changed, 128 insertions(+), 43 deletions(-) create mode 100644 tests/functional/cypress/e2e/form-design-map.cy.js 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