From 62307043e726a03e9349774dc41146ce9aee5eec Mon Sep 17 00:00:00 2001 From: Nandini Chandra Date: Wed, 14 Feb 2024 21:49:33 -0600 Subject: [PATCH] [RFR] [CR] Replace two assessment methods with verifyButtonEnabled() (#966) * Combine two assessment methods Signed-off-by: Nandini Chandra * Combine two assessment methods Signed-off-by: Nandini Chandra --------- Signed-off-by: Nandini Chandra --- .../migration/applicationinventory/application.ts | 6 ++++-- .../migration/applicationinventory/assessment.ts | 12 +++--------- cypress/e2e/models/migration/archetypes/archetype.ts | 7 +++++-- .../assessment/miscellaneous.test.ts | 4 ++-- .../assessment/questionnaire_features.test.ts | 2 +- 5 files changed, 15 insertions(+), 16 deletions(-) diff --git a/cypress/e2e/models/migration/applicationinventory/application.ts b/cypress/e2e/models/migration/applicationinventory/application.ts index 09a280319..676cef667 100644 --- a/cypress/e2e/models/migration/applicationinventory/application.ts +++ b/cypress/e2e/models/migration/applicationinventory/application.ts @@ -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); }); } diff --git a/cypress/e2e/models/migration/applicationinventory/assessment.ts b/cypress/e2e/models/migration/applicationinventory/assessment.ts index 11d7b2837..8775e3c1b 100644 --- a/cypress/e2e/models/migration/applicationinventory/assessment.ts +++ b/cypress/e2e/models/migration/applicationinventory/assessment.ts @@ -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" diff --git a/cypress/e2e/models/migration/archetypes/archetype.ts b/cypress/e2e/models/migration/archetypes/archetype.ts index f17048250..728f45238 100644 --- a/cypress/e2e/models/migration/archetypes/archetype.ts +++ b/cypress/e2e/models/migration/archetypes/archetype.ts @@ -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); }); } } diff --git a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts index ca8f4e9b5..519143c34 100644 --- a/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/assessment/miscellaneous.test.ts @@ -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}.`, @@ -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}.`, diff --git a/cypress/e2e/tests/migration/applicationinventory/assessment/questionnaire_features.test.ts b/cypress/e2e/tests/migration/applicationinventory/assessment/questionnaire_features.test.ts index 96acbaad8..d323c6281 100644 --- a/cypress/e2e/tests/migration/applicationinventory/assessment/questionnaire_features.test.ts +++ b/cypress/e2e/tests/migration/applicationinventory/assessment/questionnaire_features.test.ts @@ -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 () {