diff --git a/cypress/integration/user_fed_kerberos_test.spec.ts b/cypress/integration/user_fed_kerberos_test.spec.ts index cfaa34091f..dcd6973f87 100644 --- a/cypress/integration/user_fed_kerberos_test.spec.ts +++ b/cypress/integration/user_fed_kerberos_test.spec.ts @@ -41,7 +41,7 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get("[data-cy=kerberos-card]").click(); + cy.get("[data-testid=kerberos-card]").click(); providersPage.fillKerberosRequiredData( firstKerberosName, @@ -60,7 +60,7 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); @@ -81,7 +81,7 @@ describe("User Fed Kerberos tests", () => { sidebarPage.goToUserFederation(); cy.wait(1000); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); @@ -95,7 +95,7 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); @@ -113,7 +113,7 @@ describe("User Fed Kerberos tests", () => { providersPage.cancel(); cy.wait(1000); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); @@ -133,7 +133,7 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); @@ -158,7 +158,7 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); @@ -196,8 +196,8 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get('[data-cy="my-kerberos-2-dropdown"]').click(); - cy.get('[data-cy="card-delete"]').click(); + cy.get('[data-testid="my-kerberos-2-dropdown"]').click(); + cy.get('[data-testid="card-delete"]').click(); modalUtils.checkModalTitle(deleteModalTitle).confirmModal(); @@ -209,13 +209,13 @@ describe("User Fed Kerberos tests", () => { loginPage.logIn(); sidebarPage.goToUserFederation(); - cy.get('[data-cy="keycloak-card-title"]') + cy.get('[data-testid="keycloak-card-title"]') .contains(firstKerberosName) .click(); cy.wait(1000); cy.get('[data-testid="action-dropdown"]').click(); - cy.get('[data-cy="delete-provider-cmd"]').click(); + cy.get('[data-testid="delete-kerberos-cmd"]').click(); modalUtils.checkModalTitle(deleteModalTitle).confirmModal(); diff --git a/cypress/integration/user_fed_ldap_test.spec.ts b/cypress/integration/user_fed_ldap_test.spec.ts new file mode 100644 index 0000000000..d08a2930c2 --- /dev/null +++ b/cypress/integration/user_fed_ldap_test.spec.ts @@ -0,0 +1,188 @@ +import LoginPage from "../support/pages/LoginPage"; +import SidebarPage from "../support/pages/admin_console/SidebarPage"; +import CreateLdapProviderPage from "../support/pages/admin_console/manage/providers/CreateLdapProviderPage"; +import Masthead from "../support/pages/admin_console/Masthead"; +import ModalUtils from "../support/util/ModalUtils"; + +const loginPage = new LoginPage(); +const masthead = new Masthead(); +const sidebarPage = new SidebarPage(); +const providersPage = new CreateLdapProviderPage(); +const modalUtils = new ModalUtils(); + +const firstLdapName = "my-ldap"; +const firstLdapVendor = "Active Directory"; + +const connectionUrl = "ldap://"; +const firstBindType = "simple"; +const firstBindDn = "user-1"; +const firstBindCreds = "password1"; + +const firstUsersDn = "user-dn-1"; +const firstUserLdapAtt = "uid"; +const firstRdnLdapAtt = "uid"; +const firstUuidLdapAtt = "entryUUID"; +const firstUserObjClasses = "inetOrgPerson, organizationalPerson"; + +const secondLdapName = `${firstLdapName}-2`; +const secondLdapVendor = "Other"; + +const secondBindType = "none"; +const secondBindDn = "user-2"; +const secondBindCreds = "password2"; + +const secondUsersDn = "user-dn-2"; +const secondUserLdapAtt = "cn"; +const secondRdnLdapAtt = "cn"; +const secondUuidLdapAtt = "objectGUID"; +const secondUserObjClasses = "person, organizationalPerson, user"; + +const defaultPolicy = "DEFAULT"; +const newPolicy = "EVICT_WEEKLY"; +const defaultLdapDay = "Sunday"; +const defaultLdapHour = "00"; +const defaultLdapMinute = "00"; +const newLdapDay = "Wednesday"; +const newLdapHour = "15"; +const newLdapMinute = "55"; + +const createdSuccessMessage = "User federation provider successfully created"; +const savedSuccessMessage = "User federation provider successfully saved"; +const deletedSuccessMessage = "The user federation provider has been deleted."; +const deleteModalTitle = "Delete user federation provider?"; +const disableModalTitle = "Disable user federation provider?"; + +describe("User Fed LDAP tests", () => { + beforeEach(() => { + cy.visit(""); + cy.wait(1000); + loginPage.logIn(); + cy.wait(1000); + sidebarPage.goToUserFederation(); + cy.wait(1000); + }); + + it("Create Ldap provider from empty state", () => { + providersPage.clickNewCard("ldap"); + providersPage.fillLdapRequiredGeneralData(firstLdapName, firstLdapVendor); + providersPage.fillLdapRequiredConnectionData( + connectionUrl, + firstBindType, + firstBindDn, + firstBindCreds + ); + providersPage.fillLdapRequiredSearchingData( + firstUsersDn, + firstUserLdapAtt, + firstRdnLdapAtt, + firstUuidLdapAtt, + firstUserObjClasses + ); + + providersPage.save(); + + masthead.checkNotificationMessage(createdSuccessMessage); + sidebarPage.goToUserFederation(); + }); + + it("Update an existing LDAP provider and save", () => { + providersPage.clickExistingCard(firstLdapName); + providersPage.selectCacheType(newPolicy); + + providersPage.changeTime(defaultLdapDay, newLdapDay); + providersPage.changeTime(defaultLdapHour, newLdapHour); + providersPage.changeTime(defaultLdapMinute, newLdapMinute); + + providersPage.save(); + masthead.checkNotificationMessage(savedSuccessMessage); + + sidebarPage.goToUserFederation(); + cy.wait(1000); + + providersPage.clickExistingCard(firstLdapName); + + expect(cy.contains(newPolicy).should("exist")); + expect(cy.contains(defaultPolicy).should("not.exist")); + }); + + it("Change existing LDAP provider and click button to cancel", () => { + providersPage.clickExistingCard(firstLdapName); + providersPage.selectCacheType(newPolicy); + + providersPage.changeTime(newLdapDay, defaultLdapDay); + providersPage.changeTime(newLdapHour, defaultLdapHour); + providersPage.changeTime(newLdapMinute, defaultLdapMinute); + + providersPage.cancel(); + cy.wait(1000); + + providersPage.clickExistingCard(firstLdapName); + providersPage.selectCacheType(newPolicy); + + expect(cy.contains(newLdapDay).should("exist")); + expect(cy.contains(newLdapHour).should("exist")); + expect(cy.contains(newLdapMinute).should("exist")); + expect(cy.contains(defaultLdapMinute).should("not.exist")); + + sidebarPage.goToUserFederation(); + }); + + it("Disable an existing LDAP provider", () => { + providersPage.clickExistingCard(firstLdapName); + providersPage.disableEnabledSwitch(); + + modalUtils.checkModalTitle(disableModalTitle).confirmModal(); + + masthead.checkNotificationMessage(savedSuccessMessage); + sidebarPage.goToUserFederation(); + masthead.checkNotificationMessage(savedSuccessMessage); + + sidebarPage.goToUserFederation(); + cy.wait(1000); + expect(cy.contains("Disabled").should("exist")); + }); + + it("Enable an existing previously-disabled LDAP provider", () => { + providersPage.clickExistingCard(firstLdapName); + providersPage.enableEnabledSwitch(); + + masthead.checkNotificationMessage(savedSuccessMessage); + + sidebarPage.goToUserFederation(); + cy.wait(1000); + expect(cy.contains("Enabled").should("exist")); + }); + + it("Create new LDAP provider using the New Provider dropdown", () => { + providersPage.clickMenuCommand("Add new provider", "LDAP"); + providersPage.fillLdapRequiredGeneralData(secondLdapName, secondLdapVendor); + providersPage.fillLdapRequiredConnectionData( + connectionUrl, + secondBindType, + secondBindDn, + secondBindCreds + ); + providersPage.fillLdapRequiredSearchingData( + secondUsersDn, + secondUserLdapAtt, + secondRdnLdapAtt, + secondUuidLdapAtt, + secondUserObjClasses + ); + providersPage.save(); + masthead.checkNotificationMessage(createdSuccessMessage); + sidebarPage.goToUserFederation(); + }); + + it("Delete an LDAP provider from card view using the card's menu", () => { + providersPage.deleteCardFromCard(secondLdapName); + modalUtils.checkModalTitle(deleteModalTitle).confirmModal(); + masthead.checkNotificationMessage(deletedSuccessMessage); + }); + + it("Delete an LDAP provider using the Settings view's Action menu", () => { + providersPage.deleteCardFromMenu(firstLdapName); + modalUtils.checkModalTitle(deleteModalTitle).confirmModal(); + masthead.checkNotificationMessage(deletedSuccessMessage); + }); +}); diff --git a/cypress/support/pages/admin_console/manage/providers/CreateKerberosProviderPage.ts b/cypress/support/pages/admin_console/manage/providers/CreateKerberosProviderPage.ts index 32b8319aa1..251b76cea1 100644 --- a/cypress/support/pages/admin_console/manage/providers/CreateKerberosProviderPage.ts +++ b/cypress/support/pages/admin_console/manage/providers/CreateKerberosProviderPage.ts @@ -19,10 +19,10 @@ export default class CreateKerberosProviderPage { cancelBtn: string; constructor() { - this.kerberosNameInput = "data-cy=kerberos-name"; - this.kerberosRealmInput = "data-cy=kerberos-realm"; - this.kerberosPrincipalInput = "data-cy=kerberos-principal"; - this.kerberosKeytabInput = "data-cy=kerberos-keytab"; + this.kerberosNameInput = "data-testid=kerberos-name"; + this.kerberosRealmInput = "data-testid=kerberos-realm"; + this.kerberosPrincipalInput = "data-testid=kerberos-principal"; + this.kerberosKeytabInput = "data-testid=kerberos-keytab"; this.kerberosEnabledInput = "#Kerberos-switch"; @@ -35,8 +35,8 @@ export default class CreateKerberosProviderPage { this.kerberosCachePolicyInput = "#kc-cache-policy"; this.kerberosCachePolicyList = "#kc-cache-policy + ul"; - this.saveBtn = "data-cy=kerberos-save"; - this.cancelBtn = "data-cy=kerberos-cancel"; + this.saveBtn = "data-testid=kerberos-save"; + this.cancelBtn = "data-testid=kerberos-cancel"; } //#region Required Settings diff --git a/cypress/support/pages/admin_console/manage/providers/CreateLdapProviderPage.ts b/cypress/support/pages/admin_console/manage/providers/CreateLdapProviderPage.ts new file mode 100644 index 0000000000..a5054ea374 --- /dev/null +++ b/cypress/support/pages/admin_console/manage/providers/CreateLdapProviderPage.ts @@ -0,0 +1,191 @@ +export default class CreateLdapProviderPage { + ldapNameInput: string; + ldapVendorInput: string; + ldapVendorList: string; + + ldapConnectionUrlInput: string; + ldapBindTypeInput: string; + ldapBindTypeList: string; + ldapBindDnInput: string; + ldapBindCredsInput: string; + + ldapUsersDnInput: string; + ldapUserLdapAttInput: string; + ldapRdnLdapAttInput: string; + ldapUuidLdapAttInput: string; + ldapUserObjClassesInput: string; + + ldapEnabledInput: string; + + ldapCacheDayInput: string; + ldapCacheDayList: string; + ldapCacheHourInput: string; + ldapCacheHourList: string; + ldapCacheMinuteInput: string; + ldapCacheMinuteList: string; + ldapCachePolicyInput: string; + ldapCachePolicyList: string; + + saveBtn: string; + cancelBtn: string; + + constructor() { + // LdapSettingsGeneral required input values + this.ldapNameInput = "data-testid=ldap-name"; + this.ldapVendorInput = "#kc-vendor"; + this.ldapVendorList = "#kc-vendor + ul"; + + // LdapSettingsConnection required input values + this.ldapConnectionUrlInput = "data-testid=ldap-connection-url"; + this.ldapBindTypeInput = "#kc-bind-type"; + this.ldapBindTypeList = "#kc-bind-type + ul"; + this.ldapBindDnInput = "data-testid=ldap-bind-dn"; + this.ldapBindCredsInput = "data-testid=ldap-bind-credentials"; + + // LdapSettingsSearching required input values + this.ldapUsersDnInput = "data-testid=ldap-users-dn"; + this.ldapUserLdapAttInput = "data-testid=ldap-username-attribute"; + this.ldapRdnLdapAttInput = "data-testid=ldap-rdn-attribute"; + this.ldapUuidLdapAttInput = "data-testid=ldap-uuid-attribute"; + this.ldapUserObjClassesInput = "data-testid=ldap-user-object-classes"; + + // SettingsCache input values + this.ldapCacheDayInput = "#kc-eviction-day"; + this.ldapCacheDayList = "#kc-eviction-day + ul"; + this.ldapCacheHourInput = "#kc-eviction-hour"; + this.ldapCacheHourList = "#kc-eviction-hour + ul"; + this.ldapCacheMinuteInput = "#kc-eviction-minute"; + this.ldapCacheMinuteList = "#kc-eviction-minute + ul"; + this.ldapCachePolicyInput = "#kc-cache-policy"; + this.ldapCachePolicyList = "#kc-cache-policy + ul"; + + // LDAP settings enabled switch + this.ldapEnabledInput = "#LDAP-switch"; + + // LDAP action buttons + this.saveBtn = "data-testid=ldap-save"; + this.cancelBtn = "data-testid=ldap-cancel"; + } + + changeTime(oldTime: string, newTime: string) { + cy.contains(oldTime).click(); + cy.contains(newTime).click(); + return this; + } + + deleteCardFromCard(card: string) { + cy.get(`[data-testid=${card}-dropdown]`).click(); + cy.get('[data-testid="card-delete"]').click(); + return this; + } + + deleteCardFromMenu(card: string) { + this.clickExistingCard(card); + cy.get('[data-testid="action-dropdown"]').click(); + cy.get('[data-testid="delete-ldap-cmd"]').click(); + return this; + } + + // Required fields - these always must be filled out when testing a save + fillLdapRequiredGeneralData(name: string, vendor: string) { + if (name) { + cy.get(`[${this.ldapNameInput}]`).type(name); + } + if (vendor) { + cy.get(this.ldapVendorInput).click(); + cy.get(this.ldapVendorList).contains(vendor).click(); + } + return this; + } + + fillLdapRequiredConnectionData( + connectionUrl: string, + bindType: string, + bindDn: string, + bindCreds: string + ) { + if (connectionUrl) { + cy.get(`[${this.ldapConnectionUrlInput}]`).type(connectionUrl); + } + if (bindType) { + cy.get(this.ldapBindTypeInput).click(); + cy.get(this.ldapBindTypeList).contains(bindType).click(); + } + if (bindDn) { + cy.get(`[${this.ldapBindDnInput}]`).type(bindDn); + } + if (bindCreds) { + cy.get(`[${this.ldapBindCredsInput}]`).type(bindCreds); + } + return this; + } + + fillLdapRequiredSearchingData( + usersDn: string, + userLdapAtt: string, + rdnLdapAtt: string, + uuidLdapAtt: string, + userObjClasses: string + ) { + if (usersDn) { + cy.get(`[${this.ldapUsersDnInput}]`).type(usersDn); + } + if (userLdapAtt) { + cy.get(`[${this.ldapUserLdapAttInput}]`).type(userLdapAtt); + } + if (rdnLdapAtt) { + cy.get(`[${this.ldapRdnLdapAttInput}]`).type(rdnLdapAtt); + } + if (uuidLdapAtt) { + cy.get(`[${this.ldapUuidLdapAttInput}]`).type(uuidLdapAtt); + } + if (userObjClasses) { + cy.get(`[${this.ldapUserObjClassesInput}]`).type(userObjClasses); + } + return this; + } + + selectCacheType(cacheType: string) { + cy.get(this.ldapCachePolicyInput).click(); + cy.get(this.ldapCachePolicyList).contains(cacheType).click(); + return this; + } + + clickExistingCard(cardName: string) { + cy.get('[data-testid="keycloak-card-title"]').contains(cardName).click(); + cy.wait(1000); + return this; + } + + clickMenuCommand(menu: string, command: string) { + cy.contains("button", menu).click(); + cy.contains("li", command).click(); + return this; + } + + clickNewCard(providerType: string) { + cy.get(`[data-testid=${providerType}-card]`).click(); + cy.wait(1000); + return this; + } + + disableEnabledSwitch() { + cy.get(this.ldapEnabledInput).uncheck({ force: true }); + return this; + } + + enableEnabledSwitch() { + cy.get(this.ldapEnabledInput).check({ force: true }); + return this; + } + + save() { + cy.get(`[${this.saveBtn}]`).click(); + return this; + } + + cancel() { + cy.get(`[${this.cancelBtn}]`).click(); + return this; + } +} diff --git a/src/components/keycloak-card/KeycloakCard.tsx b/src/components/keycloak-card/KeycloakCard.tsx index 163869b592..93cc5aae48 100644 --- a/src/components/keycloak-card/KeycloakCard.tsx +++ b/src/components/keycloak-card/KeycloakCard.tsx @@ -58,7 +58,7 @@ export const KeycloakCard = ({ {dropdownItems && ( } @@ -68,7 +68,7 @@ export const KeycloakCard = ({ /> )} - {title} + {title} diff --git a/src/user-federation/UserFederationKerberosSettings.tsx b/src/user-federation/UserFederationKerberosSettings.tsx index 2ea8b81e8e..1a1d3befb1 100644 --- a/src/user-federation/UserFederationKerberosSettings.tsx +++ b/src/user-federation/UserFederationKerberosSettings.tsx @@ -60,7 +60,7 @@ const KerberosSettingsHeader = ({ toggleDeleteDialog()} - data-cy="delete-provider-cmd" + data-testid="delete-kerberos-cmd" > {t("deleteProvider")} , @@ -93,9 +93,11 @@ export const UserFederationKerberosSettings = () => { useEffect(() => { (async () => { - const fetchedComponent = await adminClient.components.findOne({ id }); - if (fetchedComponent) { - setupForm(fetchedComponent); + if (id !== "new") { + const fetchedComponent = await adminClient.components.findOne({ id }); + if (fetchedComponent) { + setupForm(fetchedComponent); + } } })(); }, []); @@ -174,13 +176,13 @@ export const UserFederationKerberosSettings = () => {
- diff --git a/src/user-federation/UserFederationLdapSettings.tsx b/src/user-federation/UserFederationLdapSettings.tsx index 893572a094..e9d49300ae 100644 --- a/src/user-federation/UserFederationLdapSettings.tsx +++ b/src/user-federation/UserFederationLdapSettings.tsx @@ -47,6 +47,7 @@ const LdapSettingsHeader = ({ toggleRemoveUsersDialog, }: LdapSettingsHeaderProps) => { const { t } = useTranslation("user-federation"); + const { id } = useParams<{ id: string }>(); const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({ titleKey: "user-federation:userFedDisableConfirmTitle", messageKey: "user-federation:userFedDisableConfirm", @@ -59,46 +60,57 @@ const LdapSettingsHeader = ({ return ( <> - console.log("Sync users TBD")} - > - {t("syncChangedUsers")} - , - console.log("Sync all users TBD")} - > - {t("syncAllUsers")} - , - console.log("Unlink users TBD")} - > - {t("unlinkUsers")} - , - toggleRemoveUsersDialog()}> - {t("removeImported")} - , - , - toggleDeleteDialog()}> - {t("deleteProvider")} - , - ]} - isEnabled={value === "true"} - onToggle={(value) => { - if (!value) { - toggleDisableDialog(); - } else { - onChange("" + value); - save(); - } - }} - /> + {id === "new" ? ( + + ) : ( + console.log("Sync users TBD")} + > + {t("syncChangedUsers")} + , + console.log("Sync all users TBD")} + > + {t("syncAllUsers")} + , + console.log("Unlink users TBD")} + > + {t("unlinkUsers")} + , + toggleRemoveUsersDialog()} + > + {t("removeImported")} + , + , + toggleDeleteDialog()} + data-testid="delete-ldap-cmd" + > + {t("deleteProvider")} + , + ]} + isEnabled={value === "true"} + onToggle={(value) => { + if (!value) { + toggleDisableDialog(); + } else { + onChange("" + value); + save(); + } + }} + /> + )} ); }; @@ -115,9 +127,11 @@ export const UserFederationLdapSettings = () => { useEffect(() => { (async () => { - const fetchedComponent = await adminClient.components.findOne({ id }); - if (fetchedComponent) { - setupForm(fetchedComponent); + if (id !== "new") { + const fetchedComponent = await adminClient.components.findOne({ id }); + if (fetchedComponent) { + setupForm(fetchedComponent); + } } })(); }, []); @@ -134,11 +148,23 @@ export const UserFederationLdapSettings = () => { const save = async (component: ComponentRepresentation) => { try { - await adminClient.components.update({ id }, component); + if (id) { + if (id === "new") { + await adminClient.components.create(component); + } else { + await adminClient.components.update({ id }, component); + } + } setupForm(component as ComponentRepresentation); - addAlert(t("saveSuccess"), AlertVariant.success); + addAlert( + t(id === "new" ? "createSuccess" : "saveSuccess"), + AlertVariant.success + ); } catch (error) { - addAlert(`${t("saveError")} '${error}'`, AlertVariant.danger); + addAlert( + `${t(id === "new" ? "createError" : "saveError")} '${error}'`, + AlertVariant.danger + ); } }; @@ -179,7 +205,7 @@ export const UserFederationLdapSettings = () => { ( { - diff --git a/src/user-federation/UserFederationSection.tsx b/src/user-federation/UserFederationSection.tsx index 3705c1b1f9..85d5b7b68b 100644 --- a/src/user-federation/UserFederationSection.tsx +++ b/src/user-federation/UserFederationSection.tsx @@ -113,7 +113,7 @@ export const UserFederationSection = () => { onClick={() => { toggleDeleteForCard(userFederation.id!); }} - data-cy="card-delete" + data-testid="card-delete" > {t("common:delete")} , @@ -179,7 +179,7 @@ export const UserFederationSection = () => { history.push(`${url}/kerberos/new`)} - data-cy="kerberos-card" + data-testid="kerberos-card" > @@ -190,7 +190,11 @@ export const UserFederationSection = () => { - + history.push(`${url}/ldap/new`)} + data-testid="ldap-card" + > diff --git a/src/user-federation/kerberos/KerberosSettingsRequired.tsx b/src/user-federation/kerberos/KerberosSettingsRequired.tsx index e53e6c0259..bbe0143bb7 100644 --- a/src/user-federation/kerberos/KerberosSettingsRequired.tsx +++ b/src/user-federation/kerberos/KerberosSettingsRequired.tsx @@ -107,7 +107,7 @@ export const KerberosSettingsRequired = ({ message: `${t("validateName")}`, }, })} - data-cy="kerberos-name" + data-testid="kerberos-name" /> {form.errors.name && (
{form.errors.name.message}
@@ -137,7 +137,7 @@ export const KerberosSettingsRequired = ({ message: `${t("validateRealm")}`, }, })} - data-cy="kerberos-realm" + data-testid="kerberos-realm" /> {form.errors.config && form.errors.config.kerberosRealm && @@ -171,7 +171,7 @@ export const KerberosSettingsRequired = ({ message: `${t("validateServerPrincipal")}`, }, })} - data-cy="kerberos-principal" + data-testid="kerberos-principal" /> {form.errors.config && form.errors.config.serverPrincipal && @@ -205,7 +205,7 @@ export const KerberosSettingsRequired = ({ message: `${t("validateKeyTab")}`, }, })} - data-cy="kerberos-keytab" + data-testid="kerberos-keytab" /> {form.errors.config && form.errors.config.keyTab && diff --git a/src/user-federation/ldap/LdapSettingsAdvanced.tsx b/src/user-federation/ldap/LdapSettingsAdvanced.tsx index 139d174e3a..f10fdd566e 100644 --- a/src/user-federation/ldap/LdapSettingsAdvanced.tsx +++ b/src/user-federation/ldap/LdapSettingsAdvanced.tsx @@ -74,7 +74,7 @@ export const LdapSettingsAdvanced = ({ > ( ( ( @@ -246,13 +249,27 @@ export const LdapSettingsConnection = ({ /> } fieldId="kc-console-bind-dn" + isRequired > + {form.errors.config && + form.errors.config.bindDn && + form.errors.config.bindDn[0] && ( +
+ {form.errors.config.bindDn[0].message} +
+ )} { const { t } = useTranslation("user-federation"); const helpText = useTranslation("user-federation-help").t; + const { realm } = useRealm(); const [isVendorDropdownOpen, setIsVendorDropdownOpen] = useState(false); @@ -54,8 +57,25 @@ export const LdapSettingsGeneral = ({ ( ( @@ -156,7 +156,7 @@ export const SettingsCache = ({ control={form.control} render={({ onChange, value }) => (