From fe35d5dafb0a261345b2f268c5aa6f13bef7b79a Mon Sep 17 00:00:00 2001 From: Nimya John <78105113+nimya-aot@users.noreply.github.com> Date: Fri, 13 Dec 2024 09:28:24 -0800 Subject: [PATCH] test: FORMS-1346 Cypress test scripts for External API settings configuration (#1539) * #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 --------- Co-authored-by: jasonchung1871 <101672465+jasonchung1871@users.noreply.github.com> --- .../e2e/form-edit-submission-data.cy.js | 4 +- .../cypress/e2e/form-manage-form.cy.js | 64 ++++++++++++++++++- 2 files changed, 64 insertions(+), 4 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 98ef09ac7..e39e2e7ba 100644 --- a/tests/functional/cypress/e2e/form-edit-submission-data.cy.js +++ b/tests/functional/cypress/e2e/form-edit-submission-data.cy.js @@ -108,8 +108,8 @@ describe('Form Designer', () => { cy.waitForLoad(); cy.waitForLoad(); - //cy.get('.mdi-list-box-outline').click(); - cy.get('[data-test="canViewFormSubmissions"]').click({multiple:true,force:true}); + 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/e2e/form-manage-form.cy.js b/tests/functional/cypress/e2e/form-manage-form.cy.js index 8b9ad06b9..7d002146d 100644 --- a/tests/functional/cypress/e2e/form-manage-form.cy.js +++ b/tests/functional/cypress/e2e/form-manage-form.cy.js @@ -197,10 +197,70 @@ describe('Form Designer', () => { cy.get('.v-col > .v-btn > .v-btn__content > span').click(); // Verify form settings updation success message cy.get('.v-alert__content').contains('div','Subscription settings for this form has been saved.').should('be.visible'); + }) + it('Checks External API settings', () => { + cy.viewport(1000, 1100); + cy.waitForLoad(); + cy.get(':nth-child(5) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click(); + cy.get('.mt-6 > :nth-child(2) > .mdi-help-circle-outline').should('exist'); + cy.get('.mdi-plus-circle').click({ force: true }); + cy.wait(2000); + cy.get('input[type="text"]').then($el => { + cy.get('.mdi-plus-circle').click(); - //Delete form after test run - cy.get('.mdi-delete').click(); + const api_name=$el[12]; + const api_endpoint=$el[13]; + const api_header=$el[14]; + const api_keyvalue=$el[15]; + cy.get(api_name).click(); + cy.get(api_endpoint).click(); + + cy.wait(2000); + cy.get(api_header).click(); + cy.contains('div','Name is required.').should('be.visible'); + cy.get('.v-messages__message').contains('div','Please enter a valid endpoint starting with http:// or https://').should('be.visible'); + + cy.get(api_name).type('chefs_name'); + cy.get(api_endpoint).type('chefs_endpoint'); + cy.contains('div','Name is required.').should('not.exist'); + cy.get('.v-messages__message').contains('div','Please enter a valid endpoint starting with http:// or https://').should('be.visible'); + cy.get(api_endpoint).type('{selectall}{backspace}'); + cy.get(api_endpoint).type('https://chefs-dev.apps.silver.devops.gov.bc.ca/'); + cy.get(api_header).type('header'); + cy.get(api_keyvalue).type('keyvalue'); + }); + cy.get('input[type="checkbox"]').then($el => { + const user_apikey=$el[14]; + const user_info=$el[15]; + cy.get(user_info).click(); + cy.get(user_apikey).click(); + cy.get('[data-test="continue-btn-continue"]').should('be.enabled'); + cy.get('[data-test="continue-btn-cancel"]').should('be.enabled'); + cy.get('[data-test="continue-btn-continue"]').click(); + }) + + cy.get('.v-data-table__tbody > .v-data-table__tr > :nth-child(3)').contains('Submitted'); + cy.get(':nth-child(1) > .v-btn > .v-btn__content > .mdi-pencil').click(); + cy.get('span').contains('Submitted').should('exist'); cy.get('[data-test="continue-btn-continue"]').click(); + cy.get('.v-data-table__tbody > .v-data-table__tr > :nth-child(1)').should('have.text',"chefs_name"); + //Delete external api configuration + cy.get('.v-data-table__tbody > .v-data-table__tr > .v-data-table-column--align-end > :nth-child(2) > [targetref="[object Object]"] > .v-btn').click(); + cy.wait(2000); + cy.get('.v-data-table__tbody > .v-data-table__tr > :nth-child(1)').should('not.exist'); + //Delete form after test run + cy.get('[data-test="canRemoveForm"]').then($el => { + const delform=$el[0]; + cy.get(delform).click(); + }) + cy.get('[data-test="continue-btn-continue"] > .v-btn__content > span').then($el => { + const delcontinue=$el[1]; + cy.get(delcontinue).click(); cy.get('#logoutButton > .v-btn__content > span').click(); + + + + }) + }) }) \ No newline at end of file