Skip to content

Commit

Permalink
[RFR] [NA] Retake assessment questionnaire (#817)
Browse files Browse the repository at this point in the history
* Retake assessment questionnaire

Signed-off-by: Nandini Chandra <nachandr@redhat.com>

* Format code

Signed-off-by: Nandini Chandra <nachandr@redhat.com>

* Update assessment.retake_questionnaire() method

Signed-off-by: Nandini Chandra <nachandr@redhat.com>

* Minor change

Signed-off-by: Nandini Chandra <nachandr@redhat.com>

* Minor change

Signed-off-by: Nandini Chandra <nachandr@redhat.com>

---------

Signed-off-by: Nandini Chandra <nachandr@redhat.com>
  • Loading branch information
nachandr authored Nov 20, 2023
1 parent 6bce28f commit d0b7de4
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 8 deletions.
41 changes: 33 additions & 8 deletions cypress/e2e/models/migration/applicationinventory/assessment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,28 +192,53 @@ export class Assessment extends Application {
super.edit(updatedValues);
}

clickAssessButton() {
Application.open();
this.selectApplication();
clickItemInKebabMenu(this.name, "Assess");
}

retake_questionnaire(
risk,
stakeholders?: Array<string>,
stakeholderGroups?: Array<string>
): 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");
}

perform_assessment(
risk,
stakeholders?: Array<string>,
stakeholderGroups?: Array<string>
stakeholderGroups?: Array<string>,
applicationOpen = true
): void {
if (stakeholders == undefined && stakeholderGroups == undefined) {
expect(
false,
"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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,21 @@ import {
createMultipleApplications,
deleteByList,
checkSuccessAlert,
selectItemsPerPage,
} from "../../../../../utils/utils";

import * as data from "../../../../../utils/data_utils";
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<Stakeholders> = [];
let stakeholderNameList: Array<string> = [];
let applicationList: Array<Assessment> = [];
let applicationOpen: boolean;

describe(["@tier3"], "Tests related to application assessment and review", () => {
before("Perform application assessment and review", function () {
Expand All @@ -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(
Expand Down

0 comments on commit d0b7de4

Please sign in to comment.