From 68eadf8f2b0282e8859b1e8c9f7fa19f026b8178 Mon Sep 17 00:00:00 2001 From: nimya-aot Date: Tue, 24 Sep 2024 11:49:45 -0700 Subject: [PATCH] Changes with login page --- .../cypress/e2e/form-submission-public.cy.js | 195 +++++++++++------- .../cypress/e2e/form-team-management.cy.js | 2 +- .../{form-settings-IDIR-login.js => login.js} | 0 3 files changed, 116 insertions(+), 81 deletions(-) rename tests/functional/cypress/support/{form-settings-IDIR-login.js => login.js} (100%) diff --git a/tests/functional/cypress/e2e/form-submission-public.cy.js b/tests/functional/cypress/e2e/form-submission-public.cy.js index 5f3276f0a..cd02c769a 100644 --- a/tests/functional/cypress/e2e/form-submission-public.cy.js +++ b/tests/functional/cypress/e2e/form-submission-public.cy.js @@ -1,6 +1,6 @@ import 'cypress-keycloak-commands'; import 'cypress-drag-drop'; -import { formsettings } from '../support/form-settings-public-form.js'; +import { formsettings } from '../support/login.js'; const depEnv = Cypress.env('depEnv'); const username=Cypress.env('keycloakUsername'); @@ -88,103 +88,113 @@ describe('Form Designer', () => { 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(); + + 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(); - //Check team management functionality for public forms + cy.visit(`/${depEnv}`); + cy.get('[data-cy="userFormsLinks"]').click(); + cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); + cy.waitForLoad(); + cy.get(':nth-child(1) > .v-expansion-panel > .v-expansion-panel-title > .v-expansion-panel-title__overlay').click(); + cy.get('[lang="en"] > .v-btn > .v-btn__content > .mdi-pencil').click(); + cy.get('input[value="public"]').click(); + cy.waitForLoad(); + cy.get('input[type="checkbox"]').then($el => { + const rem=$el[0];//save and edit drafts + const rem2=$el[2];//multiple draft upload + const rem3=$el[3];//form submission schedule settings + const rem4=$el[4];//copy submission + const rem5=$el[5];//event subscription + cy.get(rem).should("not.be.enabled"); + cy.get(rem2).should("not.be.enabled"); + cy.get(rem3).should("be.enabled"); + cy.get(rem4).should("not.be.enabled"); + 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(); + 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 + 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('be.visible'); - 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.waitForLoad(); - cy.waitForLoad(); + cy.get('[data-test="ApproverRoleCheckbox"]').should('be.visible'); + cy.get('[data-test="ReviewerRoleCheckbox"]').should('be.visible'); + 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.waitForLoad(); + cy.waitForLoad(); //Logout to submit the public form - cy.get('#logoutButton > .v-btn__content > span').click(); - - - - //Form submission and verification for public forms - cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`); - cy.waitForLoad(); - cy.waitForLoad(); - 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('#logoutButton > .v-btn__content > span').click(); + //Form submission and verification for public forms + cy.visit(`/${depEnv}/form/submit?f=${arrayValues[0]}`); + cy.waitForLoad(); + cy.waitForLoad(); + 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'); //form submission - cy.get('button').contains('Submit').click(); - cy.waitForLoad(); + cy.get('button').contains('Submit').click(); + cy.waitForLoad(); //cy.get('[data-test="continue-btn-continue"]').click({force: true}); - cy.waitForLoad(); - cy.waitForLoad(); - cy.waitForLoad(); - cy.waitForLoad(); - cy.waitForLoad(); - cy.get('label').contains('Text Field').should('be.visible'); - cy.get('label').contains('Text Field').should('be.visible'); - cy.location('pathname').should('eq', `/${depEnv}/form/success`); + cy.waitForLoad(); + cy.waitForLoad(); + cy.waitForLoad(); + cy.waitForLoad(); + cy.waitForLoad(); + cy.get('label').contains('Text Field').should('be.visible'); + cy.get('label').contains('Text Field').should('be.visible'); + cy.location('pathname').should('eq', `/${depEnv}/form/success`); - cy.contains('h1', 'Your form has been submitted successfully'); - if(depEnv=="app") + cy.contains('h1', 'Your form has been submitted successfully'); + if(depEnv=="app") { cy.visit(`https://chefs-dev.apps.silver.devops.gov.bc.ca/app`); } - else + else { - - cy.visit(`/${depEnv}`); } - cy.get('[data-test="base-auth-btn"] > .v-btn > .v-btn__content > span').click(); - cy.get('[data-test="idir"]').click(); + cy.get('[data-test="base-auth-btn"] > .v-btn > .v-btn__content > span').click(); + cy.get('[data-test="idir"]').click(); - cy.get('#user').type(username); - cy.get('#password').type(password); - cy.get('.btn').click(); - cy.waitForLoad(); - cy.waitForLoad(); + cy.get('#user').type(username); + cy.get('#password').type(password); + cy.get('.btn').click(); + cy.waitForLoad(); + cy.waitForLoad(); //view submission - //cy.get('[data-cy="userFormsLinks"]').click(); - 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.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(); }); //Assign status submission @@ -204,14 +214,39 @@ describe('Form Designer', () => { cy.get('[data-test="showStatusList"] > .v-input__control > .v-field > .v-field__field > .v-field__input').click(); cy.contains('COMPLETED').click(); cy.get('button').contains('COMPLETE').click(); + //Adding notes to submission + cy.get('.mdi-plus').click(); + cy.get('div').find('textarea').then($el => { + + const rem=$el[0]; + rem.click(); + cy.get(rem).type('some notes'); + + + }); + //Verify submitted by label is public + cy.get('p').contains('public').should('be.visible'); + //Edit submission data for public form + cy.get('.mdi-pencil').click(); + //check visibility of cancel button + cy.get('.v-col-2 > .v-btn').should('be.visible'); + cy.get('button').contains('Submit').should('be.visible'); + cy.contains('Text Field').click(); + cy.contains('Text Field').type('Smith'); + cy.get('button').contains('Submit').click(); + cy.waitForLoad(); + cy.waitForLoad(); + cy.waitForLoad(); + //Verify Edit History Panel + cy.get('.mdi-history').click(); + cy.get('.v-data-table__tr> :nth-child(1)').contains('CHEFSTST@idir').should('be.visible'); + cy.get('span').contains('Close').click(); cy.get('.mdi-list-box-outline').click(); cy.waitForLoad(); cy.get('.mdi-cog').click(); //Delete form after test run - - //cy.visit(`/${depEnv}/form/manage?f=${arrayValues[0]}`); cy.waitForLoad(); cy.get(':nth-child(5) > .v-btn > .v-btn__content > .mdi-delete').click(); cy.get('[data-test="continue-btn-continue"]').click(); diff --git a/tests/functional/cypress/e2e/form-team-management.cy.js b/tests/functional/cypress/e2e/form-team-management.cy.js index deda9df86..8575e261b 100644 --- a/tests/functional/cypress/e2e/form-team-management.cy.js +++ b/tests/functional/cypress/e2e/form-team-management.cy.js @@ -1,6 +1,6 @@ import 'cypress-keycloak-commands'; import 'cypress-drag-drop'; -import { formsettings } from '../support/form-settings-IDIR-login.js'; +import { formsettings } from '../support/login.js'; const depEnv = Cypress.env('depEnv'); diff --git a/tests/functional/cypress/support/form-settings-IDIR-login.js b/tests/functional/cypress/support/login.js similarity index 100% rename from tests/functional/cypress/support/form-settings-IDIR-login.js rename to tests/functional/cypress/support/login.js