Skip to content

Commit

Permalink
Changes with login page
Browse files Browse the repository at this point in the history
  • Loading branch information
nimya-aot committed Sep 24, 2024
1 parent 37141e5 commit 68eadf8
Show file tree
Hide file tree
Showing 3 changed files with 116 additions and 81 deletions.
195 changes: 115 additions & 80 deletions tests/functional/cypress/e2e/form-submission-public.cy.js
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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
Expand All @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/cypress/e2e/form-team-management.cy.js
Original file line number Diff line number Diff line change
@@ -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');

Expand Down
File renamed without changes.

0 comments on commit 68eadf8

Please sign in to comment.