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

View file

@ -56,10 +56,27 @@ export default class ProviderPage {
private hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
private hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
private groupLdapMapper = "group-ldap-mapper";
// this.roleMapper = "role-ldap-mapper";
// this.hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
private roleLdapMapper = "role-ldap-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 clientName = "aa-uf-mappers-client";
private roleName = "aa-uf-mappers-role";
changeCacheTime(unit: string, time: string) {
switch (unit) {
@ -184,10 +201,21 @@ export default class ProviderPage {
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) {
const userModelAttValue = "firstName";
const ldapAttValue = "cn";
const ldapDnValue = "ou=groups"
const ldapDnValue = "ou=groups";
cy.get(`[data-testid="add-mapper-btn"]`).click();
cy.wait(1000);
@ -223,10 +251,26 @@ export default class ProviderPage {
case this.groupLdapMapper:
cy.get(`[${this.ldapDnInput}]`).type(ldapDnValue);
break;
// case this.roleMapper:
// break;
// case this.hcLdapRoleMapper:
// break;
case this.roleLdapMapper:
cy.get(`[${this.ldapDnInput}]`).type(ldapDnValue);
// 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:
console.log("Invalid mapper type.");
break;
@ -264,14 +308,6 @@ export default class ProviderPage {
cy.get(`[${this.ldapAttValueInput}]`).clear;
cy.get(`[${this.ldapAttValueInput}]`).type(ldapAttValue);
break;
// case this.hcLdapGroupMapper:
// break;
// case this.groupLdapMapper:
// break;
// case this.roleMapper:
// break;
// case this.hcLdapRoleMapper:
// break;
default:
console.log("Invalid mapper name.");
break;