From 0fa1fe7dc56ae0a9b2af175e142bae45e0c145ec Mon Sep 17 00:00:00 2001 From: Alejandro Brugarolas <117646518+abrugaro@users.noreply.github.com> Date: Thu, 26 Oct 2023 17:44:42 +0200 Subject: [PATCH] adapt rbac tests (#773) Signed-off-by: Alejandro Brugarolas --- .../e2e/tests/rbac/review-assessment.test.ts | 46 ++----------------- .../upload_binary_analysis_architect.test.ts | 7 ++- .../upload_binary_analysis_migrator.test.ts | 7 ++- 3 files changed, 11 insertions(+), 49 deletions(-) diff --git a/cypress/e2e/tests/rbac/review-assessment.test.ts b/cypress/e2e/tests/rbac/review-assessment.test.ts index 6a10f7125..03bcbd96c 100644 --- a/cypress/e2e/tests/rbac/review-assessment.test.ts +++ b/cypress/e2e/tests/rbac/review-assessment.test.ts @@ -15,11 +15,10 @@ limitations under the License. */ /// -import { getRandomApplicationData, login, logout, preservecookies } from "../../../utils/utils"; +import { getRandomApplicationData, login, logout } from "../../../utils/utils"; import * as data from "../../../utils/data_utils"; import { UserArchitect } from "../../models/keycloak/users/userArchitect"; import { User } from "../../models/keycloak/users/user"; -import { GeneralConfig } from "../../models/administration/general/generalConfig"; import { Assessment } from "../../models/migration/applicationinventory/assessment"; import { SEC } from "../../types/constants"; @@ -27,71 +26,36 @@ describe(["@tier2"], "Assess review with RBAC operations", function () { // Polarion TC 312 const architect = new UserArchitect(data.getRandomUserData()); const application = new Assessment(getRandomApplicationData()); - const generalConfig = GeneralConfig.getInstance(); before("Create test data", function () { User.loginKeycloakAdmin(); architect.create(); login(); - - // Navigate to application inventory tab and create new application application.create(); cy.wait(2 * SEC); + logout(); }); - beforeEach("Persist session", function () { - login(); - - preservecookies(); - + beforeEach("Load fixtures", function () { cy.fixture("application").then(function (appData) { this.appData = appData; }); }); - it("Architect, Enable review without assessment", function () { - // Enable allow reviewing applications without running an assessment first button - generalConfig.enableReviewAssessment(); - - // Logout from admin user - logout(); - - // Login to architect user + it("Architect, Application assessment and review", function () { architect.login(); - // Perform application review application.perform_review("medium"); cy.wait(2000); application.verifyStatus("review", "Completed"); - // Logout from architect user - architect.logout(); - }); - - it("Architect, Disable review without assessment", function () { - // Disable allow reviewing applications without running an assessment first button - generalConfig.disableReviewAssessment(); - - // Logout from admin user - logout(); - - // Login to architect user - architect.login(); - - // Verify review button is disabled for the application - application.verifyReviewButtonDisabled(); - - // Delete application - application.delete(); - cy.wait(2000); - - // Logout from architect user architect.logout(); }); after("Clear test data", () => { login(); + application.delete(); User.loginKeycloakAdmin(); architect.delete(); }); diff --git a/cypress/e2e/tests/rbac/upload_binary_analysis_architect.test.ts b/cypress/e2e/tests/rbac/upload_binary_analysis_architect.test.ts index 1b600ed8e..957f3937b 100644 --- a/cypress/e2e/tests/rbac/upload_binary_analysis_architect.test.ts +++ b/cypress/e2e/tests/rbac/upload_binary_analysis_architect.test.ts @@ -56,7 +56,7 @@ describe(["@tier3"], "Upload Binary Analysis", () => { deleteApplicationTableRows(); }); - it("Upload Binary Analysis", function () { + it("Bug MTA-1420: Upload Binary Analysis", function () { const application = new Analysis( getRandomApplicationData("uploadBinary"), getRandomAnalysisData(this.analysisData["uploadbinary_analysis_on_acmeair"]) @@ -76,7 +76,7 @@ describe(["@tier3"], "Upload Binary Analysis", () => { // userArchitect.logout(); }); - it("Custom rules with custom targets", function () { + it("Bug MTA-1420: Custom rules with custom targets", function () { // Automated https://issues.redhat.com/browse/TACKLE-561 const application = new Analysis( getRandomApplicationData("customRule_customTarget"), @@ -96,7 +96,7 @@ describe(["@tier3"], "Upload Binary Analysis", () => { application.validateStoryPoints(); }); - it("DIVA report generation", function () { + it("Bug MTA-1420: DIVA report generation", function () { const application = new Analysis( getRandomApplicationData("DIVA"), getRandomAnalysisData(this.analysisData["analysis_for_DIVA-report"]) @@ -117,7 +117,6 @@ describe(["@tier3"], "Upload Binary Analysis", () => { }); afterEach("Persist session", function () { - // Reset URL from report page to web UI resetURL(); }); diff --git a/cypress/e2e/tests/rbac/upload_binary_analysis_migrator.test.ts b/cypress/e2e/tests/rbac/upload_binary_analysis_migrator.test.ts index a17a76348..3ca190352 100644 --- a/cypress/e2e/tests/rbac/upload_binary_analysis_migrator.test.ts +++ b/cypress/e2e/tests/rbac/upload_binary_analysis_migrator.test.ts @@ -57,7 +57,7 @@ describe(["@tier3"], "Upload Binary Analysis", () => { deleteApplicationTableRows(); }); - it("Upload Binary Analysis", function () { + it("Bug MTA-1420: Upload Binary Analysis", function () { const application = new Analysis( getRandomApplicationData("uploadBinary"), getRandomAnalysisData(this.analysisData["uploadbinary_analysis_on_acmeair"]) @@ -76,7 +76,7 @@ describe(["@tier3"], "Upload Binary Analysis", () => { application.validateStoryPoints(); }); - it("Custom rules with custom targets", function () { + it("Bug MTA-1420: Custom rules with custom targets", function () { // Automated https://issues.redhat.com/browse/TACKLE-561 const application = new Analysis( getRandomApplicationData("customRule_customTarget"), @@ -96,7 +96,7 @@ describe(["@tier3"], "Upload Binary Analysis", () => { application.validateStoryPoints(); }); - it("DIVA report generation", function () { + it("Bug MTA-1420: DIVA report generation", function () { const application = new Analysis( getRandomApplicationData("DIVA"), getRandomAnalysisData(this.analysisData["analysis_for_DIVA-report"]) @@ -117,7 +117,6 @@ describe(["@tier3"], "Upload Binary Analysis", () => { }); afterEach("Persist session", function () { - // Reset URL from report page to web UI resetURL(); });