big refactor of cypress tests and consolidate into one page object
This commit is contained in:
parent
40eb3ede0d
commit
df0133896e
4 changed files with 118 additions and 195 deletions
|
@ -1,15 +1,18 @@
|
||||||
import LoginPage from "../support/pages/LoginPage";
|
import LoginPage from "../support/pages/LoginPage";
|
||||||
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
||||||
import CreateKerberosProviderPage from "../support/pages/admin_console/manage/providers/CreateKerberosProviderPage";
|
import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage";
|
||||||
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";
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const masthead = new Masthead();
|
const masthead = new Masthead();
|
||||||
const sidebarPage = new SidebarPage();
|
const sidebarPage = new SidebarPage();
|
||||||
const providersPage = new CreateKerberosProviderPage();
|
const providersPage = new ProviderPage();
|
||||||
const modalUtils = new ModalUtils();
|
const modalUtils = new ModalUtils();
|
||||||
|
|
||||||
|
const provider = "kerberos";
|
||||||
|
const initCapProvider = provider.charAt(0).toUpperCase() + provider.slice(1);
|
||||||
|
|
||||||
const firstKerberosName = "my-kerberos";
|
const firstKerberosName = "my-kerberos";
|
||||||
const firstKerberosRealm = "my-realm";
|
const firstKerberosRealm = "my-realm";
|
||||||
const firstKerberosPrincipal = "my-principal";
|
const firstKerberosPrincipal = "my-principal";
|
||||||
|
@ -29,6 +32,7 @@ const newKerberosDay = "Wednesday";
|
||||||
const newKerberosHour = "15";
|
const newKerberosHour = "15";
|
||||||
const newKerberosMinute = "55";
|
const newKerberosMinute = "55";
|
||||||
|
|
||||||
|
const addProviderMenu = "Add new provider";
|
||||||
const createdSuccessMessage = "User federation provider successfully created";
|
const createdSuccessMessage = "User federation provider successfully created";
|
||||||
const savedSuccessMessage = "User federation provider successfully saved";
|
const savedSuccessMessage = "User federation provider successfully saved";
|
||||||
const deletedSuccessMessage = "The user federation provider has been deleted.";
|
const deletedSuccessMessage = "The user federation provider has been deleted.";
|
||||||
|
@ -52,14 +56,14 @@ describe("User Fed Kerberos tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Create Kerberos provider from empty state", () => {
|
it("Create Kerberos provider from empty state", () => {
|
||||||
providersPage.clickNewCard("kerberos");
|
providersPage.clickNewCard(provider);
|
||||||
providersPage.fillKerberosRequiredData(
|
providersPage.fillKerberosRequiredData(
|
||||||
firstKerberosName,
|
firstKerberosName,
|
||||||
firstKerberosRealm,
|
firstKerberosRealm,
|
||||||
firstKerberosPrincipal,
|
firstKerberosPrincipal,
|
||||||
firstKerberosKeytab
|
firstKerberosKeytab
|
||||||
);
|
);
|
||||||
providersPage.save();
|
providersPage.save(provider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
@ -68,10 +72,10 @@ describe("User Fed Kerberos tests", () => {
|
||||||
it("Update an existing Kerberos provider and save", () => {
|
it("Update an existing Kerberos provider and save", () => {
|
||||||
providersPage.clickExistingCard(firstKerberosName);
|
providersPage.clickExistingCard(firstKerberosName);
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
providersPage.changeTime(defaultKerberosDay, newKerberosDay);
|
providersPage.changeCacheTime("day", newKerberosDay);
|
||||||
providersPage.changeTime(defaultKerberosHour, newKerberosHour);
|
providersPage.changeCacheTime("hour", newKerberosHour);
|
||||||
providersPage.changeTime(defaultKerberosMinute, newKerberosMinute);
|
providersPage.changeCacheTime("minute", newKerberosMinute);
|
||||||
providersPage.save();
|
providersPage.save(provider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
@ -84,12 +88,10 @@ describe("User Fed Kerberos tests", () => {
|
||||||
it("Change existing Kerberos provider and click button to cancel", () => {
|
it("Change existing Kerberos provider and click button to cancel", () => {
|
||||||
providersPage.clickExistingCard(firstKerberosName);
|
providersPage.clickExistingCard(firstKerberosName);
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
providersPage.changeCacheTime("day", defaultKerberosDay);
|
||||||
providersPage.changeTime(newKerberosDay, defaultKerberosDay);
|
providersPage.changeCacheTime("hour", defaultKerberosHour);
|
||||||
providersPage.changeTime(newKerberosHour, defaultKerberosHour);
|
providersPage.changeCacheTime("minute", defaultKerberosMinute);
|
||||||
providersPage.changeTime(newKerberosMinute, defaultKerberosMinute);
|
providersPage.cancel(provider);
|
||||||
|
|
||||||
providersPage.cancel();
|
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
||||||
providersPage.clickExistingCard(firstKerberosName);
|
providersPage.clickExistingCard(firstKerberosName);
|
||||||
|
@ -105,7 +107,7 @@ describe("User Fed Kerberos tests", () => {
|
||||||
|
|
||||||
it("Disable an existing Kerberos provider", () => {
|
it("Disable an existing Kerberos provider", () => {
|
||||||
providersPage.clickExistingCard(firstKerberosName);
|
providersPage.clickExistingCard(firstKerberosName);
|
||||||
providersPage.disableEnabledSwitch();
|
providersPage.disableEnabledSwitch(initCapProvider);
|
||||||
|
|
||||||
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
||||||
|
|
||||||
|
@ -119,7 +121,7 @@ describe("User Fed Kerberos tests", () => {
|
||||||
|
|
||||||
it("Enable an existing previously-disabled Kerberos provider", () => {
|
it("Enable an existing previously-disabled Kerberos provider", () => {
|
||||||
providersPage.clickExistingCard(firstKerberosName);
|
providersPage.clickExistingCard(firstKerberosName);
|
||||||
providersPage.enableEnabledSwitch();
|
providersPage.enableEnabledSwitch(initCapProvider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
|
@ -128,7 +130,7 @@ describe("User Fed Kerberos tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Create new Kerberos provider using the New Provider dropdown", () => {
|
it("Create new Kerberos provider using the New Provider dropdown", () => {
|
||||||
providersPage.clickMenuCommand("Add new provider", "Kerberos");
|
providersPage.clickMenuCommand(addProviderMenu, initCapProvider);
|
||||||
|
|
||||||
providersPage.fillKerberosRequiredData(
|
providersPage.fillKerberosRequiredData(
|
||||||
secondKerberosName,
|
secondKerberosName,
|
||||||
|
@ -136,7 +138,7 @@ describe("User Fed Kerberos tests", () => {
|
||||||
secondKerberosPrincipal,
|
secondKerberosPrincipal,
|
||||||
secondKerberosKeytab
|
secondKerberosKeytab
|
||||||
);
|
);
|
||||||
providersPage.save();
|
providersPage.save(provider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
@ -150,7 +152,7 @@ describe("User Fed Kerberos tests", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Delete a Kerberos provider using the Settings view's Action menu", () => {
|
it("Delete a Kerberos provider using the Settings view's Action menu", () => {
|
||||||
providersPage.deleteCardFromMenu("kerberos", firstKerberosName);
|
providersPage.deleteCardFromMenu(provider, firstKerberosName);
|
||||||
|
|
||||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||||
|
|
|
@ -1,15 +1,18 @@
|
||||||
import LoginPage from "../support/pages/LoginPage";
|
import LoginPage from "../support/pages/LoginPage";
|
||||||
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
import SidebarPage from "../support/pages/admin_console/SidebarPage";
|
||||||
import CreateLdapProviderPage from "../support/pages/admin_console/manage/providers/CreateLdapProviderPage";
|
import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage";
|
||||||
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";
|
||||||
|
|
||||||
const loginPage = new LoginPage();
|
const loginPage = new LoginPage();
|
||||||
const masthead = new Masthead();
|
const masthead = new Masthead();
|
||||||
const sidebarPage = new SidebarPage();
|
const sidebarPage = new SidebarPage();
|
||||||
const providersPage = new CreateLdapProviderPage();
|
const providersPage = new ProviderPage();
|
||||||
const modalUtils = new ModalUtils();
|
const modalUtils = new ModalUtils();
|
||||||
|
|
||||||
|
const provider = "ldap";
|
||||||
|
const allCapProvider = provider.toUpperCase();
|
||||||
|
|
||||||
const firstLdapName = "my-ldap";
|
const firstLdapName = "my-ldap";
|
||||||
const firstLdapVendor = "Active Directory";
|
const firstLdapVendor = "Active Directory";
|
||||||
|
|
||||||
|
@ -85,7 +88,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
firstUserObjClasses
|
firstUserObjClasses
|
||||||
);
|
);
|
||||||
|
|
||||||
providersPage.save();
|
providersPage.save(provider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
@ -95,11 +98,11 @@ describe("User Fed LDAP tests", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
providersPage.changeTime(defaultLdapDay, newLdapDay);
|
providersPage.changeCacheTime("day", newLdapDay);
|
||||||
providersPage.changeTime(defaultLdapHour, newLdapHour);
|
providersPage.changeCacheTime("hour", newLdapHour);
|
||||||
providersPage.changeTime(defaultLdapMinute, newLdapMinute);
|
providersPage.changeCacheTime("minute", newLdapMinute);
|
||||||
|
|
||||||
providersPage.save();
|
providersPage.save(provider);
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
|
@ -113,11 +116,11 @@ describe("User Fed LDAP tests", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
providersPage.selectCacheType(newPolicy);
|
providersPage.selectCacheType(newPolicy);
|
||||||
|
|
||||||
providersPage.changeTime(newLdapDay, defaultLdapDay);
|
providersPage.changeCacheTime("day", defaultLdapDay);
|
||||||
providersPage.changeTime(newLdapHour, defaultLdapHour);
|
providersPage.changeCacheTime("hour", defaultLdapHour);
|
||||||
providersPage.changeTime(newLdapMinute, defaultLdapMinute);
|
providersPage.changeCacheTime("minute", defaultLdapMinute);
|
||||||
|
|
||||||
providersPage.cancel();
|
providersPage.cancel(provider);
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
|
@ -133,7 +136,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
|
|
||||||
it("Disable an existing LDAP provider", () => {
|
it("Disable an existing LDAP provider", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
providersPage.disableEnabledSwitch();
|
providersPage.disableEnabledSwitch(allCapProvider);
|
||||||
|
|
||||||
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
||||||
|
|
||||||
|
@ -147,7 +150,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
|
|
||||||
it("Enable an existing previously-disabled LDAP provider", () => {
|
it("Enable an existing previously-disabled LDAP provider", () => {
|
||||||
providersPage.clickExistingCard(firstLdapName);
|
providersPage.clickExistingCard(firstLdapName);
|
||||||
providersPage.enableEnabledSwitch();
|
providersPage.enableEnabledSwitch(allCapProvider);
|
||||||
|
|
||||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||||
|
|
||||||
|
@ -171,7 +174,7 @@ describe("User Fed LDAP tests", () => {
|
||||||
secondUuidLdapAtt,
|
secondUuidLdapAtt,
|
||||||
secondUserObjClasses
|
secondUserObjClasses
|
||||||
);
|
);
|
||||||
providersPage.save();
|
providersPage.save(provider);
|
||||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||||
sidebarPage.goToUserFederation();
|
sidebarPage.goToUserFederation();
|
||||||
});
|
});
|
||||||
|
@ -183,7 +186,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(provider, firstLdapName);
|
||||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,128 +0,0 @@
|
||||||
export default class CreateKerberosProviderPage {
|
|
||||||
kerberosNameInput: string;
|
|
||||||
kerberosRealmInput: string;
|
|
||||||
kerberosPrincipalInput: string;
|
|
||||||
kerberosKeytabInput: string;
|
|
||||||
|
|
||||||
kerberosEnabledInput: string;
|
|
||||||
|
|
||||||
kerberosCacheDayInput: string;
|
|
||||||
kerberosCacheDayList: string;
|
|
||||||
kerberosCacheHourInput: string;
|
|
||||||
kerberosCacheHourList: string;
|
|
||||||
kerberosCacheMinuteInput: string;
|
|
||||||
kerberosCacheMinuteList: string;
|
|
||||||
kerberosCachePolicyInput: string;
|
|
||||||
kerberosCachePolicyList: string;
|
|
||||||
|
|
||||||
saveBtn: string;
|
|
||||||
cancelBtn: string;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
// KerberosSettingsRequired required input values
|
|
||||||
this.kerberosNameInput = "data-testid=kerberos-name";
|
|
||||||
this.kerberosRealmInput = "data-testid=kerberos-realm";
|
|
||||||
this.kerberosPrincipalInput = "data-testid=kerberos-principal";
|
|
||||||
this.kerberosKeytabInput = "data-testid=kerberos-keytab";
|
|
||||||
|
|
||||||
// SettingsCache input values
|
|
||||||
this.kerberosCacheDayInput = "#kc-eviction-day";
|
|
||||||
this.kerberosCacheDayList = "#kc-eviction-day + ul";
|
|
||||||
this.kerberosCacheHourInput = "#kc-eviction-hour";
|
|
||||||
this.kerberosCacheHourList = "#kc-eviction-hour + ul";
|
|
||||||
this.kerberosCacheMinuteInput = "#kc-eviction-minute";
|
|
||||||
this.kerberosCacheMinuteList = "#kc-eviction-minute + ul";
|
|
||||||
this.kerberosCachePolicyInput = "#kc-cache-policy";
|
|
||||||
this.kerberosCachePolicyList = "#kc-cache-policy + ul";
|
|
||||||
|
|
||||||
// Kerberos settings enabled switch
|
|
||||||
this.kerberosEnabledInput = "#Kerberos-switch";
|
|
||||||
|
|
||||||
// Kerberos action buttons
|
|
||||||
this.saveBtn = "data-testid=kerberos-save";
|
|
||||||
this.cancelBtn = "data-testid=kerberos-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(providerType: string, card: string) {
|
|
||||||
this.clickExistingCard(card);
|
|
||||||
cy.get('[data-testid="action-dropdown"]').click();
|
|
||||||
cy.get(`[data-testid="delete-${providerType}-cmd"]`).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Required fields - these always must be filled out when testing a save
|
|
||||||
fillKerberosRequiredData(
|
|
||||||
name: string,
|
|
||||||
realm: string,
|
|
||||||
principal: string,
|
|
||||||
keytab: string
|
|
||||||
) {
|
|
||||||
if (name) {
|
|
||||||
cy.get(`[${this.kerberosNameInput}]`).type(name);
|
|
||||||
}
|
|
||||||
if (realm) {
|
|
||||||
cy.get(`[${this.kerberosRealmInput}]`).type(realm);
|
|
||||||
}
|
|
||||||
if (principal) {
|
|
||||||
cy.get(`[${this.kerberosPrincipalInput}]`).type(principal);
|
|
||||||
}
|
|
||||||
if (keytab) {
|
|
||||||
cy.get(`[${this.kerberosKeytabInput}]`).type(keytab);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectCacheType(cacheType: string) {
|
|
||||||
cy.get(this.kerberosCachePolicyInput).click();
|
|
||||||
cy.get(this.kerberosCachePolicyList).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.kerberosEnabledInput).uncheck({ force: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
enableEnabledSwitch() {
|
|
||||||
cy.get(this.kerberosEnabledInput).check({ force: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
save() {
|
|
||||||
cy.get(`[${this.saveBtn}]`).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
cancel() {
|
|
||||||
cy.get(`[${this.cancelBtn}]`).click();
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,4 +1,9 @@
|
||||||
export default class CreateLdapProviderPage {
|
export default class ProviderPage {
|
||||||
|
kerberosNameInput: string;
|
||||||
|
kerberosRealmInput: string;
|
||||||
|
kerberosPrincipalInput: string;
|
||||||
|
kerberosKeytabInput: string;
|
||||||
|
|
||||||
ldapNameInput: string;
|
ldapNameInput: string;
|
||||||
ldapVendorInput: string;
|
ldapVendorInput: string;
|
||||||
ldapVendorList: string;
|
ldapVendorList: string;
|
||||||
|
@ -17,19 +22,25 @@ export default class CreateLdapProviderPage {
|
||||||
|
|
||||||
ldapEnabledInput: string;
|
ldapEnabledInput: string;
|
||||||
|
|
||||||
ldapCacheDayInput: string;
|
cacheDayInput: string;
|
||||||
ldapCacheDayList: string;
|
cacheDayList: string;
|
||||||
ldapCacheHourInput: string;
|
cacheHourInput: string;
|
||||||
ldapCacheHourList: string;
|
cacheHourList: string;
|
||||||
ldapCacheMinuteInput: string;
|
cacheMinuteInput: string;
|
||||||
ldapCacheMinuteList: string;
|
cacheMinuteList: string;
|
||||||
ldapCachePolicyInput: string;
|
cachePolicyInput: string;
|
||||||
ldapCachePolicyList: string;
|
cachePolicyList: string;
|
||||||
|
|
||||||
saveBtn: string;
|
saveBtn: string;
|
||||||
cancelBtn: string;
|
cancelBtn: string;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
// KerberosSettingsRequired required input values
|
||||||
|
this.kerberosNameInput = "data-testid=kerberos-name";
|
||||||
|
this.kerberosRealmInput = "data-testid=kerberos-realm";
|
||||||
|
this.kerberosPrincipalInput = "data-testid=kerberos-principal";
|
||||||
|
this.kerberosKeytabInput = "data-testid=kerberos-keytab";
|
||||||
|
|
||||||
// LdapSettingsGeneral required input values
|
// LdapSettingsGeneral required input values
|
||||||
this.ldapNameInput = "data-testid=ldap-name";
|
this.ldapNameInput = "data-testid=ldap-name";
|
||||||
this.ldapVendorInput = "#kc-vendor";
|
this.ldapVendorInput = "#kc-vendor";
|
||||||
|
@ -50,14 +61,14 @@ export default class CreateLdapProviderPage {
|
||||||
this.ldapUserObjClassesInput = "data-testid=ldap-user-object-classes";
|
this.ldapUserObjClassesInput = "data-testid=ldap-user-object-classes";
|
||||||
|
|
||||||
// SettingsCache input values
|
// SettingsCache input values
|
||||||
this.ldapCacheDayInput = "#kc-eviction-day";
|
this.cacheDayInput = "#kc-eviction-day";
|
||||||
this.ldapCacheDayList = "#kc-eviction-day + ul";
|
this.cacheDayList = "#kc-eviction-day + ul";
|
||||||
this.ldapCacheHourInput = "#kc-eviction-hour";
|
this.cacheHourInput = "#kc-eviction-hour";
|
||||||
this.ldapCacheHourList = "#kc-eviction-hour + ul";
|
this.cacheHourList = "#kc-eviction-hour + ul";
|
||||||
this.ldapCacheMinuteInput = "#kc-eviction-minute";
|
this.cacheMinuteInput = "#kc-eviction-minute";
|
||||||
this.ldapCacheMinuteList = "#kc-eviction-minute + ul";
|
this.cacheMinuteList = "#kc-eviction-minute + ul";
|
||||||
this.ldapCachePolicyInput = "#kc-cache-policy";
|
this.cachePolicyInput = "#kc-cache-policy";
|
||||||
this.ldapCachePolicyList = "#kc-cache-policy + ul";
|
this.cachePolicyList = "#kc-cache-policy + ul";
|
||||||
|
|
||||||
// LDAP settings enabled switch
|
// LDAP settings enabled switch
|
||||||
this.ldapEnabledInput = "#LDAP-switch";
|
this.ldapEnabledInput = "#LDAP-switch";
|
||||||
|
@ -67,9 +78,24 @@ export default class CreateLdapProviderPage {
|
||||||
this.cancelBtn = "data-testid=ldap-cancel";
|
this.cancelBtn = "data-testid=ldap-cancel";
|
||||||
}
|
}
|
||||||
|
|
||||||
changeTime(oldTime: string, newTime: string) {
|
changeCacheTime(unit: string, time: string) {
|
||||||
cy.contains(oldTime).click();
|
switch (unit) {
|
||||||
cy.contains(newTime).click();
|
case "day":
|
||||||
|
cy.get(this.cacheDayInput).click();
|
||||||
|
cy.get(this.cacheDayList).contains(time).click();
|
||||||
|
break;
|
||||||
|
case "hour":
|
||||||
|
cy.get(this.cacheHourInput).click();
|
||||||
|
cy.get(this.cacheHourList).contains(time).click();
|
||||||
|
break;
|
||||||
|
case "minute":
|
||||||
|
cy.get(this.cacheMinuteInput).click();
|
||||||
|
cy.get(this.cacheMinuteList).contains(time).click();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
console.log("Invalid cache time, must be 'day', 'hour', or 'minute'.");
|
||||||
|
break;
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,14 +105,34 @@ export default class CreateLdapProviderPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteCardFromMenu(card: string) {
|
deleteCardFromMenu(providerType: string, card: string) {
|
||||||
this.clickExistingCard(card);
|
this.clickExistingCard(card);
|
||||||
cy.get('[data-testid="action-dropdown"]').click();
|
cy.get('[data-testid="action-dropdown"]').click();
|
||||||
cy.get('[data-testid="delete-ldap-cmd"]').click();
|
cy.get(`[data-testid="delete-${providerType}-cmd"]`).click();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
fillKerberosRequiredData(
|
||||||
|
name: string,
|
||||||
|
realm: string,
|
||||||
|
principal: string,
|
||||||
|
keytab: string
|
||||||
|
) {
|
||||||
|
if (name) {
|
||||||
|
cy.get(`[${this.kerberosNameInput}]`).type(name);
|
||||||
|
}
|
||||||
|
if (realm) {
|
||||||
|
cy.get(`[${this.kerberosRealmInput}]`).type(realm);
|
||||||
|
}
|
||||||
|
if (principal) {
|
||||||
|
cy.get(`[${this.kerberosPrincipalInput}]`).type(principal);
|
||||||
|
}
|
||||||
|
if (keytab) {
|
||||||
|
cy.get(`[${this.kerberosKeytabInput}]`).type(keytab);
|
||||||
|
}
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Required fields - these always must be filled out when testing a save
|
|
||||||
fillLdapRequiredGeneralData(name: string, vendor: string) {
|
fillLdapRequiredGeneralData(name: string, vendor: string) {
|
||||||
if (name) {
|
if (name) {
|
||||||
cy.get(`[${this.ldapNameInput}]`).type(name);
|
cy.get(`[${this.ldapNameInput}]`).type(name);
|
||||||
|
@ -146,8 +192,8 @@ export default class CreateLdapProviderPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
selectCacheType(cacheType: string) {
|
selectCacheType(cacheType: string) {
|
||||||
cy.get(this.ldapCachePolicyInput).click();
|
cy.get(this.cachePolicyInput).click();
|
||||||
cy.get(this.ldapCachePolicyList).contains(cacheType).click();
|
cy.get(this.cachePolicyList).contains(cacheType).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,23 +215,23 @@ export default class CreateLdapProviderPage {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
disableEnabledSwitch() {
|
disableEnabledSwitch(providerType: string) {
|
||||||
cy.get(this.ldapEnabledInput).uncheck({ force: true });
|
cy.get(`#${providerType}-switch`).uncheck({ force: true });
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
enableEnabledSwitch() {
|
enableEnabledSwitch(providerType: string) {
|
||||||
cy.get(this.ldapEnabledInput).check({ force: true });
|
cy.get(`#${providerType}-switch`).check({ force: true });
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
save() {
|
save(providerType: string) {
|
||||||
cy.get(`[${this.saveBtn}]`).click();
|
cy.get(`[data-testid=${providerType}-save]`).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
cancel() {
|
cancel(providerType: string) {
|
||||||
cy.get(`[${this.cancelBtn}]`).click();
|
cy.get(`[data-testid=${providerType}-cancel]`).click();
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue