Skip to content

Commit

Permalink
[RFR] [CR] Replace two assessment methods with verifyButtonEnabled() (#…
Browse files Browse the repository at this point in the history
…966)

* Combine two assessment methods

Signed-off-by: Nandini Chandra <[email protected]>

* Combine two assessment methods

Signed-off-by: Nandini Chandra <[email protected]>

---------

Signed-off-by: Nandini Chandra <[email protected]>
  • Loading branch information
nachandr authored Feb 15, 2024
1 parent 0b36ec1 commit 6230704
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -894,18 +894,20 @@ export class Application {
.find("span")
.should("contain.text", appName);
}

validateExcludedIssues(appIssues: AppIssue[]): void {
Issues.openSingleApplication(this.name);
cy.get(commonView.appTable).should("not.contain.text", appIssues);
}
verifyAssessmentTakeButtonEnabled(): void {

verifyButtonEnabled(button: string): void {
//validates current page
validatePageTitle("Assessment Actions").then((titleMatches) => {
if (!titleMatches) {
Application.open();
this.clickAssessButton();
}
Assessment.verifyAssessmentTakeButtonEnabled();
Assessment.verifyButtonEnabled(button);
});
}

Expand Down
12 changes: 3 additions & 9 deletions cypress/e2e/models/migration/applicationinventory/assessment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,21 +326,15 @@ export class Assessment {
cy.get(commonView.sideDrawer.labelContent).contains(risk);
click(commonView.sideDrawer.closeDrawer);
}

public static deleteAssessments(): void {
cy.get(tableRowActions).each(($el) => {
cy.wrap($el).find(plainButton).click();
});
}
public static verifyAssessmentTakeButtonEnabled(): void {
cy.contains("button", "Take", { timeout: 30 * SEC }).should(
"not.have.attr",
"aria-disabled",
"true"
);
}

public static verifyContinueButtonEnabled(): void {
cy.contains("button", "Continue", { timeout: 30 * SEC }).should(
public static verifyButtonEnabled(button: string): void {
cy.contains("button", button, { timeout: 30 * SEC }).should(
"not.have.attr",
"aria-disabled",
"true"
Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/models/migration/archetypes/archetype.ts
Original file line number Diff line number Diff line change
Expand Up @@ -326,22 +326,25 @@ export class Archetype {
clickKebabMenuOptionArchetype(this.name, "Discard review");
confirm();
}

clickAssessButton() {
Archetype.open();
clickKebabMenuOptionArchetype(this.name, "Assess");
}

deleteAssessments(): void {
this.clickAssessButton();
Assessment.deleteAssessments();
}
verifyAssessmentTakeButtonEnabled(): void {

verifyButtonEnabled(button: string): void {
//validates current page
validatePageTitle("Assessment Actions").then((titleMatches) => {
if (!titleMatches) {
Archetype.open();
this.clickAssessButton();
}
Assessment.verifyAssessmentTakeButtonEnabled();
Assessment.verifyButtonEnabled(button);
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ describe(["@tier3"], "Tests related to application assessment and review", () =>
applicationList[0].perform_assessment("low", stakeholderList);
Application.open(true);
applicationList[0].deleteAssessments();
applicationList[0].verifyAssessmentTakeButtonEnabled();
applicationList[0].verifyButtonEnabled("Take");
checkSuccessAlert(
successAlertMessage,
`Success! Assessment discarded for ${applicationList[0].name}.`,
Expand All @@ -99,7 +99,7 @@ describe(["@tier3"], "Tests related to application assessment and review", () =>
archetypeList[0].perform_assessment("low", stakeholderList);
Archetype.open(true);
archetypeList[0].deleteAssessments();
archetypeList[0].verifyAssessmentTakeButtonEnabled();
archetypeList[0].verifyButtonEnabled("Take");
checkSuccessAlert(
successAlertMessage,
`Success! Assessment discarded for ${archetypeList[0].name}.`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ describe(["@tier3"], "Tests related to questionnaire features", () => {

// Automates Polarion MTA-506: Save assessment
clickByText(button, "Save as draft");
Assessment.verifyContinueButtonEnabled();
application.verifyButtonEnabled("Continue");
});

after("Perform test data clean up", function () {
Expand Down

0 comments on commit 6230704

Please sign in to comment.