Skip to content

Commit

Permalink
[RFR] Test few operations after disabling Keycloak (konveyor#1041)
Browse files Browse the repository at this point in the history
* Re-add disable Keycloak tests

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

* Added additional tests

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

* Minor change

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

* Additional changes

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

* Update login()

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

* Update login()

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

* Minor change

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

* Adding log message

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

* Reverting log message

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

---------

Signed-off-by: Nandini Chandra <[email protected]>
  • Loading branch information
nachandr authored Apr 2, 2024
1 parent 66e197e commit 49d89d1
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 1 deletion.
83 changes: 83 additions & 0 deletions cypress/e2e/tests/rbac/disable_keycloak.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
Copyright © 2021 the Konveyor Contributors (https://konveyor.io/)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/// <reference types="cypress" />

import {
getRandomApplicationData,
patchTackleCR,
createMultipleStakeholders,
deleteByList,
login,
} from "../../../utils/utils";
import { Stakeholders } from "../../models/migration/controls/stakeholders";
import { Application } from "../../models/migration/applicationinventory/application";
import {
legacyPathfinder,
cloudReadinessQuestionnaire,
cloudReadinessFilePath,
SEC,
} from "../../types/constants";
import { AssessmentQuestionnaire } from "../../models/administration/assessment_questionnaire/assessment_questionnaire";
import { Analysis } from "../../models/migration/applicationinventory/analysis";
import { applicationInventory } from "../../types/constants";

let application = new Application(getRandomApplicationData());
let stakeholders: Stakeholders[];

describe(["@tier5"], "Perform certain operations after disabling Keycloak", function () {
// Automates Polarion MTA-293
before("Disable Keycloak", function () {
patchTackleCR("keycloak", false);
login();

application.create();
stakeholders = createMultipleStakeholders(1);

AssessmentQuestionnaire.deleteAllQuestionnaires();
AssessmentQuestionnaire.import(cloudReadinessFilePath);
AssessmentQuestionnaire.enable(cloudReadinessQuestionnaire);
AssessmentQuestionnaire.disable(legacyPathfinder);
});

beforeEach("Load data", function () {
// RBAC rules for architect are applicable to admin as well
cy.fixture("rbac").then(function (rbacRules) {
this.rbacRules = rbacRules["architect"];
});
});

it("With Auth disabled, Perform application assessment and review", function () {
application.perform_assessment("high", stakeholders, null, cloudReadinessQuestionnaire);
cy.wait(SEC);
application.verifyStatus("assessment", "Completed");

application.perform_review("low");
cy.wait(SEC);
application.verifyStatus("assessment", "Completed");
});

it("Validate content of top kebab menu", function () {
// Import button should be available
Analysis.validateTopActionMenu(this.rbacRules);
});

it("Validate content of application kebab menu", function () {
application.validateAppContextMenu(this.rbacRules);
});

after("Clean up", function () {
// Keycloak is not re-enabled because of Bug MTA-1152
application.delete();
deleteByList(stakeholders);
});
});
7 changes: 6 additions & 1 deletion cypress/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,12 @@ export function login(username?: string, password?: string, firstLogin = false):
cy.visit(Cypress.env("tackleUrl"), { timeout: 120 * SEC });
cy.wait(5000);
cy.get("h1", { timeout: 120 * SEC, log: false }).then(($title) => {
if ($title.text().toString().trim() !== "Sign in to your account") {
// With auth disabled, login page is not displayed and users are taken straight
// to the Application Inventory page.
if (
$title.text().toString().trim() !== "Sign in to your account" &&
$title.text().includes("Application inventory")
) {
return;
}

Expand Down

0 comments on commit 49d89d1

Please sign in to comment.