diff --git a/cypress/e2e/models/migration/applicationinventory/assessment.ts b/cypress/e2e/models/migration/applicationinventory/assessment.ts index c0963fbd9..b0db3462c 100644 --- a/cypress/e2e/models/migration/applicationinventory/assessment.ts +++ b/cypress/e2e/models/migration/applicationinventory/assessment.ts @@ -192,6 +192,30 @@ export class Assessment extends Application { super.edit(updatedValues); } + clickAssessButton() { + Application.open(); + this.selectApplication(); + clickItemInKebabMenu(this.name, "Assess"); + } + + retake_questionnaire( + risk, + stakeholders?: Array, + stakeholderGroups?: Array + ): void { + let applicationOpen: boolean; + this.clickAssessButton(); + cy.wait(SEC); + clickByText(button, "Retake"); + // This check can't be done from the test because the alert message is displayed for a short time + // and we are in the midddle of answering a questionnaire at this point. + checkSuccessAlert( + commonView.alertTitle, + `Success alert:Success! Assessment discarded for ${this.name}.` + ); + this.perform_assessment(risk, stakeholders, stakeholderGroups, (applicationOpen = false)); + } + take_questionnaire(): void { clickByText(button, "Take"); } @@ -199,7 +223,8 @@ export class Assessment extends Application { perform_assessment( risk, stakeholders?: Array, - stakeholderGroups?: Array + stakeholderGroups?: Array, + applicationOpen = true ): void { if (stakeholders == undefined && stakeholderGroups == undefined) { expect( @@ -207,13 +232,13 @@ export class Assessment extends Application { "At least one arg out of stakeholder or stakeholder groups must be provided !" ).to.equal(true); } else { - Application.open(); - selectItemsPerPage(100); - this.selectApplication(); - clickItemInKebabMenu(this.name, "Assess"); - cy.wait(6000); - this.take_questionnaire(); - cy.wait(SEC); + // These steps are not required for a questionnaire retake. + if (applicationOpen) { + this.clickAssessButton(); + cy.wait(SEC); + this.take_questionnaire(); + cy.wait(SEC); + } if (stakeholders) this.selectStakeholders(stakeholders); if (stakeholderGroups) this.selectStakeholderGroups(stakeholderGroups); clickJs(commonView.nextButton); diff --git a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts index 8f88204ab..fffab84ac 100644 --- a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts @@ -20,6 +20,7 @@ import { createMultipleApplications, deleteByList, checkSuccessAlert, + selectItemsPerPage, } from "../../../../../utils/utils"; import * as data from "../../../../../utils/data_utils"; @@ -27,11 +28,13 @@ import { Stakeholders } from "../../../../models/migration/controls/stakeholders import { Assessment } from "../../../../models/migration/applicationinventory/assessment"; import { AssessmentQuestionnaire } from "../../../../models/administration/assessment_questionnaire/assessment_questionnaire"; import { alertTitle } from "../../../../views/common.view"; +import { Application } from "../../../../models/migration/applicationinventory/application"; const fileName = "Legacy Pathfinder"; let stakeholderList: Array = []; let stakeholderNameList: Array = []; let applicationList: Array = []; +let applicationOpen: boolean; describe(["@tier3"], "Tests related to application assessment and review", () => { before("Perform application assessment and review", function () { @@ -55,6 +58,11 @@ describe(["@tier3"], "Tests related to application assessment and review", () => applicationList[0].verifyStatus("review", "Completed"); }); + it("Retake Assessment questionnaire", function () { + applicationList[0].retake_questionnaire("low", stakeholderNameList); + applicationList[0].verifyStatus("assessment", "Completed"); + }); + it("Discard Assessment", function () { applicationList[0].selectKebabMenuItem("Discard assessment(s)"); checkSuccessAlert(