Skip to content

Commit

Permalink
adapt rbac tests (#773)
Browse files Browse the repository at this point in the history
Signed-off-by: Alejandro Brugarolas <[email protected]>
  • Loading branch information
abrugaro authored Oct 26, 2023
1 parent a86e515 commit 0fa1fe7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 49 deletions.
46 changes: 5 additions & 41 deletions cypress/e2e/tests/rbac/review-assessment.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,83 +15,47 @@ limitations under the License.
*/
/// <reference types="cypress" />

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";

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();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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"),
Expand All @@ -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"])
Expand All @@ -117,7 +117,6 @@ describe(["@tier3"], "Upload Binary Analysis", () => {
});

afterEach("Persist session", function () {
// Reset URL from report page to web UI
resetURL();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"])
Expand All @@ -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"),
Expand All @@ -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"])
Expand All @@ -117,7 +117,6 @@ describe(["@tier3"], "Upload Binary Analysis", () => {
});

afterEach("Persist session", function () {
// Reset URL from report page to web UI
resetURL();
});

Expand Down

0 comments on commit 0fa1fe7

Please sign in to comment.