diff --git a/cypress/integration/authentication_test.spec.ts b/cypress/integration/authentication_test.spec.ts
index ae9f4628ec..c3a049d7ff 100644
--- a/cypress/integration/authentication_test.spec.ts
+++ b/cypress/integration/authentication_test.spec.ts
@@ -7,6 +7,7 @@ import DuplicateFlowModal from "../support/pages/admin_console/manage/authentica
import FlowDetails from "../support/pages/admin_console/manage/authentication/FlowDetail";
import RequiredActions from "../support/pages/admin_console/manage/authentication/RequiredActions";
import AdminClient from "../support/util/AdminClient";
+import PasswordPolicies from "../support/pages/admin_console/manage/authentication/PasswordPolicies";
describe("Authentication test", () => {
const loginPage = new LoginPage();
@@ -154,4 +155,32 @@ describe("Authentication test", () => {
masthead.checkNotificationMessage("Updated required action successfully");
});
});
+
+ describe("Password policies tab", () => {
+ const passwordPoliciesPage = new PasswordPolicies();
+ beforeEach(() => {
+ keycloakBefore();
+ loginPage.logIn();
+ sidebarPage.goToAuthentication();
+ passwordPoliciesPage.goToTab();
+ });
+
+ it("should add password policies", () => {
+ passwordPoliciesPage
+ .shouldShowEmptyState()
+ .addPolicy("Not Recently Used")
+ .save();
+ masthead.checkNotificationMessage(
+ "Password policies successfully updated"
+ );
+ });
+
+ it("should remove password policies", () => {
+ passwordPoliciesPage.removePolicy("remove-passwordHistory").save();
+ masthead.checkNotificationMessage(
+ "Password policies successfully updated"
+ );
+ passwordPoliciesPage.shouldShowEmptyState();
+ });
+ });
});
diff --git a/cypress/support/pages/admin_console/manage/authentication/PasswordPolicies.ts b/cypress/support/pages/admin_console/manage/authentication/PasswordPolicies.ts
new file mode 100644
index 0000000000..7f9a0ede89
--- /dev/null
+++ b/cypress/support/pages/admin_console/manage/authentication/PasswordPolicies.ts
@@ -0,0 +1,26 @@
+export default class PasswordPolicies {
+ goToTab() {
+ cy.get("#pf-tab-policies-policies").click();
+ return this;
+ }
+
+ shouldShowEmptyState() {
+ cy.findByTestId("empty-state").should("exist");
+ return this;
+ }
+
+ addPolicy(name: string) {
+ cy.get(".pf-c-select").click().contains(name).click();
+ return this;
+ }
+
+ removePolicy(name: string) {
+ cy.findByTestId(name).click();
+ return this;
+ }
+
+ save() {
+ cy.findByTestId("save").click();
+ return this;
+ }
+}
diff --git a/src/authentication/AuthenticationSection.tsx b/src/authentication/AuthenticationSection.tsx
index d5604fa163..651e271975 100644
--- a/src/authentication/AuthenticationSection.tsx
+++ b/src/authentication/AuthenticationSection.tsx
@@ -29,6 +29,7 @@ import { DuplicateFlowModal } from "./DuplicateFlowModal";
import { toCreateFlow } from "./routes/CreateFlow";
import { toFlow } from "./routes/Flow";
import { RequiredActions } from "./RequiredActions";
+import { Policies } from "./policies/Policies";
import "./authentication-section.css";
@@ -290,6 +291,13 @@ export default function AuthenticationSection() {
>
+ {t("policies")}}
+ >
+
+
>
diff --git a/src/authentication/EmptyExecutionState.tsx b/src/authentication/EmptyExecutionState.tsx
index 36acfa4728..919c76c20c 100644
--- a/src/authentication/EmptyExecutionState.tsx
+++ b/src/authentication/EmptyExecutionState.tsx
@@ -74,7 +74,7 @@ export const EmptyExecutionState = ({