Adds LDAP connection and general tests (#2376)
This commit is contained in:
parent
2c53947331
commit
ef9d0ca822
5 changed files with 305 additions and 143 deletions
|
@ -24,12 +24,16 @@ const allCapProvider = provider.toUpperCase();
|
||||||
const ldapName = "ldap-mappers-testing";
|
const ldapName = "ldap-mappers-testing";
|
||||||
const ldapVendor = "Active Directory";
|
const ldapVendor = "Active Directory";
|
||||||
|
|
||||||
const connectionUrl = "ldap://";
|
// connection and authentication settings
|
||||||
const firstBindType = "simple";
|
const connectionUrlValid = "ldap://ldap.forumsys.com:389";
|
||||||
const firstBindDn = "user-1";
|
const bindTypeSimple = "simple";
|
||||||
const firstBindCreds = "password1";
|
const truststoreSpiOnlyLdaps = "Only for ldaps";
|
||||||
|
const connectionTimeoutTwoSecs = "2000";
|
||||||
|
const bindDnCnDc = "cn=read-only-admin,dc=example,dc=com";
|
||||||
|
const bindCredsValid = "password";
|
||||||
|
|
||||||
const firstEditMode = "READ_ONLY";
|
// ldap searching and updating
|
||||||
|
const editModeReadOnly = "READ_ONLY";
|
||||||
const firstUsersDn = "user-dn-1";
|
const firstUsersDn = "user-dn-1";
|
||||||
const firstUserLdapAtt = "uid";
|
const firstUserLdapAtt = "uid";
|
||||||
const firstRdnLdapAtt = "uid";
|
const firstRdnLdapAtt = "uid";
|
||||||
|
@ -83,15 +87,20 @@ describe("User Fed LDAP mapper tests", () => {
|
||||||
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
providersPage.fillLdapRequiredGeneralData(ldapName, ldapVendor);
|
providersPage.fillLdapGeneralData(ldapName, ldapVendor);
|
||||||
providersPage.fillLdapRequiredConnectionData(
|
providersPage.fillLdapConnectionData(
|
||||||
connectionUrl,
|
connectionUrlValid,
|
||||||
firstBindType,
|
bindTypeSimple,
|
||||||
firstBindDn,
|
truststoreSpiOnlyLdaps,
|
||||||
firstBindCreds
|
connectionTimeoutTwoSecs,
|
||||||
|
bindDnCnDc,
|
||||||
|
bindCredsValid
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.toggleSwitch(providersPage.enableStartTls);
|
||||||
firstEditMode,
|
providersPage.toggleSwitch(providersPage.connectionPooling);
|
||||||
|
|
||||||
|
providersPage.fillLdapSearchingData(
|
||||||
|
editModeReadOnly,
|
||||||
firstUsersDn,
|
firstUsersDn,
|
||||||
firstUserLdapAtt,
|
firstUserLdapAtt,
|
||||||
firstRdnLdapAtt,
|
firstRdnLdapAtt,
|
||||||
|
|
|
@ -20,12 +20,16 @@ const allCapProvider = provider.toUpperCase();
|
||||||
const ldapName = "ldap-mappers-testing";
|
const ldapName = "ldap-mappers-testing";
|
||||||
const ldapVendor = "Active Directory";
|
const ldapVendor = "Active Directory";
|
||||||
|
|
||||||
const connectionUrl = "ldap://";
|
// connection and authentication settings
|
||||||
const firstBindType = "simple";
|
const connectionUrlValid = "ldap://ldap.forumsys.com:389";
|
||||||
const firstBindDn = "user-1";
|
const bindTypeSimple = "simple";
|
||||||
const firstBindCreds = "password1";
|
const truststoreSpiOnlyLdaps = "Only for ldaps";
|
||||||
|
const connectionTimeoutTwoSecs = "2000";
|
||||||
|
const bindDnCnDc = "cn=read-only-admin,dc=example,dc=com";
|
||||||
|
const bindCredsValid = "password";
|
||||||
|
|
||||||
const firstEditMode = "READ_ONLY";
|
// ldap searching and updating
|
||||||
|
const editModeReadOnly = "READ_ONLY";
|
||||||
const firstUsersDn = "user-dn-1";
|
const firstUsersDn = "user-dn-1";
|
||||||
const firstUserLdapAtt = "uid";
|
const firstUserLdapAtt = "uid";
|
||||||
const firstRdnLdapAtt = "uid";
|
const firstRdnLdapAtt = "uid";
|
||||||
|
@ -88,15 +92,20 @@ describe("User Fed LDAP mapper tests", () => {
|
||||||
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
providersPage.fillLdapRequiredGeneralData(ldapName, ldapVendor);
|
providersPage.fillLdapGeneralData(ldapName, ldapVendor);
|
||||||
providersPage.fillLdapRequiredConnectionData(
|
providersPage.fillLdapConnectionData(
|
||||||
connectionUrl,
|
connectionUrlValid,
|
||||||
firstBindType,
|
bindTypeSimple,
|
||||||
firstBindDn,
|
truststoreSpiOnlyLdaps,
|
||||||
firstBindCreds
|
connectionTimeoutTwoSecs,
|
||||||
|
bindDnCnDc,
|
||||||
|
bindCredsValid
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.toggleSwitch(providersPage.enableStartTls);
|
||||||
firstEditMode,
|
providersPage.toggleSwitch(providersPage.connectionPooling);
|
||||||
|
|
||||||
|
providersPage.fillLdapSearchingData(
|
||||||
|
editModeReadOnly,
|
||||||
firstUsersDn,
|
firstUsersDn,
|
||||||
firstUserLdapAtt,
|
firstUserLdapAtt,
|
||||||
firstRdnLdapAtt,
|
firstRdnLdapAtt,
|
||||||
|
|
|
@ -17,12 +17,22 @@ const allCapProvider = provider.toUpperCase();
|
||||||
const firstLdapName = "my-ldap";
|
const firstLdapName = "my-ldap";
|
||||||
const firstLdapVendor = "Active Directory";
|
const firstLdapVendor = "Active Directory";
|
||||||
|
|
||||||
const connectionUrl = "ldap://";
|
// connection and authentication settings
|
||||||
const firstBindType = "simple";
|
const connectionUrlValid = "ldap://ldap.forumsys.com:389";
|
||||||
const firstBindDn = "user-1";
|
const bindTypeSimple = "simple";
|
||||||
const firstBindCreds = "password1";
|
const truststoreSpiOnlyLdaps = "Only for ldaps";
|
||||||
|
const connectionTimeoutTwoSecs = "2000";
|
||||||
|
const bindDnCnDc = "cn=read-only-admin,dc=example,dc=com";
|
||||||
|
const bindCredsValid = "password";
|
||||||
|
|
||||||
const firstEditMode = "READ_ONLY";
|
const connectionUrlInvalid = "ldap://nowhere.com";
|
||||||
|
const bindTypeNone = "none";
|
||||||
|
const truststoreSpiNever = "Never";
|
||||||
|
const bindDnCnOnly = "cn=read-only-admin";
|
||||||
|
const bindCredsInvalid = "not-my-password";
|
||||||
|
|
||||||
|
// ldap searching and updating
|
||||||
|
const editModeReadOnly = "READ_ONLY";
|
||||||
const firstUsersDn = "user-dn-1";
|
const firstUsersDn = "user-dn-1";
|
||||||
const firstUserLdapAtt = "uid";
|
const firstUserLdapAtt = "uid";
|
||||||
const firstRdnLdapAtt = "uid";
|
const firstRdnLdapAtt = "uid";
|
||||||
|
@ -32,15 +42,16 @@ const firstUserObjClasses = "inetOrgPerson, organizationalPerson";
|
||||||
const secondLdapName = `${firstLdapName}-2`;
|
const secondLdapName = `${firstLdapName}-2`;
|
||||||
const secondLdapVendor = "Other";
|
const secondLdapVendor = "Other";
|
||||||
|
|
||||||
const secondBindType = "none";
|
const editModeWritable = "WRITABLE";
|
||||||
|
|
||||||
const secondEditMode = "WRITABLE";
|
|
||||||
const secondUsersDn = "user-dn-2";
|
const secondUsersDn = "user-dn-2";
|
||||||
const secondUserLdapAtt = "cn";
|
const secondUserLdapAtt = "cn";
|
||||||
const secondRdnLdapAtt = "cn";
|
const secondRdnLdapAtt = "cn";
|
||||||
const secondUuidLdapAtt = "objectGUID";
|
const secondUuidLdapAtt = "objectGUID";
|
||||||
const secondUserObjClasses = "person, organizationalPerson, user";
|
const secondUserObjClasses = "person, organizationalPerson, user";
|
||||||
|
|
||||||
|
const updatedLdapName = `${firstLdapName}-updated`;
|
||||||
|
|
||||||
const defaultPolicy = "DEFAULT";
|
const defaultPolicy = "DEFAULT";
|
||||||
const newPolicy = "EVICT_WEEKLY";
|
const newPolicy = "EVICT_WEEKLY";
|
||||||
const defaultLdapDay = "Sunday";
|
const defaultLdapDay = "Sunday";
|
||||||
|
@ -57,11 +68,16 @@ const deletedSuccessMessage = "The user federation provider has been deleted.";
|
||||||
const deleteModalTitle = "Delete user federation provider?";
|
const deleteModalTitle = "Delete user federation provider?";
|
||||||
const disableModalTitle = "Disable user federation provider?";
|
const disableModalTitle = "Disable user federation provider?";
|
||||||
|
|
||||||
|
const ldapTestSuccessMsg = "Successfully connected to LDAP";
|
||||||
|
const ldapTestFailMsg =
|
||||||
|
"Error when trying to connect to LDAP. See server.log for details. LDAP test error";
|
||||||
|
|
||||||
describe("User Fed LDAP tests", () => {
|
describe("User Fed LDAP tests", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
keycloakBefore();
|
keycloakBefore();
|
||||||
loginPage.logIn();
|
loginPage.logIn();
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
cy.intercept("GET", "/admin/realms/master").as("getProvider");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Create Ldap provider from empty state", () => {
|
it("Create Ldap provider from empty state", () => {
|
||||||
|
@ -74,24 +90,24 @@ describe("User Fed LDAP tests", () => {
|
||||||
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
providersPage.fillLdapRequiredGeneralData(firstLdapName, firstLdapVendor);
|
providersPage.fillLdapGeneralData(firstLdapName, firstLdapVendor);
|
||||||
providersPage.fillLdapRequiredConnectionData(
|
providersPage.fillLdapConnectionData(
|
||||||
connectionUrl,
|
connectionUrlInvalid,
|
||||||
firstBindType,
|
bindTypeSimple,
|
||||||
firstBindDn,
|
truststoreSpiNever,
|
||||||
firstBindCreds
|
connectionTimeoutTwoSecs,
|
||||||
|
bindDnCnOnly,
|
||||||
|
bindCredsInvalid
|
||||||
);
|
);
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
providersPage.fillLdapSearchingData(
|
||||||
firstEditMode,
|
editModeReadOnly,
|
||||||
firstUsersDn,
|
firstUsersDn,
|
||||||
firstUserLdapAtt,
|
firstUserLdapAtt,
|
||||||
firstRdnLdapAtt,
|
firstRdnLdapAtt,
|
||||||
firstUuidLdapAtt,
|
firstUuidLdapAtt,
|
||||||
firstUserObjClasses
|
firstUserObjClasses
|
||||||
);
|
);
|
||||||
|
|
||||||
providersPage.save(provider);
|
providersPage.save(provider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
});
|
});
|
||||||
|
@ -114,8 +130,94 @@ describe("User Fed LDAP tests", () => {
|
||||||
expect(cy.contains(defaultPolicy).should("not.exist"));
|
expect(cy.contains(defaultPolicy).should("not.exist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Change existing LDAP provider and click button to cancel", () => {
|
it("Update connection and authentication settings and save", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
|
||||||
|
providersPage.fillLdapConnectionData(
|
||||||
|
connectionUrlInvalid,
|
||||||
|
bindTypeNone,
|
||||||
|
truststoreSpiNever,
|
||||||
|
connectionTimeoutTwoSecs
|
||||||
|
);
|
||||||
|
providersPage.toggleSwitch(providersPage.enableStartTls);
|
||||||
|
providersPage.toggleSwitch(providersPage.connectionPooling);
|
||||||
|
|
||||||
|
providersPage.save(provider);
|
||||||
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
|
// now verify
|
||||||
|
sidebarPage.goToUserFederation();
|
||||||
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
providersPage.verifyTextField(
|
||||||
|
providersPage.connectionUrlInput,
|
||||||
|
connectionUrlInvalid
|
||||||
|
);
|
||||||
|
providersPage.verifyTextField(
|
||||||
|
providersPage.connectionTimeoutInput,
|
||||||
|
connectionTimeoutTwoSecs
|
||||||
|
);
|
||||||
|
providersPage.verifySelect(
|
||||||
|
providersPage.truststoreSpiInput,
|
||||||
|
truststoreSpiNever
|
||||||
|
);
|
||||||
|
providersPage.verifySelect(providersPage.bindTypeInput, bindTypeNone);
|
||||||
|
providersPage.verifyToggle(providersPage.enableStartTls, "on");
|
||||||
|
providersPage.verifyToggle(providersPage.connectionPooling, "on");
|
||||||
|
sidebarPage.goToUserFederation();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should fail connection and authentication tests", () => {
|
||||||
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
|
||||||
|
providersPage.testConnection();
|
||||||
|
masthead.checkNotificationMessage(ldapTestFailMsg);
|
||||||
|
|
||||||
|
providersPage.testAuthorization();
|
||||||
|
masthead.checkNotificationMessage(ldapTestFailMsg);
|
||||||
|
|
||||||
|
sidebarPage.goToUserFederation();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should make changes and pass connection and authentication tests", () => {
|
||||||
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
|
||||||
|
providersPage.fillLdapConnectionData(
|
||||||
|
connectionUrlValid,
|
||||||
|
bindTypeSimple,
|
||||||
|
truststoreSpiOnlyLdaps,
|
||||||
|
connectionTimeoutTwoSecs,
|
||||||
|
bindDnCnDc,
|
||||||
|
bindCredsValid
|
||||||
|
);
|
||||||
|
providersPage.toggleSwitch(providersPage.enableStartTls);
|
||||||
|
providersPage.toggleSwitch(providersPage.connectionPooling);
|
||||||
|
|
||||||
|
providersPage.save(provider);
|
||||||
|
|
||||||
|
providersPage.testConnection();
|
||||||
|
masthead.checkNotificationMessage(ldapTestSuccessMsg);
|
||||||
|
|
||||||
|
providersPage.testAuthorization();
|
||||||
|
masthead.checkNotificationMessage(ldapTestSuccessMsg);
|
||||||
|
|
||||||
|
sidebarPage.goToUserFederation();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Should update display name", () => {
|
||||||
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
providersPage.fillLdapGeneralData(updatedLdapName);
|
||||||
|
|
||||||
|
providersPage.save(provider);
|
||||||
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
|
sidebarPage.goToUserFederation();
|
||||||
|
providersPage.clickExistingCard(updatedLdapName);
|
||||||
|
|
||||||
|
sidebarPage.goToUserFederation();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Change existing LDAP provider and click button to cancel", () => {
|
||||||
|
providersPage.clickExistingCard(updatedLdapName);
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
providersPage.changeCacheTime("day", defaultLdapDay);
|
providersPage.changeCacheTime("day", defaultLdapDay);
|
||||||
|
@ -123,9 +225,8 @@ describe("User Fed LDAP tests", () => {
|
||||||
providersPage.changeCacheTime("minute", defaultLdapMinute);
|
providersPage.changeCacheTime("minute", defaultLdapMinute);
|
||||||
|
|
||||||
providersPage.cancel(provider);
|
providersPage.cancel(provider);
|
||||||
cy.wait(1000);
|
|
||||||
|
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(updatedLdapName);
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
providersPage.verifyChangedHourInput(newLdapHour, defaultLdapHour);
|
providersPage.verifyChangedHourInput(newLdapHour, defaultLdapHour);
|
||||||
|
@ -133,36 +234,38 @@ describe("User Fed LDAP tests", () => {
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Disable an existing LDAP provider", () => {
|
it("Should disable an existing LDAP provider", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
cy.wait("@getProvider");
|
||||||
providersPage.disableEnabledSwitch(allCapProvider);
|
providersPage.disableEnabledSwitch(allCapProvider);
|
||||||
|
|
||||||
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
||||||
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
|
||||||
|
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
expect(cy.contains("Disabled").should("exist"));
|
expect(cy.contains("Disabled").should("exist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Enable an existing previously-disabled LDAP provider", () => {
|
it("Should enable a previously-disabled LDAP provider", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
cy.wait("@getProvider");
|
||||||
providersPage.enableEnabledSwitch(allCapProvider);
|
providersPage.enableEnabledSwitch(allCapProvider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
expect(cy.contains("Enabled").should("exist"));
|
expect(cy.contains("Enabled").should("exist"));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Create new LDAP provider using the New Provider dropdown", () => {
|
it("Create new LDAP provider using the New Provider dropdown", () => {
|
||||||
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
||||||
providersPage.fillLdapRequiredGeneralData(secondLdapName, secondLdapVendor);
|
providersPage.fillLdapGeneralData(secondLdapName, secondLdapVendor);
|
||||||
providersPage.fillLdapRequiredConnectionData(connectionUrl, secondBindType);
|
providersPage.fillLdapConnectionData(
|
||||||
providersPage.fillLdapRequiredSearchingData(
|
connectionUrlValid,
|
||||||
secondEditMode,
|
bindTypeSimple,
|
||||||
|
truststoreSpiNever,
|
||||||
|
connectionTimeoutTwoSecs,
|
||||||
|
bindDnCnOnly,
|
||||||
|
bindCredsInvalid
|
||||||
|
);
|
||||||
|
providersPage.fillLdapSearchingData(
|
||||||
|
editModeWritable,
|
||||||
secondUsersDn,
|
secondUsersDn,
|
||||||
secondUserLdapAtt,
|
secondUserLdapAtt,
|
||||||
secondRdnLdapAtt,
|
secondRdnLdapAtt,
|
||||||
|
@ -181,7 +284,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Delete an LDAP provider using the Settings view's Action menu", () => {
|
it("Delete an LDAP provider using the Settings view's Action menu", () => {
|
||||||
providersPage.deleteCardFromMenu(firstLdapName);
|
providersPage.deleteCardFromMenu(updatedLdapName);
|
||||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,30 +1,35 @@
|
||||||
export default class ProviderPage {
|
export default class ProviderPage {
|
||||||
// KerberosSettingsRequired required input values
|
// KerberosSettingsRequired input values
|
||||||
private kerberosNameInput = "data-testid=kerberos-name";
|
private kerberosNameInput = "kerberos-name";
|
||||||
private kerberosRealmInput = "data-testid=kerberos-realm";
|
private kerberosRealmInput = "kerberos-realm";
|
||||||
private kerberosPrincipalInput = "data-testid=kerberos-principal";
|
private kerberosPrincipalInput = "kerberos-principal";
|
||||||
private kerberosKeytabInput = "data-testid=kerberos-keytab";
|
private kerberosKeytabInput = "kerberos-keytab";
|
||||||
|
|
||||||
// LdapSettingsGeneral required input values
|
// LdapSettingsGeneral input values
|
||||||
private ldapNameInput = "data-testid=ldap-name";
|
private ldapNameInput = "ldap-name";
|
||||||
private ldapVendorInput = "#kc-vendor";
|
private ldapVendorInput = "#kc-vendor";
|
||||||
private ldapVendorList = "#kc-vendor + ul";
|
private ldapVendorList = "#kc-vendor + ul";
|
||||||
|
|
||||||
// LdapSettingsConnection required input values
|
// LdapSettingsConnection input values
|
||||||
private ldapConnectionUrlInput = "data-testid=ldap-connection-url";
|
connectionUrlInput = "ldap-connection-url";
|
||||||
private ldapBindTypeInput = "#kc-bind-type";
|
truststoreSpiInput = "#kc-use-truststore-spi";
|
||||||
private ldapBindTypeList = "#kc-bind-type + ul";
|
truststoreSpiList = "#kc-use-truststore-spi + ul";
|
||||||
private ldapBindDnInput = "data-testid=ldap-bind-dn";
|
connectionTimeoutInput = "connection-timeout";
|
||||||
private ldapBindCredsInput = "data-testid=ldap-bind-credentials";
|
bindTypeInput = "#kc-bind-type";
|
||||||
|
private bindTypeList = "#kc-bind-type + ul";
|
||||||
|
bindDnInput = "ldap-bind-dn";
|
||||||
|
bindCredsInput = "ldap-bind-credentials";
|
||||||
|
private testConnectionBtn = "test-connection-button";
|
||||||
|
private testAuthBtn = "test-auth-button";
|
||||||
|
|
||||||
// LdapSettingsSearching required input values
|
// LdapSettingsSearching input values
|
||||||
private ldapEditModeInput = "#kc-edit-mode";
|
private ldapEditModeInput = "#kc-edit-mode";
|
||||||
private ldapEditModeList = "#kc-edit-mode + ul";
|
private ldapEditModeList = "#kc-edit-mode + ul";
|
||||||
private ldapUsersDnInput = "data-testid=ldap-users-dn";
|
private ldapUsersDnInput = "ldap-users-dn";
|
||||||
private ldapUserLdapAttInput = "data-testid=ldap-username-attribute";
|
private ldapUserLdapAttInput = "ldap-username-attribute";
|
||||||
private ldapRdnLdapAttInput = "data-testid=ldap-rdn-attribute";
|
private ldapRdnLdapAttInput = "ldap-rdn-attribute";
|
||||||
private ldapUuidLdapAttInput = "data-testid=ldap-uuid-attribute";
|
private ldapUuidLdapAttInput = "ldap-uuid-attribute";
|
||||||
private ldapUserObjClassesInput = "data-testid=ldap-user-object-classes";
|
private ldapUserObjClassesInput = "ldap-user-object-classes";
|
||||||
|
|
||||||
// SettingsCache input values
|
// SettingsCache input values
|
||||||
private cacheDayInput = "#kc-eviction-day";
|
private cacheDayInput = "#kc-eviction-day";
|
||||||
|
@ -36,7 +41,7 @@ export default class ProviderPage {
|
||||||
private cachePolicyInput = "#kc-cache-policy";
|
private cachePolicyInput = "#kc-cache-policy";
|
||||||
private cachePolicyList = "#kc-cache-policy + ul";
|
private cachePolicyList = "#kc-cache-policy + ul";
|
||||||
|
|
||||||
// Mapper required input values
|
// Mapper input values
|
||||||
private userModelAttInput = "user.model.attribute";
|
private userModelAttInput = "user.model.attribute";
|
||||||
private ldapAttInput = "ldap.attribute";
|
private ldapAttInput = "ldap.attribute";
|
||||||
private userModelAttNameInput = "user.model.attribute";
|
private userModelAttNameInput = "user.model.attribute";
|
||||||
|
@ -61,9 +66,13 @@ export default class ProviderPage {
|
||||||
private roleLdapMapper = "role-ldap-mapper";
|
private roleLdapMapper = "role-ldap-mapper";
|
||||||
private hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
|
private hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
|
||||||
|
|
||||||
|
private actionDropdown = "action-dropdown";
|
||||||
|
private deleteCmd = "delete-cmd";
|
||||||
|
|
||||||
|
private mappersTab = "ldap-mappers-tab";
|
||||||
private rolesTab = "rolesTab";
|
private rolesTab = "rolesTab";
|
||||||
private createRoleBtn = "data-testid=no-roles-for-this-client-empty-action";
|
private createRoleBtn = "no-roles-for-this-client-empty-action";
|
||||||
private realmRolesSaveBtn = "data-testid=realm-roles-save-button";
|
private realmRolesSaveBtn = "realm-roles-save-button";
|
||||||
private roleNameField = "#kc-name";
|
private roleNameField = "#kc-name";
|
||||||
private clientIdSelect = "#client\\.id-select-typeahead";
|
private clientIdSelect = "#client\\.id-select-typeahead";
|
||||||
|
|
||||||
|
@ -77,6 +86,10 @@ export default class ProviderPage {
|
||||||
firstLoginSwitch = "update-first-login";
|
firstLoginSwitch = "update-first-login";
|
||||||
passwordAuthSwitch = "allow-password-authentication";
|
passwordAuthSwitch = "allow-password-authentication";
|
||||||
|
|
||||||
|
// LDAP switch input values
|
||||||
|
enableStartTls = "enable-start-tls";
|
||||||
|
connectionPooling = "connection-pooling";
|
||||||
|
|
||||||
changeCacheTime(unit: string, time: string) {
|
changeCacheTime(unit: string, time: string) {
|
||||||
switch (unit) {
|
switch (unit) {
|
||||||
case "day":
|
case "day":
|
||||||
|
@ -107,15 +120,15 @@ export default class ProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCardFromCard(card: string) {
|
deleteCardFromCard(card: string) {
|
||||||
cy.get(`[data-testid=${card}-dropdown]`).click();
|
cy.findByTestId(`${card}-dropdown`).click();
|
||||||
cy.get('[data-testid="card-delete"]').click();
|
cy.findByTestId("card-delete").click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCardFromMenu(card: string) {
|
deleteCardFromMenu(card: string) {
|
||||||
this.clickExistingCard(card);
|
this.clickExistingCard(card);
|
||||||
cy.get('[data-testid="action-dropdown"]').click();
|
cy.findByTestId(this.actionDropdown).click();
|
||||||
cy.get(`[data-testid="delete-cmd"]`).click();
|
cy.findByTestId(this.deleteCmd).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,16 +139,16 @@ export default class ProviderPage {
|
||||||
keytab: string
|
keytab: string
|
||||||
) {
|
) {
|
||||||
if (name) {
|
if (name) {
|
||||||
cy.get(`[${this.kerberosNameInput}]`).type(name);
|
cy.findByTestId(this.kerberosNameInput).clear().type(name);
|
||||||
}
|
}
|
||||||
if (realm) {
|
if (realm) {
|
||||||
cy.get(`[${this.kerberosRealmInput}]`).type(realm);
|
cy.findByTestId(this.kerberosRealmInput).clear().type(realm);
|
||||||
}
|
}
|
||||||
if (principal) {
|
if (principal) {
|
||||||
cy.get(`[${this.kerberosPrincipalInput}]`).type(principal);
|
cy.findByTestId(this.kerberosPrincipalInput).clear().type(principal);
|
||||||
}
|
}
|
||||||
if (keytab) {
|
if (keytab) {
|
||||||
cy.get(`[${this.kerberosKeytabInput}]`).type(keytab);
|
cy.findByTestId(this.kerberosKeytabInput).clear().type(keytab);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -157,10 +170,16 @@ export default class ProviderPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillLdapRequiredGeneralData(name: string, vendor: string) {
|
verifyTextField(fieldName: string, value: string) {
|
||||||
if (name) {
|
cy.findByTestId(fieldName).should("have.value", value);
|
||||||
cy.get(`[${this.ldapNameInput}]`).clear().type(name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
verifySelect(selectInput: string, value: string) {
|
||||||
|
cy.get(selectInput).should("contain", value);
|
||||||
|
}
|
||||||
|
|
||||||
|
fillLdapGeneralData(name: string, vendor?: string) {
|
||||||
|
cy.findByTestId(this.ldapNameInput).clear().type(name);
|
||||||
if (vendor) {
|
if (vendor) {
|
||||||
cy.get(this.ldapVendorInput).click();
|
cy.get(this.ldapVendorInput).click();
|
||||||
cy.get(this.ldapVendorList).contains(vendor).click();
|
cy.get(this.ldapVendorList).contains(vendor).click();
|
||||||
|
@ -168,55 +187,62 @@ export default class ProviderPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillLdapRequiredConnectionData(
|
fillLdapConnectionData(
|
||||||
connectionUrl: string,
|
connectionUrl: string,
|
||||||
bindType: string,
|
bindType: string,
|
||||||
|
truststoreSpi?: string,
|
||||||
|
connectionTimeout?: string,
|
||||||
bindDn?: string,
|
bindDn?: string,
|
||||||
bindCreds?: string
|
bindCreds?: string
|
||||||
) {
|
) {
|
||||||
if (connectionUrl) {
|
cy.findByTestId(this.connectionUrlInput).clear().type(connectionUrl);
|
||||||
cy.get(`[${this.ldapConnectionUrlInput}]`).type(connectionUrl);
|
|
||||||
|
cy.get(this.bindTypeInput).click();
|
||||||
|
cy.get(this.bindTypeList).contains(bindType).click();
|
||||||
|
|
||||||
|
if (truststoreSpi) {
|
||||||
|
cy.get(this.truststoreSpiInput).click();
|
||||||
|
cy.get(this.truststoreSpiList).contains(truststoreSpi).click();
|
||||||
}
|
}
|
||||||
if (bindType) {
|
if (connectionTimeout) {
|
||||||
cy.get(this.ldapBindTypeInput).click();
|
cy.findByTestId(this.connectionTimeoutInput)
|
||||||
cy.get(this.ldapBindTypeList).contains(bindType).click();
|
.clear()
|
||||||
|
.type(connectionTimeout);
|
||||||
}
|
}
|
||||||
if (bindDn) {
|
if (bindDn) {
|
||||||
cy.get(`[${this.ldapBindDnInput}]`).type(bindDn);
|
cy.findByTestId(this.bindDnInput).clear().type(bindDn);
|
||||||
}
|
}
|
||||||
if (bindCreds) {
|
if (bindCreds) {
|
||||||
cy.get(`[${this.ldapBindCredsInput}]`).type(bindCreds);
|
cy.findByTestId(this.bindCredsInput).clear().type(bindCreds);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
fillLdapRequiredSearchingData(
|
fillLdapSearchingData(
|
||||||
editMode: string,
|
editMode: string,
|
||||||
usersDn: string,
|
usersDn: string,
|
||||||
userLdapAtt: string,
|
userLdapAtt?: string,
|
||||||
rdnLdapAtt: string,
|
rdnLdapAtt?: string,
|
||||||
uuidLdapAtt: string,
|
uuidLdapAtt?: string,
|
||||||
userObjClasses: string
|
userObjClasses?: string
|
||||||
) {
|
) {
|
||||||
if (editMode) {
|
|
||||||
cy.get(this.ldapEditModeInput).click();
|
cy.get(this.ldapEditModeInput).click();
|
||||||
cy.get(this.ldapEditModeList).contains(editMode).click();
|
cy.get(this.ldapEditModeList).contains(editMode).click();
|
||||||
}
|
|
||||||
|
|
||||||
if (usersDn) {
|
cy.findByTestId(this.ldapUsersDnInput).clear().type(usersDn);
|
||||||
cy.get(`[${this.ldapUsersDnInput}]`).type(usersDn);
|
|
||||||
}
|
|
||||||
if (userLdapAtt) {
|
if (userLdapAtt) {
|
||||||
cy.get(`[${this.ldapUserLdapAttInput}]`).type(userLdapAtt);
|
cy.findByTestId(this.ldapUserLdapAttInput).clear().type(userLdapAtt);
|
||||||
}
|
}
|
||||||
if (rdnLdapAtt) {
|
if (rdnLdapAtt) {
|
||||||
cy.get(`[${this.ldapRdnLdapAttInput}]`).type(rdnLdapAtt);
|
cy.findByTestId(this.ldapRdnLdapAttInput).clear().type(rdnLdapAtt);
|
||||||
}
|
}
|
||||||
if (uuidLdapAtt) {
|
if (uuidLdapAtt) {
|
||||||
cy.get(`[${this.ldapUuidLdapAttInput}]`).type(uuidLdapAtt);
|
cy.findByTestId(this.ldapUuidLdapAttInput).clear().type(uuidLdapAtt);
|
||||||
}
|
}
|
||||||
if (userObjClasses) {
|
if (userObjClasses) {
|
||||||
cy.get(`[${this.ldapUserObjClassesInput}]`).type(userObjClasses);
|
cy.findByTestId(this.ldapUserObjClassesInput)
|
||||||
|
.clear()
|
||||||
|
.type(userObjClasses);
|
||||||
}
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -228,17 +254,17 @@ export default class ProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
goToMappers() {
|
goToMappers() {
|
||||||
cy.get(`[data-testid="ldap-mappers-tab"]`).click();
|
cy.findByTestId(this.mappersTab).click();
|
||||||
}
|
}
|
||||||
|
|
||||||
createRole(roleName: string) {
|
createRole(roleName: string) {
|
||||||
cy.findByTestId(this.rolesTab).click();
|
cy.findByTestId(this.rolesTab).click();
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
cy.get(`[${this.createRoleBtn}]`).click();
|
cy.findByTestId(this.createRoleBtn).click();
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
cy.get(this.roleNameField).type(roleName);
|
cy.get(this.roleNameField).clear().type(roleName);
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
cy.get(`[${this.realmRolesSaveBtn}]`).click();
|
cy.findByTestId(this.realmRolesSaveBtn).click();
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +279,7 @@ export default class ProviderPage {
|
||||||
cy.get("#kc-providerId").click();
|
cy.get("#kc-providerId").click();
|
||||||
cy.get("button").contains(mapperType).click();
|
cy.get("button").contains(mapperType).click();
|
||||||
|
|
||||||
cy.get(`[data-testid="ldap-mapper-name"]`).type(`${mapperType}-test`);
|
cy.findByTestId("ldap-mapper-name").clear().type(`${mapperType}-test`);
|
||||||
|
|
||||||
switch (mapperType) {
|
switch (mapperType) {
|
||||||
case this.msadUserAcctMapper:
|
case this.msadUserAcctMapper:
|
||||||
|
@ -261,30 +287,31 @@ export default class ProviderPage {
|
||||||
break;
|
break;
|
||||||
case this.userAttLdapMapper:
|
case this.userAttLdapMapper:
|
||||||
case this.certLdapMapper:
|
case this.certLdapMapper:
|
||||||
cy.findByTestId(this.userModelAttInput).type(userModelAttValue);
|
cy.findByTestId(this.userModelAttInput).clear().type(userModelAttValue);
|
||||||
cy.findByTestId(this.ldapAttInput).type(ldapAttValue);
|
cy.findByTestId(this.ldapAttInput).clear().type(ldapAttValue);
|
||||||
break;
|
break;
|
||||||
case this.hcAttMapper:
|
case this.hcAttMapper:
|
||||||
cy.findByTestId(this.userModelAttNameInput).type(userModelAttValue);
|
cy.findByTestId(this.userModelAttNameInput)
|
||||||
cy.findByTestId(this.attValueInput).type(ldapAttValue);
|
.clear()
|
||||||
|
.type(userModelAttValue);
|
||||||
|
cy.findByTestId(this.attValueInput).clear().type(ldapAttValue);
|
||||||
break;
|
break;
|
||||||
case this.fullNameLdapMapper:
|
case this.fullNameLdapMapper:
|
||||||
cy.findByTestId(this.ldapFullNameAttInput).type(ldapAttValue);
|
cy.findByTestId(this.ldapFullNameAttInput).clear().type(ldapAttValue);
|
||||||
break;
|
break;
|
||||||
case this.hcLdapAttMapper:
|
case this.hcLdapAttMapper:
|
||||||
cy.findByTestId(this.ldapAttNameInput).type(userModelAttValue);
|
cy.findByTestId(this.ldapAttNameInput).clear().type(userModelAttValue);
|
||||||
cy.findByTestId(this.ldapAttValueInput).type(ldapAttValue);
|
cy.findByTestId(this.ldapAttValueInput).clear().type(ldapAttValue);
|
||||||
break;
|
break;
|
||||||
case this.hcLdapGroupMapper:
|
case this.hcLdapGroupMapper:
|
||||||
cy.findByTestId(this.groupInput).type(this.groupName);
|
cy.findByTestId(this.groupInput).clear().type(this.groupName);
|
||||||
break;
|
break;
|
||||||
case this.groupLdapMapper:
|
case this.groupLdapMapper:
|
||||||
cy.findByTestId(this.ldapGroupsDnInput).type(ldapDnValue);
|
cy.findByTestId(this.ldapGroupsDnInput).clear().type(ldapDnValue);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case this.roleLdapMapper:
|
case this.roleLdapMapper:
|
||||||
cy.findByTestId(this.ldapRolesDnInput).type(ldapDnValue);
|
cy.findByTestId(this.ldapRolesDnInput).clear().type(ldapDnValue);
|
||||||
// cy select clientID dropdown and choose clientName (var)
|
|
||||||
cy.get(this.clientIdSelect).click();
|
cy.get(this.clientIdSelect).click();
|
||||||
cy.get("button").contains(this.clientName).click({ force: true });
|
cy.get("button").contains(this.clientName).click({ force: true });
|
||||||
break;
|
break;
|
||||||
|
@ -300,7 +327,6 @@ export default class ProviderPage {
|
||||||
.get(".pf-c-select__menu-item")
|
.get(".pf-c-select__menu-item")
|
||||||
.first()
|
.first()
|
||||||
.click();
|
.click();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
console.log("Invalid mapper type.");
|
console.log("Invalid mapper type.");
|
||||||
|
@ -341,7 +367,7 @@ export default class ProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
clickExistingCard(cardName: string) {
|
clickExistingCard(cardName: string) {
|
||||||
cy.get('[data-testid="keycloak-card-title"]').contains(cardName).click();
|
cy.findByTestId("keycloak-card-title").contains(cardName).click();
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +379,7 @@ export default class ProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
clickNewCard(providerType: string) {
|
clickNewCard(providerType: string) {
|
||||||
cy.get(`[data-testid=${providerType}-card]`).click();
|
cy.findByTestId(`${providerType}-card`).click();
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -369,12 +395,22 @@ export default class ProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
save(providerType: string) {
|
save(providerType: string) {
|
||||||
cy.get(`[data-testid=${providerType}-save]`).click();
|
cy.findByTestId(`${providerType}-save`).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel(providerType: string) {
|
cancel(providerType: string) {
|
||||||
cy.get(`[data-testid=${providerType}-cancel]`).click();
|
cy.findByTestId(`${providerType}-cancel`).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
testConnection() {
|
||||||
|
cy.findByTestId(this.testConnectionBtn).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
testAuthorization() {
|
||||||
|
cy.findByTestId(this.testAuthBtn).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -154,6 +154,7 @@ export const LdapSettingsConnection = ({
|
||||||
render={({ onChange, value }) => (
|
render={({ onChange, value }) => (
|
||||||
<Switch
|
<Switch
|
||||||
id={"kc-enable-start-tls"}
|
id={"kc-enable-start-tls"}
|
||||||
|
data-testid="enable-start-tls"
|
||||||
isDisabled={false}
|
isDisabled={false}
|
||||||
onChange={(value) => onChange([`${value}`])}
|
onChange={(value) => onChange([`${value}`])}
|
||||||
isChecked={value[0] === "true"}
|
isChecked={value[0] === "true"}
|
||||||
|
@ -216,6 +217,7 @@ export const LdapSettingsConnection = ({
|
||||||
render={({ onChange, value }) => (
|
render={({ onChange, value }) => (
|
||||||
<Switch
|
<Switch
|
||||||
id={"kc-connection-pooling"}
|
id={"kc-connection-pooling"}
|
||||||
|
data-testid="connection-pooling"
|
||||||
isDisabled={false}
|
isDisabled={false}
|
||||||
onChange={(value) => onChange([`${value}`])}
|
onChange={(value) => onChange([`${value}`])}
|
||||||
isChecked={value[0] === "true"}
|
isChecked={value[0] === "true"}
|
||||||
|
@ -239,14 +241,16 @@ export const LdapSettingsConnection = ({
|
||||||
type="number"
|
type="number"
|
||||||
min={0}
|
min={0}
|
||||||
id="kc-console-connection-timeout"
|
id="kc-console-connection-timeout"
|
||||||
|
data-testid="connection-timeout"
|
||||||
name="config.connectionTimeout[0]"
|
name="config.connectionTimeout[0]"
|
||||||
ref={form.register}
|
ref={form.register}
|
||||||
/>
|
/>
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
<FormGroup fieldId="kc-test-button">
|
<FormGroup fieldId="kc-test-connection-button">
|
||||||
<Button
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
id="kc-connection-test-button"
|
id="kc-test-connection-button"
|
||||||
|
data-testid="test-connection-button"
|
||||||
onClick={() => testLdap("testConnection")}
|
onClick={() => testLdap("testConnection")}
|
||||||
>
|
>
|
||||||
{t("common:testConnection")}
|
{t("common:testConnection")}
|
||||||
|
@ -357,10 +361,11 @@ export const LdapSettingsConnection = ({
|
||||||
</FormGroup>
|
</FormGroup>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<FormGroup fieldId="kc-test-button">
|
<FormGroup fieldId="kc-test-auth-button">
|
||||||
<Button
|
<Button
|
||||||
variant="secondary"
|
variant="secondary"
|
||||||
id="kc-test-button"
|
id="kc-test-auth-button"
|
||||||
|
data-testid="test-auth-button"
|
||||||
onClick={() => testLdap("testAuthentication")}
|
onClick={() => testLdap("testAuthentication")}
|
||||||
>
|
>
|
||||||
{t("testAuthentication")}
|
{t("testAuthentication")}
|
||||||
|
|
Loading…
Reference in a new issue