From 6c3983c61744762e54feb6b72fb41a8fa51ae53b Mon Sep 17 00:00:00 2001 From: Nimya John <78105113+nimya-aot@users.noreply.github.com> Date: Tue, 17 Dec 2024 10:39:24 -0800 Subject: [PATCH] test: FORMS-1619 Cypress test scripts for adding Form Meta data section on form settings page (#1544) * #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 --------- Co-authored-by: jasonchung1871 <101672465+jasonchung1871@users.noreply.github.com> --- .../e2e/form-edit-submission-data.cy.js | 8 ++-- tests/functional/cypress/support/login.js | 43 +++++++++++++++---- 2 files changed, 38 insertions(+), 13 deletions(-) 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 e39e2e7ba..1849de1c0 100644 --- a/tests/functional/cypress/e2e/form-edit-submission-data.cy.js +++ b/tests/functional/cypress/e2e/form-edit-submission-data.cy.js @@ -105,11 +105,9 @@ describe('Form Designer', () => { //view submission cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); - cy.waitForLoad(); - cy.waitForLoad(); - - cy.get('.mdi-list-box-outline').click({multiple:true,force:true}); - //cy.get('[data-test="canViewFormSubmissions"]').click({multiple:true,force:true}); + 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.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/support/login.js b/tests/functional/cypress/support/login.js index 6bf2015fb..405a58ec5 100644 --- a/tests/functional/cypress/support/login.js +++ b/tests/functional/cypress/support/login.js @@ -13,12 +13,10 @@ export function formsettings(){ else { - - cy.visit(`/${depEnv}`); } - + cy.get('#logoutButton > .v-btn__content > span').should('not.exist'); cy.get('[data-test="base-auth-btn"] > .v-btn > .v-btn__content > span').click(); cy.get('[data-test="idir"]').click(); @@ -36,8 +34,6 @@ export function formsettings(){ let title="title" + Math.random().toString(16).slice(2); - - cy.get('[data-test="text-name"]').type(title); cy.get('[data-test="text-description"]').type('test description'); @@ -51,19 +47,49 @@ export function formsettings(){ cy.get(':nth-child(2) > .v-card > .v-card-text > .v-input--error > :nth-child(2)').contains('Please select 1 log-in type'); cy.get('input[value="team"]').click(); + cy.get('.v-label > .mdi-help-circle-outline').click(); + cy.contains('Add team members from the Team Management settings after creating this form.').should('be.visible'); + cy.get('.v-label > div > .mdi-help-circle-outline').then($el => { + const email_notify=$el[1]; + cy.get(email_notify).click({force: true}); + cy.contains('Send a notification to your specified email address when any user submits this form').should('be.visible'); + }); cy.get('[data-test="canSaveAndEditDraftsCheckbox"]').click(); cy.get(':nth-child(3) > .v-card > .v-card-text > :nth-child(2) > .v-input__control > .v-selection-control > .v-label > span').click();//Update the status of the form - //cy.get(':nth-child(3) > .v-input__control > .v-selection-control > .v-label > div > .mdi-flask').should('be.enabled');//Multiple draft upload cy.get(':nth-child(5) > .v-input__control > .v-selection-control > .v-label > div > span > strong').click();//Copy existing submission cy.get(':nth-child(7) > .v-input__control > .v-selection-control > .v-label > div').click();//Wide form Layout - + cy.get('[data-test="email-test"] > .v-input__control > .v-selection-control > .v-label > div > span').click({force: true}); cy.get('[data-test="email-test"] > .v-input__control > .v-selection-control > .v-label > div > span').click(); cy.get(':nth-child(4) > .v-card > .v-card-text > .v-text-field > .v-input__control > .v-field > .v-field__field > .v-field__input').type('abc@gmail.com'); + cy.get('.mb-6 > .mdi-help-circle-outline').should('exist'); + cy.get('a.preview_info_link_field_white').then($el => { + const drftupload=$el[0]; + const copy_sub=$el[1]; + const wide_layput=$el[3]; + const metadata=$el[4]; + cy.get(drftupload).should("have.attr", "href", "https://developer.gov.bc.ca/docs/default/component/chefs-techdocs/Capabilities/Functionalities/Allow-multiple-draft-upload/"); + cy.get(copy_sub).should("have.attr", "href", "https://developer.gov.bc.ca/docs/default/component/chefs-techdocs/Capabilities/Functionalities/Copy-an-existing-submission/"); + cy.get(wide_layput).should("have.attr", "href", "https://developer.gov.bc.ca/docs/default/component/chefs-techdocs/Capabilities/Functionalities/Wide-Form-Layout"); + cy.get(metadata).should("have.attr", "href", "https://developer.gov.bc.ca/docs/default/component/chefs-techdocs/Capabilities/Integrations/Form-Metadata/"); + }); + //Validate Form Meta Data section + cy.get('textarea').then($el => { + + const metadata=$el[1]; + cy.get(metadata).click({force: true}); + cy.get('[data-test="json-test"]').type('{selectall}{backspace}'); + cy.get('.v-messages__message').contains('Form metadata must be valid JSON. Use double-quotes around attributes and values.').should('exist'); + cy.get('[data-test="json-test"]').type('{}'); + + + }); cy.get('.v-row > :nth-child(1) > .v-input > .v-input__control > .v-field > .v-field__append-inner').click(); cy.contains("Citizens' Services (CITZ)").click(); - + cy.get('.mb-4 > .mdi-help-circle-outline').click(); + cy.contains('If you do not see your specific use case, contact the CHEFS team to discuss further options').should('be.visible'); + cy.get('[data-test="case-select"]').click(); cy.get('.v-list').should('contain','Applications that will be evaluated followed'); cy.get('.v-list').should('contain','Collection of Datasets, data submission'); @@ -77,6 +103,7 @@ export function formsettings(){ cy.get('[data-test="api-true"] > .v-label > span').click(); cy.get('.mt-3 > .mdi-help-circle-outline').should('be.visible'); cy.get('.mt-3 > .mdi-help-circle-outline').click(); + cy.contains('Labels serve as a means to categorize similar forms that may belong to a common organization or share a related context.').should('be.visible'); cy.get('.d-flex > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); cy.get('.d-flex > .v-input > .v-input__control > .v-field > .v-field__field > .v-field__input').type('test label'); cy.get(':nth-child(4) > .v-card-text > .v-input > .v-input__control > .v-selection-control > .v-label > span').click();