group mapper and add del client tests working

This commit is contained in:
mfrances 2021-06-03 16:47:47 -04:00
parent c56b5dc7b9
commit f2ee537747
2 changed files with 80 additions and 17 deletions

View file

@ -3,6 +3,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage";
import ListingPage from "../support/pages/admin_console/ListingPage"; import ListingPage from "../support/pages/admin_console/ListingPage";
import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal"; import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal";
import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage"; import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage";
import CreateClientPage from "../support/pages/admin_console/manage/clients/CreateClientPage";
import Masthead from "../support/pages/admin_console/Masthead"; import Masthead from "../support/pages/admin_console/Masthead";
import ModalUtils from "../support/util/ModalUtils"; import ModalUtils from "../support/util/ModalUtils";
import { keycloakBefore } from "../support/util/keycloak_before"; import { keycloakBefore } from "../support/util/keycloak_before";
@ -12,6 +13,7 @@ const masthead = new Masthead();
const sidebarPage = new SidebarPage(); const sidebarPage = new SidebarPage();
const listingPage = new ListingPage(); const listingPage = new ListingPage();
const groupModal = new GroupModal(); const groupModal = new GroupModal();
const createClientPage = new CreateClientPage();
const providersPage = new ProviderPage(); const providersPage = new ProviderPage();
const modalUtils = new ModalUtils(); const modalUtils = new ModalUtils();
@ -41,8 +43,12 @@ const providerDeleteSuccess = "The user federation provider has been deleted.";
const providerDeleteTitle = "Delete user federation provider?"; const providerDeleteTitle = "Delete user federation provider?";
const mapperDeletedSuccess = "Mapping successfully deleted"; const mapperDeletedSuccess = "Mapping successfully deleted";
const mapperDeleteTitle = "Delete mapping?"; const mapperDeleteTitle = "Delete mapping?";
const groupCreatedSuccess = "Group created";
const groupName = "my-mappers-group"; const groupDeletedSuccess = "Group deleted";
const clientCreatedSuccess = "Client created successfully";
const clientDeletedSuccess = "The client has been deleted";
const groupName = "aa-uf-mappers-group";
const clientName = "aa-uf-mappers-client";
// mapperType variables // mapperType variables
const msadUserAcctMapper = "msad-user-account-control-mapper"; const msadUserAcctMapper = "msad-user-account-control-mapper";
@ -53,9 +59,12 @@ const certLdapMapper = "certificate-ldap-mapper";
const fullNameLdapMapper = "full-name-ldap-mapper"; const fullNameLdapMapper = "full-name-ldap-mapper";
const hcLdapGroupMapper = "hardcoded-ldap-group-mapper"; const hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
const hcLdapAttMapper = "hardcoded-ldap-attribute-mapper"; const hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
// const groupLdapMapper = "group-ldap-mapper";
// const roleMapper = "role-ldap-mapper"; const groupLdapMapper = "group-ldap-mapper";
// const hcLdapRoleMapper = "hardcoded-ldap-role-mapper"; /*
const roleMapper = "role-ldap-mapper";
const hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
*/
const creationDateMapper = "creation date"; const creationDateMapper = "creation date";
const emailMapper = "email"; const emailMapper = "email";
@ -111,7 +120,22 @@ describe("User Fed LDAP mapper tests", () => {
.fillGroupForm(groupName) .fillGroupForm(groupName)
.clickCreate(); .clickCreate();
masthead.checkNotificationMessage("Group created"); masthead.checkNotificationMessage(groupCreatedSuccess);
});
// create a new client
it("Create client", () => {
sidebarPage.goToClients();
listingPage.goToCreateItem();
createClientPage
.selectClientType("openid-connect")
.fillClientData(clientName)
.continue()
.continue();
masthead.checkNotificationMessage(clientCreatedSuccess);
sidebarPage.goToClients();
listingPage.searchItem(clientName).itemExist(clientName);
}); });
// delete default mappers // delete default mappers
@ -156,6 +180,7 @@ describe("User Fed LDAP mapper tests", () => {
masthead.checkNotificationMessage(mapperDeletedSuccess); masthead.checkNotificationMessage(mapperDeletedSuccess);
}); });
// mapper CRUD tests
// create mapper // create mapper
it("Create certificate ldap mapper", () => { it("Create certificate ldap mapper", () => {
providersPage.clickExistingCard(ldapName); providersPage.clickExistingCard(ldapName);
@ -188,7 +213,7 @@ describe("User Fed LDAP mapper tests", () => {
masthead.checkNotificationMessage(mapperDeletedSuccess); masthead.checkNotificationMessage(mapperDeletedSuccess);
}); });
// create one of every kind of non-group/role mapper (8) // create one of each mapper type
it("Create user account control mapper", () => { it("Create user account control mapper", () => {
providersPage.clickExistingCard(ldapName); providersPage.clickExistingCard(ldapName);
providersPage.goToMappers(); providersPage.goToMappers();
@ -261,17 +286,52 @@ describe("User Fed LDAP mapper tests", () => {
listingPage.itemExist(hcLdapAttMapper, true); listingPage.itemExist(hcLdapAttMapper, true);
}); });
// *** test cleanup *** /* COMING SOON
it("Cleanup - delete group", () => { it("Create hardcoded ldap role mapper", () => {
sidebarPage.goToGroups(); providersPage.clickExistingCard(ldapName);
listingPage.deleteItem(groupName); providersPage.goToMappers();
modalUtils.confirmModal(); providersPage.createNewMapper(hcLdapRoleMapper);
masthead.checkNotificationMessage("Group deleted"); 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();
providersPage.createNewMapper(groupLdapMapper);
providersPage.save("ldap-mapper");
masthead.checkNotificationMessage(mapperCreatedSuccess);
listingPage.itemExist(groupLdapMapper, true);
});
// *** test cleanup ***
it("Cleanup - delete LDAP provider", () => { it("Cleanup - delete LDAP provider", () => {
providersPage.deleteCardFromMenu(provider, ldapName); providersPage.deleteCardFromMenu(provider, ldapName);
modalUtils.checkModalTitle(providerDeleteTitle).confirmModal(); modalUtils.checkModalTitle(providerDeleteTitle).confirmModal();
masthead.checkNotificationMessage(providerDeleteSuccess); masthead.checkNotificationMessage(providerDeleteSuccess);
}); });
it("Cleanup - delete group", () => {
sidebarPage.goToGroups();
listingPage.deleteItem(groupName);
masthead.checkNotificationMessage(groupDeletedSuccess);
});
it("Cleanup - delete client", () => {
sidebarPage.goToClients();
listingPage.deleteItem(clientName);
modalUtils.checkModalTitle(`Delete ${clientName} ?`).confirmModal();
masthead.checkNotificationMessage(clientDeletedSuccess);
});
}); });

View file

@ -44,6 +44,7 @@ export default class ProviderPage {
private ldapAttNameInput = "data-testid=mapper-ldapAttributeName-fld"; private ldapAttNameInput = "data-testid=mapper-ldapAttributeName-fld";
private ldapAttValueInput = "data-testid=mapper-ldapAttributeValue-fld"; private ldapAttValueInput = "data-testid=mapper-ldapAttributeValue-fld";
private groupInput = "data-testid=mapper-group-fld"; private groupInput = "data-testid=mapper-group-fld";
private ldapDnInput = "data-testid=ldap-dn";
// mapper types // mapper types
private msadUserAcctMapper = "msad-user-account-control-mapper"; private msadUserAcctMapper = "msad-user-account-control-mapper";
@ -54,11 +55,11 @@ export default class ProviderPage {
private fullNameLdapMapper = "full-name-ldap-mapper"; private fullNameLdapMapper = "full-name-ldap-mapper";
private hcLdapAttMapper = "hardcoded-ldap-attribute-mapper"; private hcLdapAttMapper = "hardcoded-ldap-attribute-mapper";
private hcLdapGroupMapper = "hardcoded-ldap-group-mapper"; private hcLdapGroupMapper = "hardcoded-ldap-group-mapper";
// this.groupLdapMapper = "group-ldap-mapper"; private groupLdapMapper = "group-ldap-mapper";
// this.roleMapper = "role-ldap-mapper"; // this.roleMapper = "role-ldap-mapper";
// this.hcLdapRoleMapper = "hardcoded-ldap-role-mapper"; // this.hcLdapRoleMapper = "hardcoded-ldap-role-mapper";
private groupName = "my-mappers-group"; private groupName = "aa-uf-mappers-group";
changeCacheTime(unit: string, time: string) { changeCacheTime(unit: string, time: string) {
switch (unit) { switch (unit) {
@ -186,6 +187,7 @@ export default class ProviderPage {
createNewMapper(mapperType: string) { createNewMapper(mapperType: string) {
const userModelAttValue = "firstName"; const userModelAttValue = "firstName";
const ldapAttValue = "cn"; const ldapAttValue = "cn";
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);
@ -218,8 +220,9 @@ export default class ProviderPage {
case this.hcLdapGroupMapper: case this.hcLdapGroupMapper:
cy.get(`[${this.groupInput}]`).type(this.groupName); cy.get(`[${this.groupInput}]`).type(this.groupName);
break; break;
// case this.groupLdapMapper: case this.groupLdapMapper:
// break; cy.get(`[${this.ldapDnInput}]`).type(ldapDnValue);
break;
// case this.roleMapper: // case this.roleMapper:
// break; // break;
// case this.hcLdapRoleMapper: // case this.hcLdapRoleMapper: