2022-01-07 07:27:58 +00:00
|
|
|
import { keycloakBefore } from "../support/util/keycloak_hooks";
|
2021-08-09 08:47:34 +00:00
|
|
|
import LoginPage from "../support/pages/LoginPage";
|
2022-12-07 15:28:28 +00:00
|
|
|
import SidebarPage from "../support/pages/admin-ui/SidebarPage";
|
|
|
|
import Masthead from "../support/pages/admin-ui/Masthead";
|
|
|
|
import ListingPage from "../support/pages/admin-ui/ListingPage";
|
|
|
|
import DuplicateFlowModal from "../support/pages/admin-ui/manage/authentication/DuplicateFlowModal";
|
|
|
|
import FlowDetails from "../support/pages/admin-ui/manage/authentication/FlowDetail";
|
|
|
|
import RequiredActions from "../support/pages/admin-ui/manage/authentication/RequiredActions";
|
2022-02-24 10:31:46 +00:00
|
|
|
import adminClient from "../support/util/AdminClient";
|
2022-12-07 15:28:28 +00:00
|
|
|
import PasswordPolicies from "../support/pages/admin-ui/manage/authentication/PasswordPolicies";
|
2022-05-18 09:16:47 +00:00
|
|
|
import ModalUtils from "../support/util/ModalUtils";
|
2022-06-28 12:23:38 +00:00
|
|
|
import CommonPage from "../support/pages/CommonPage";
|
2022-12-07 15:28:28 +00:00
|
|
|
import BindFlowModal from "../support/pages/admin-ui/manage/authentication/BindFlowModal";
|
2021-08-09 08:47:34 +00:00
|
|
|
|
2022-05-18 09:16:47 +00:00
|
|
|
const loginPage = new LoginPage();
|
|
|
|
const masthead = new Masthead();
|
|
|
|
const sidebarPage = new SidebarPage();
|
2022-06-28 12:23:38 +00:00
|
|
|
const commonPage = new CommonPage();
|
2022-05-18 09:16:47 +00:00
|
|
|
const listingPage = new ListingPage();
|
2023-02-10 10:10:35 +00:00
|
|
|
const realmName = "test" + crypto.randomUUID();
|
2021-08-09 08:47:34 +00:00
|
|
|
|
2022-05-18 09:16:47 +00:00
|
|
|
describe("Authentication test", () => {
|
2021-08-09 08:47:34 +00:00
|
|
|
const detailPage = new FlowDetails();
|
2022-05-18 09:16:47 +00:00
|
|
|
const duplicateFlowModal = new DuplicateFlowModal();
|
|
|
|
const modalUtil = new ModalUtils();
|
2021-08-09 08:47:34 +00:00
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
before(() => adminClient.createRealm(realmName));
|
2022-05-18 09:16:47 +00:00
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
after(() => adminClient.deleteRealm(realmName));
|
2022-06-28 12:23:38 +00:00
|
|
|
|
2022-05-18 09:16:47 +00:00
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
|
|
|
sidebarPage.goToRealm(realmName);
|
2021-08-09 08:47:34 +00:00
|
|
|
sidebarPage.goToAuthentication();
|
|
|
|
});
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("authentication empty search test", () => {
|
|
|
|
commonPage.tableToolbarUtils().searchItem("", false);
|
|
|
|
commonPage.tableUtils().checkIfExists(true);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("authentication search flow", () => {
|
|
|
|
const itemId = "Browser";
|
|
|
|
commonPage.tableToolbarUtils().searchItem(itemId, false);
|
|
|
|
commonPage.tableUtils().checkRowItemExists(itemId);
|
|
|
|
});
|
|
|
|
|
2021-08-09 08:47:34 +00:00
|
|
|
it("should create duplicate of existing flow", () => {
|
|
|
|
listingPage.clickRowDetails("Browser").clickDetailMenu("Duplicate");
|
2022-05-18 09:16:47 +00:00
|
|
|
duplicateFlowModal.fill("Copy of browser");
|
2021-08-09 08:47:34 +00:00
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Flow successfully duplicated");
|
2022-08-29 12:40:36 +00:00
|
|
|
detailPage.flowExists("Copy of browser");
|
2021-08-09 08:47:34 +00:00
|
|
|
});
|
|
|
|
|
2022-05-18 09:16:47 +00:00
|
|
|
it("Should fail duplicate with empty flow name", () => {
|
|
|
|
listingPage.clickRowDetails("Browser").clickDetailMenu("Duplicate");
|
|
|
|
duplicateFlowModal.fill().shouldShowError("Required field");
|
|
|
|
modalUtil.cancelModal();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("Should fail duplicate with duplicated name", () => {
|
|
|
|
listingPage.clickRowDetails("Browser").clickDetailMenu("Duplicate");
|
|
|
|
duplicateFlowModal.fill("browser");
|
|
|
|
masthead.checkNotificationMessage(
|
|
|
|
"Could not duplicate flow: New flow alias name already exists"
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should show the details of a flow as a table", () => {
|
2021-08-09 08:47:34 +00:00
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
|
|
|
|
detailPage.executionExists("Cookie");
|
|
|
|
});
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should move kerberos down", () => {
|
2021-08-09 08:47:34 +00:00
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
const fromRow = "Kerberos";
|
|
|
|
detailPage.expectPriorityChange(fromRow, () => {
|
|
|
|
detailPage.moveRowTo(
|
|
|
|
fromRow,
|
|
|
|
`[data-testid="Identity Provider Redirector"]`
|
|
|
|
);
|
|
|
|
});
|
2021-08-09 08:47:34 +00:00
|
|
|
});
|
|
|
|
|
2022-07-12 14:29:59 +00:00
|
|
|
it("Should edit flow details", () => {
|
|
|
|
const name = "Copy of browser";
|
|
|
|
listingPage.goToItemDetails(name);
|
|
|
|
const commonPage = new CommonPage();
|
|
|
|
|
|
|
|
commonPage
|
|
|
|
.actionToolbarUtils()
|
|
|
|
.clickActionToggleButton()
|
|
|
|
.clickDropdownItem("Edit info");
|
|
|
|
|
|
|
|
duplicateFlowModal.fill(name, "Other description");
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
|
|
|
});
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should change requirement of cookie", () => {
|
2021-08-09 08:47:34 +00:00
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
|
|
|
|
detailPage.changeRequirement("Cookie", "Required");
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
|
|
|
});
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should switch to diagram mode", () => {
|
2021-08-09 08:47:34 +00:00
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
|
|
|
|
detailPage.goToDiagram();
|
|
|
|
|
|
|
|
cy.get(".react-flow").should("exist");
|
|
|
|
});
|
2021-09-06 12:43:36 +00:00
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should add a execution", () => {
|
2021-09-06 12:43:36 +00:00
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
detailPage.addExecution(
|
|
|
|
"Copy of browser forms",
|
2022-05-09 10:44:07 +00:00
|
|
|
"reset-credentials-choose-user"
|
2021-09-06 12:43:36 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
2022-05-09 10:44:07 +00:00
|
|
|
detailPage.executionExists("Choose User");
|
2021-09-06 12:43:36 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
it("should add a condition", () => {
|
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
detailPage.addCondition(
|
|
|
|
"Copy of browser Browser - Conditional OTP",
|
|
|
|
"conditional-user-role"
|
|
|
|
);
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
|
|
|
});
|
2021-09-23 15:06:58 +00:00
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should add a sub-flow", () => {
|
2021-09-23 15:06:58 +00:00
|
|
|
const flowName = "SubFlow";
|
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
detailPage.addSubFlow(
|
|
|
|
"Copy of browser Browser - Conditional OTP",
|
|
|
|
flowName
|
|
|
|
);
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
|
|
|
detailPage.flowExists(flowName);
|
|
|
|
});
|
|
|
|
|
2022-05-18 09:16:47 +00:00
|
|
|
it("Should remove an execution", () => {
|
|
|
|
listingPage.goToItemDetails("Copy of browser");
|
|
|
|
detailPage.executionExists("Cookie").clickRowDelete("Cookie");
|
|
|
|
modalUtil.confirmModal();
|
|
|
|
detailPage.executionExists("Cookie", false);
|
|
|
|
});
|
|
|
|
|
2022-06-28 12:23:38 +00:00
|
|
|
it("Should set as default in action menu", () => {
|
|
|
|
const bindFlow = new BindFlowModal();
|
|
|
|
listingPage.clickRowDetails("Copy of browser").clickDetailMenu("Bind flow");
|
|
|
|
bindFlow.fill("Direct grant flow").save();
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
|
|
|
});
|
|
|
|
|
|
|
|
const flowName = "Empty Flow";
|
2021-09-23 15:06:58 +00:00
|
|
|
it("should create flow from scratch", () => {
|
2022-06-28 12:23:38 +00:00
|
|
|
listingPage.goToCreateItem();
|
2021-09-23 15:06:58 +00:00
|
|
|
detailPage.fillCreateForm(
|
|
|
|
flowName,
|
|
|
|
"Some nice description about what this flow does so that we can use it later",
|
|
|
|
"Client flow"
|
|
|
|
);
|
|
|
|
masthead.checkNotificationMessage("Flow created");
|
|
|
|
detailPage.addSubFlowToEmpty(flowName, "EmptySubFlow");
|
|
|
|
|
|
|
|
masthead.checkNotificationMessage("Flow successfully updated");
|
|
|
|
|
|
|
|
detailPage.flowExists(flowName);
|
|
|
|
});
|
2022-06-28 12:23:38 +00:00
|
|
|
|
|
|
|
it("Should delete a flow from action menu", () => {
|
|
|
|
listingPage.clickRowDetails(flowName).clickDetailMenu("Delete");
|
|
|
|
modalUtil.confirmModal();
|
|
|
|
masthead.checkNotificationMessage("Flow successfully deleted");
|
|
|
|
});
|
2022-05-18 09:16:47 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("Required actions", () => {
|
|
|
|
const requiredActionsPage = new RequiredActions();
|
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
before(() => adminClient.createRealm(realmName));
|
2022-05-18 09:16:47 +00:00
|
|
|
|
|
|
|
beforeEach(() => {
|
2023-02-10 10:10:35 +00:00
|
|
|
loginPage.logIn();
|
|
|
|
keycloakBefore();
|
|
|
|
sidebarPage.goToRealm(realmName);
|
2022-05-18 09:16:47 +00:00
|
|
|
sidebarPage.goToAuthentication();
|
|
|
|
requiredActionsPage.goToTab();
|
|
|
|
});
|
|
|
|
|
2023-02-10 10:10:35 +00:00
|
|
|
after(() => adminClient.deleteRealm(realmName));
|
2022-05-18 09:16:47 +00:00
|
|
|
|
|
|
|
it("should enable delete account", () => {
|
|
|
|
const action = "Delete Account";
|
|
|
|
requiredActionsPage.enableAction(action);
|
|
|
|
masthead.checkNotificationMessage("Updated required action successfully");
|
|
|
|
requiredActionsPage.isChecked(action);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should register an unregistered action", () => {
|
|
|
|
const action = "Verify Profile";
|
|
|
|
requiredActionsPage.enableAction(action);
|
|
|
|
masthead.checkNotificationMessage("Updated required action successfully");
|
|
|
|
requiredActionsPage.isChecked(action).isDefaultEnabled(action);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should set action as default", () => {
|
|
|
|
const action = "Configure OTP";
|
|
|
|
requiredActionsPage.setAsDefault(action);
|
|
|
|
masthead.checkNotificationMessage("Updated required action successfully");
|
|
|
|
requiredActionsPage.isDefaultChecked(action);
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should reorder required actions", () => {
|
|
|
|
const action = "Terms and Conditions";
|
|
|
|
requiredActionsPage.moveRowTo(action, "Update Profile");
|
|
|
|
masthead.checkNotificationMessage("Updated required action successfully");
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("Password policies tab", () => {
|
|
|
|
const passwordPoliciesPage = new PasswordPolicies();
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
loginPage.logIn();
|
2023-02-10 10:10:35 +00:00
|
|
|
keycloakBefore();
|
2022-05-18 09:16:47 +00:00
|
|
|
sidebarPage.goToAuthentication();
|
|
|
|
passwordPoliciesPage.goToTab();
|
|
|
|
});
|
|
|
|
|
|
|
|
it("should add password policies", () => {
|
|
|
|
passwordPoliciesPage
|
|
|
|
.shouldShowEmptyState()
|
|
|
|
.addPolicy("Not Recently Used")
|
|
|
|
.save();
|
|
|
|
masthead.checkNotificationMessage("Password policies successfully updated");
|
|
|
|
});
|
2021-10-19 15:30:57 +00:00
|
|
|
|
2022-05-18 09:16:47 +00:00
|
|
|
it("should remove password policies", () => {
|
|
|
|
passwordPoliciesPage.removePolicy("remove-passwordHistory").save();
|
|
|
|
masthead.checkNotificationMessage("Password policies successfully updated");
|
|
|
|
passwordPoliciesPage.shouldShowEmptyState();
|
2021-12-01 09:24:46 +00:00
|
|
|
});
|
2021-08-09 08:47:34 +00:00
|
|
|
});
|