all user fed mappers tests passing

This commit is contained in:
mfrances 2021-06-04 12:33:38 -04:00
parent f2ee537747
commit 4bf8930cd4
2 changed files with 78 additions and 42 deletions

View file

@ -47,8 +47,10 @@ const groupCreatedSuccess = "Group created";
const groupDeletedSuccess = "Group deleted"; const groupDeletedSuccess = "Group deleted";
const clientCreatedSuccess = "Client created successfully"; const clientCreatedSuccess = "Client created successfully";
const clientDeletedSuccess = "The client has been deleted"; const clientDeletedSuccess = "The client has been deleted";
const roleCreatedSuccess = "Role created";
const groupName = "aa-uf-mappers-group"; const groupName = "aa-uf-mappers-group";
const clientName = "aa-uf-mappers-client"; const clientName = "aa-uf-mappers-client";
const roleName = "aa-uf-mappers-role";
// mapperType variables // mapperType variables
const msadUserAcctMapper = "msad-user-account-control-mapper"; const msadUserAcctMapper = "msad-user-account-control-mapper";
@ -61,10 +63,8 @@ const hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
const hcLdapAttMapper = "hardcoded-ldap-attribute-mapper"; const hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
const groupLdapMapper = "group-ldap-mapper"; const groupLdapMapper = "group-ldap-mapper";
/* const roleLdapMapper = "role-ldap-mapper";
const roleMapper = "role-ldap-mapper";
const hcLdapRoleMapper = "hardcoded-ldap-role-mapper"; const hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
*/
const creationDateMapper = "creation date"; const creationDateMapper = "creation date";
const emailMapper = "email"; const emailMapper = "email";
@ -105,9 +105,7 @@ describe("User Fed LDAP mapper tests", () => {
firstUuidLdapAtt, firstUuidLdapAtt,
firstUserObjClasses firstUserObjClasses
); );
providersPage.save(provider); providersPage.save(provider);
masthead.checkNotificationMessage(providerCreatedSuccess); masthead.checkNotificationMessage(providerCreatedSuccess);
sidebarPage.goToUserFederation(); sidebarPage.goToUserFederation();
}); });
@ -123,8 +121,8 @@ describe("User Fed LDAP mapper tests", () => {
masthead.checkNotificationMessage(groupCreatedSuccess); masthead.checkNotificationMessage(groupCreatedSuccess);
}); });
// create a new client // create a new client and then new role for that client
it("Create client", () => { it("Create client and role", () => {
sidebarPage.goToClients(); sidebarPage.goToClients();
listingPage.goToCreateItem(); listingPage.goToCreateItem();
createClientPage createClientPage
@ -134,6 +132,10 @@ describe("User Fed LDAP mapper tests", () => {
.continue(); .continue();
masthead.checkNotificationMessage(clientCreatedSuccess); masthead.checkNotificationMessage(clientCreatedSuccess);
providersPage.createRole(roleName);
masthead.checkNotificationMessage(roleCreatedSuccess);
sidebarPage.goToClients(); sidebarPage.goToClients();
listingPage.searchItem(clientName).itemExist(clientName); listingPage.searchItem(clientName).itemExist(clientName);
}); });
@ -286,26 +288,6 @@ describe("User Fed LDAP mapper tests", () => {
listingPage.itemExist(hcLdapAttMapper, true); listingPage.itemExist(hcLdapAttMapper, true);
}); });
/* COMING SOON
it("Create hardcoded ldap role mapper", () => {
providersPage.clickExistingCard(ldapName);
providersPage.goToMappers();
providersPage.createNewMapper(hcLdapRoleMapper);
providersPage.save("ldap-mapper");
masthead.checkNotificationMessage(mapperCreatedSuccess);
listingPage.itemExist(hcLdapRoleMapper, true);
});
it("Create role ldap mapper", () => {
providersPage.clickExistingCard(ldapName);
providersPage.goToMappers();
providersPage.createNewMapper(roleMapper);
providersPage.save("ldap-mapper");
masthead.checkNotificationMessage(mapperCreatedSuccess);
listingPage.itemExist(roleMapper, true);
});
*/
it("Create group ldap mapper", () => { it("Create group ldap mapper", () => {
providersPage.clickExistingCard(ldapName); providersPage.clickExistingCard(ldapName);
providersPage.goToMappers(); providersPage.goToMappers();
@ -313,6 +295,24 @@ describe("User Fed LDAP mapper tests", () => {
providersPage.save("ldap-mapper"); providersPage.save("ldap-mapper");
masthead.checkNotificationMessage(mapperCreatedSuccess); masthead.checkNotificationMessage(mapperCreatedSuccess);
listingPage.itemExist(groupLdapMapper, true); listingPage.itemExist(groupLdapMapper, true);
it("Create hardcoded ldap role mapper", () => {
providersPage.clickExistingCard(ldapName);
providersPage.goToMappers();
providersPage.createNewMapper(hcLdapRoleMapper);
providersPage.save("ldap-mapper");
masthead.checkNotificationMessage(mapperCreatedSuccess);
listingPage.itemExist(hcLdapRoleMapper, true);
});
it("Create role ldap mapper", () => {
providersPage.clickExistingCard(ldapName);
providersPage.goToMappers();
providersPage.createNewMapper(roleLdapMapper);
providersPage.save("ldap-mapper");
masthead.checkNotificationMessage(mapperCreatedSuccess);
listingPage.itemExist(roleLdapMapper, true);
});
}); });
// *** test cleanup *** // *** test cleanup ***

View file

@ -56,10 +56,27 @@ export default class ProviderPage {
private hcLdapAttMapper = "hardcoded-ldap-attribute-mapper"; private hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
private hcLdapGroupMapper = "hardcoded-ldap-group-mapper"; private hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
private groupLdapMapper = "group-ldap-mapper"; private groupLdapMapper = "group-ldap-mapper";
// this.roleMapper = "role-ldap-mapper"; private roleLdapMapper = "role-ldap-mapper";
// this.hcLdapRoleMapper = "hardcoded-ldap-role-mapper"; private hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
private tab = "#pf-tab-serviceAccount-serviceAccount";
private scopeTab = "scopeTab";
private assignRole = "assignRole";
private unAssign = "unAssignRole";
private assign = "assign";
private hide = "#hideInheritedRoles";
private assignedRolesTable = "assigned-roles";
private namesColumn = 'td[data-label="Name"]:visible';
private rolesTab = "#pf-tab-roles-roles";
private createRoleBtn = "data-testid=empty-primary-action";
private realmRolesSaveBtn = "data-testid=realm-roles-save-button";
private roleNameField = "#kc-name";
private clientIdSelect = "#kc-client-id";
private groupName = "aa-uf-mappers-group"; private groupName = "aa-uf-mappers-group";
private clientName = "aa-uf-mappers-client";
private roleName = "aa-uf-mappers-role";
changeCacheTime(unit: string, time: string) { changeCacheTime(unit: string, time: string) {
switch (unit) { switch (unit) {
@ -184,10 +201,21 @@ export default class ProviderPage {
cy.get(`[data-testid="ldap-mappers-tab"]`).click(); cy.get(`[data-testid="ldap-mappers-tab"]`).click();
} }
createRole(roleName: string) {
cy.get(this.rolesTab).click();
cy.wait(1000);
cy.get(`[${this.createRoleBtn}]`).click();
cy.wait(1000);
cy.get(this.roleNameField).type(roleName);
cy.wait(1000);
cy.get(`[${this.realmRolesSaveBtn}]`).click();
cy.wait(1000);
}
createNewMapper(mapperType: string) { createNewMapper(mapperType: string) {
const userModelAttValue = "firstName"; const userModelAttValue = "firstName";
const ldapAttValue = "cn"; const ldapAttValue = "cn";
const ldapDnValue = "ou=groups" const ldapDnValue = "ou=groups";
cy.get(`[data-testid="add-mapper-btn"]`).click(); cy.get(`[data-testid="add-mapper-btn"]`).click();
cy.wait(1000); cy.wait(1000);
@ -223,10 +251,26 @@ export default class ProviderPage {
case this.groupLdapMapper: case this.groupLdapMapper:
cy.get(`[${this.ldapDnInput}]`).type(ldapDnValue); cy.get(`[${this.ldapDnInput}]`).type(ldapDnValue);
break; break;
// case this.roleMapper:
// break; case this.roleLdapMapper:
// case this.hcLdapRoleMapper: cy.get(`[${this.ldapDnInput}]`).type(ldapDnValue);
// break; // cy select clientID dropdown and choose clientName (var)
cy.get(this.clientIdSelect).click();
cy.get("button").contains(this.clientName).click({ force: true });
break;
case this.hcLdapRoleMapper:
cy.get(`[data-testid="selectRole"]`).click();
cy.wait(2000);
cy.get(this.namesColumn)
.contains(this.clientName)
.parent()
.parent()
.within(() => {
cy.get('input[name="radioGroup"]').click();
});
cy.getId(this.assign).click();
break;
default: default:
console.log("Invalid mapper type."); console.log("Invalid mapper type.");
break; break;
@ -264,14 +308,6 @@ export default class ProviderPage {
cy.get(`[${this.ldapAttValueInput}]`).clear; cy.get(`[${this.ldapAttValueInput}]`).clear;
cy.get(`[${this.ldapAttValueInput}]`).type(ldapAttValue); cy.get(`[${this.ldapAttValueInput}]`).type(ldapAttValue);
break; break;
// case this.hcLdapGroupMapper:
// break;
// case this.groupLdapMapper:
// break;
// case this.roleMapper:
// break;
// case this.hcLdapRoleMapper:
// break;
default: default:
console.log("Invalid mapper name."); console.log("Invalid mapper name.");
break; break;