Merge pull request #419 from mfrances17/issue-376
User fed cypress tests should not fail if there are existing providers on the system
This commit is contained in:
commit
39b629eff5
5 changed files with 162 additions and 262 deletions
|
@ -1,15 +1,18 @@
|
|||
import LoginPage from "../support/pages/LoginPage";
|
||||
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 ModalUtils from "../support/util/ModalUtils";
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const masthead = new Masthead();
|
||||
const sidebarPage = new SidebarPage();
|
||||
const providersPage = new CreateKerberosProviderPage();
|
||||
const providersPage = new ProviderPage();
|
||||
const modalUtils = new ModalUtils();
|
||||
|
||||
const provider = "kerberos";
|
||||
const initCapProvider = provider.charAt(0).toUpperCase() + provider.slice(1);
|
||||
|
||||
const firstKerberosName = "my-kerberos";
|
||||
const firstKerberosRealm = "my-realm";
|
||||
const firstKerberosPrincipal = "my-principal";
|
||||
|
@ -29,6 +32,7 @@ const newKerberosDay = "Wednesday";
|
|||
const newKerberosHour = "15";
|
||||
const newKerberosMinute = "55";
|
||||
|
||||
const addProviderMenu = "Add new provider";
|
||||
const createdSuccessMessage = "User federation provider successfully created";
|
||||
const savedSuccessMessage = "User federation provider successfully saved";
|
||||
const deletedSuccessMessage = "The user federation provider has been deleted.";
|
||||
|
@ -36,189 +40,129 @@ const deleteModalTitle = "Delete user federation provider?";
|
|||
const disableModalTitle = "Disable user federation provider?";
|
||||
|
||||
describe("User Fed Kerberos tests", () => {
|
||||
beforeEach(() => {
|
||||
/*
|
||||
Prevent unpredictable 401 errors from failing individual tests.
|
||||
These are most often occurring during the login process:
|
||||
GET /admin/serverinfo/
|
||||
GET /admin/master/console/whoami
|
||||
*/
|
||||
cy.on("uncaught:exception", (err, runnable) => {
|
||||
return false;
|
||||
});
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
});
|
||||
|
||||
it("Create Kerberos provider from empty state", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
cy.get("[data-testid=kerberos-card]").click();
|
||||
|
||||
// if tests don't start at empty state, e.g. user has providers configured locally,
|
||||
// create a new card from the card view instead
|
||||
cy.get("body").then(($body) => {
|
||||
if ($body.find(`[data-testid=kerberos-card]`).length > 0) {
|
||||
providersPage.clickNewCard(provider);
|
||||
} else {
|
||||
providersPage.clickMenuCommand(addProviderMenu, initCapProvider);
|
||||
}
|
||||
});
|
||||
providersPage.fillKerberosRequiredData(
|
||||
firstKerberosName,
|
||||
firstKerberosRealm,
|
||||
firstKerberosPrincipal,
|
||||
firstKerberosKeytab
|
||||
);
|
||||
providersPage.save();
|
||||
providersPage.save(provider);
|
||||
|
||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||
sidebarPage.goToUserFederation();
|
||||
});
|
||||
|
||||
it("Update an existing Kerberos provider and save", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
providersPage.clickExistingCard(firstKerberosName);
|
||||
providersPage.selectCacheType(newPolicy);
|
||||
providersPage.changeCacheTime("day", newKerberosDay);
|
||||
providersPage.changeCacheTime("hour", newKerberosHour);
|
||||
providersPage.changeCacheTime("minute", newKerberosMinute);
|
||||
providersPage.save(provider);
|
||||
|
||||
cy.contains(defaultKerberosDay).click();
|
||||
cy.contains(newKerberosDay).click();
|
||||
|
||||
cy.contains(defaultKerberosHour).click();
|
||||
cy.contains(newKerberosHour).click();
|
||||
|
||||
cy.contains(defaultKerberosMinute).click();
|
||||
cy.contains(newKerberosMinute).click();
|
||||
|
||||
providersPage.save();
|
||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
providersPage.clickExistingCard(firstKerberosName);
|
||||
|
||||
expect(cy.contains(newPolicy).should("exist"));
|
||||
expect(cy.contains(defaultPolicy).should("not.exist"));
|
||||
});
|
||||
|
||||
it("Change existing Kerberos provider and click button to cancel", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
providersPage.clickExistingCard(firstKerberosName);
|
||||
providersPage.selectCacheType(newPolicy);
|
||||
|
||||
cy.contains(newKerberosDay).click();
|
||||
cy.contains(defaultKerberosDay).click();
|
||||
|
||||
cy.contains(newKerberosHour).click();
|
||||
cy.contains(defaultKerberosHour).click();
|
||||
|
||||
cy.contains(newKerberosMinute).click();
|
||||
cy.contains(defaultKerberosMinute).click();
|
||||
|
||||
providersPage.cancel();
|
||||
|
||||
cy.wait(1000);
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
providersPage.changeCacheTime("day", defaultKerberosDay);
|
||||
providersPage.changeCacheTime("hour", defaultKerberosHour);
|
||||
providersPage.changeCacheTime("minute", defaultKerberosMinute);
|
||||
providersPage.cancel(provider);
|
||||
cy.wait(1000);
|
||||
|
||||
providersPage.clickExistingCard(firstKerberosName);
|
||||
providersPage.selectCacheType(newPolicy);
|
||||
|
||||
expect(cy.contains(newKerberosDay).should("exist"));
|
||||
expect(cy.contains(newKerberosHour).should("exist"));
|
||||
expect(cy.contains(newKerberosMinute).should("exist"));
|
||||
|
||||
expect(cy.contains(defaultKerberosMinute).should("not.exist"));
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
});
|
||||
|
||||
it("Disable an existing Kerberos provider", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
|
||||
providersPage.disableEnabledSwitch();
|
||||
providersPage.clickExistingCard(firstKerberosName);
|
||||
providersPage.disableEnabledSwitch(initCapProvider);
|
||||
|
||||
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
||||
|
||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.wait(1000);
|
||||
expect(cy.contains("Disabled").should("exist"));
|
||||
});
|
||||
|
||||
it("Enable an existing previously-disabled Kerberos provider", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
providersPage.clickExistingCard(firstKerberosName);
|
||||
providersPage.enableEnabledSwitch(initCapProvider);
|
||||
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
|
||||
providersPage.enableEnabledSwitch();
|
||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.wait(1000);
|
||||
expect(cy.contains("Enabled").should("exist"));
|
||||
});
|
||||
|
||||
it("Create new Kerberos provider using the New Provider dropdown", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
providersPage.clickMenuCommand(addProviderMenu, initCapProvider);
|
||||
|
||||
cy.contains("Add new provider").click();
|
||||
cy.contains("Kerberos").click();
|
||||
providersPage.fillKerberosRequiredData(
|
||||
secondKerberosName,
|
||||
secondKerberosRealm,
|
||||
secondKerberosPrincipal,
|
||||
secondKerberosKeytab
|
||||
);
|
||||
providersPage.save();
|
||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||
providersPage.save(provider);
|
||||
|
||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||
sidebarPage.goToUserFederation();
|
||||
});
|
||||
|
||||
it("Delete a Kerberos provider from card view using the card's menu", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.get('[data-testid="my-kerberos-2-dropdown"]').click();
|
||||
cy.get('[data-testid="card-delete"]').click();
|
||||
providersPage.deleteCardFromCard(secondKerberosName);
|
||||
|
||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||
|
||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||
});
|
||||
|
||||
it("Delete a Kerberos provider using the Settings view's Action menu", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.get('[data-testid="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get('[data-testid="action-dropdown"]').click();
|
||||
cy.get('[data-testid="delete-kerberos-cmd"]').click();
|
||||
providersPage.deleteCardFromMenu(provider, firstKerberosName);
|
||||
|
||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||
|
||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,18 @@
|
|||
import LoginPage from "../support/pages/LoginPage";
|
||||
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 ModalUtils from "../support/util/ModalUtils";
|
||||
|
||||
const loginPage = new LoginPage();
|
||||
const masthead = new Masthead();
|
||||
const sidebarPage = new SidebarPage();
|
||||
const providersPage = new CreateLdapProviderPage();
|
||||
const providersPage = new ProviderPage();
|
||||
const modalUtils = new ModalUtils();
|
||||
|
||||
const provider = "ldap";
|
||||
const allCapProvider = provider.toUpperCase();
|
||||
|
||||
const firstLdapName = "my-ldap";
|
||||
const firstLdapVendor = "Active Directory";
|
||||
|
||||
|
@ -46,6 +49,7 @@ const newLdapDay = "Wednesday";
|
|||
const newLdapHour = "15";
|
||||
const newLdapMinute = "55";
|
||||
|
||||
const addProviderMenu = "Add new provider";
|
||||
const createdSuccessMessage = "User federation provider successfully created";
|
||||
const savedSuccessMessage = "User federation provider successfully saved";
|
||||
const deletedSuccessMessage = "The user federation provider has been deleted.";
|
||||
|
@ -69,7 +73,15 @@ describe("User Fed LDAP tests", () => {
|
|||
});
|
||||
|
||||
it("Create Ldap provider from empty state", () => {
|
||||
providersPage.clickNewCard("ldap");
|
||||
// if tests don't start at empty state, e.g. user has providers configured locally,
|
||||
// create a new card from the card view instead
|
||||
cy.get("body").then(($body) => {
|
||||
if ($body.find(`[data-testid=ldap-card]`).length > 0) {
|
||||
providersPage.clickNewCard(provider);
|
||||
} else {
|
||||
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
||||
}
|
||||
});
|
||||
providersPage.fillLdapRequiredGeneralData(firstLdapName, firstLdapVendor);
|
||||
providersPage.fillLdapRequiredConnectionData(
|
||||
connectionUrl,
|
||||
|
@ -85,7 +97,7 @@ describe("User Fed LDAP tests", () => {
|
|||
firstUserObjClasses
|
||||
);
|
||||
|
||||
providersPage.save();
|
||||
providersPage.save(provider);
|
||||
|
||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||
sidebarPage.goToUserFederation();
|
||||
|
@ -95,16 +107,14 @@ describe("User Fed LDAP tests", () => {
|
|||
providersPage.clickExistingCard(firstLdapName);
|
||||
providersPage.selectCacheType(newPolicy);
|
||||
|
||||
providersPage.changeTime(defaultLdapDay, newLdapDay);
|
||||
providersPage.changeTime(defaultLdapHour, newLdapHour);
|
||||
providersPage.changeTime(defaultLdapMinute, newLdapMinute);
|
||||
providersPage.changeCacheTime("day", newLdapDay);
|
||||
providersPage.changeCacheTime("hour", newLdapHour);
|
||||
providersPage.changeCacheTime("minute", newLdapMinute);
|
||||
|
||||
providersPage.save();
|
||||
providersPage.save(provider);
|
||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
cy.wait(1000);
|
||||
|
||||
providersPage.clickExistingCard(firstLdapName);
|
||||
|
||||
expect(cy.contains(newPolicy).should("exist"));
|
||||
|
@ -115,11 +125,11 @@ describe("User Fed LDAP tests", () => {
|
|||
providersPage.clickExistingCard(firstLdapName);
|
||||
providersPage.selectCacheType(newPolicy);
|
||||
|
||||
providersPage.changeTime(newLdapDay, defaultLdapDay);
|
||||
providersPage.changeTime(newLdapHour, defaultLdapHour);
|
||||
providersPage.changeTime(newLdapMinute, defaultLdapMinute);
|
||||
providersPage.changeCacheTime("day", defaultLdapDay);
|
||||
providersPage.changeCacheTime("hour", defaultLdapHour);
|
||||
providersPage.changeCacheTime("minute", defaultLdapMinute);
|
||||
|
||||
providersPage.cancel();
|
||||
providersPage.cancel(provider);
|
||||
cy.wait(1000);
|
||||
|
||||
providersPage.clickExistingCard(firstLdapName);
|
||||
|
@ -135,7 +145,7 @@ describe("User Fed LDAP tests", () => {
|
|||
|
||||
it("Disable an existing LDAP provider", () => {
|
||||
providersPage.clickExistingCard(firstLdapName);
|
||||
providersPage.disableEnabledSwitch();
|
||||
providersPage.disableEnabledSwitch(allCapProvider);
|
||||
|
||||
modalUtils.checkModalTitle(disableModalTitle).confirmModal();
|
||||
|
||||
|
@ -144,23 +154,21 @@ describe("User Fed LDAP tests", () => {
|
|||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
cy.wait(1000);
|
||||
expect(cy.contains("Disabled").should("exist"));
|
||||
});
|
||||
|
||||
it("Enable an existing previously-disabled LDAP provider", () => {
|
||||
providersPage.clickExistingCard(firstLdapName);
|
||||
providersPage.enableEnabledSwitch();
|
||||
providersPage.enableEnabledSwitch(allCapProvider);
|
||||
|
||||
masthead.checkNotificationMessage(savedSuccessMessage);
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
cy.wait(1000);
|
||||
expect(cy.contains("Enabled").should("exist"));
|
||||
});
|
||||
|
||||
it("Create new LDAP provider using the New Provider dropdown", () => {
|
||||
providersPage.clickMenuCommand("Add new provider", "LDAP");
|
||||
providersPage.clickMenuCommand(addProviderMenu, allCapProvider);
|
||||
providersPage.fillLdapRequiredGeneralData(secondLdapName, secondLdapVendor);
|
||||
providersPage.fillLdapRequiredConnectionData(
|
||||
connectionUrl,
|
||||
|
@ -175,7 +183,7 @@ describe("User Fed LDAP tests", () => {
|
|||
secondUuidLdapAtt,
|
||||
secondUserObjClasses
|
||||
);
|
||||
providersPage.save();
|
||||
providersPage.save(provider);
|
||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||
sidebarPage.goToUserFederation();
|
||||
});
|
||||
|
@ -187,7 +195,7 @@ describe("User Fed LDAP tests", () => {
|
|||
});
|
||||
|
||||
it("Delete an LDAP provider using the Settings view's Action menu", () => {
|
||||
providersPage.deleteCardFromMenu(firstLdapName);
|
||||
providersPage.deleteCardFromMenu(provider, firstLdapName);
|
||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||
});
|
||||
|
|
|
@ -113,6 +113,7 @@ export default class SidebarPage {
|
|||
|
||||
goToUserFederation() {
|
||||
cy.get(this.userFederationBtn).click();
|
||||
cy.wait(1000);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
|
|
@ -1,87 +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() {
|
||||
this.kerberosNameInput = "data-testid=kerberos-name";
|
||||
this.kerberosRealmInput = "data-testid=kerberos-realm";
|
||||
this.kerberosPrincipalInput = "data-testid=kerberos-principal";
|
||||
this.kerberosKeytabInput = "data-testid=kerberos-keytab";
|
||||
|
||||
this.kerberosEnabledInput = "#Kerberos-switch";
|
||||
|
||||
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";
|
||||
|
||||
this.saveBtn = "data-testid=kerberos-save";
|
||||
this.cancelBtn = "data-testid=kerberos-cancel";
|
||||
}
|
||||
|
||||
//#region Required Settings
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
ldapVendorInput: string;
|
||||
ldapVendorList: string;
|
||||
|
@ -15,21 +20,22 @@ export default class CreateLdapProviderPage {
|
|||
ldapUuidLdapAttInput: string;
|
||||
ldapUserObjClassesInput: string;
|
||||
|
||||
ldapEnabledInput: string;
|
||||
|
||||
ldapCacheDayInput: string;
|
||||
ldapCacheDayList: string;
|
||||
ldapCacheHourInput: string;
|
||||
ldapCacheHourList: string;
|
||||
ldapCacheMinuteInput: string;
|
||||
ldapCacheMinuteList: string;
|
||||
ldapCachePolicyInput: string;
|
||||
ldapCachePolicyList: string;
|
||||
|
||||
saveBtn: string;
|
||||
cancelBtn: string;
|
||||
cacheDayInput: string;
|
||||
cacheDayList: string;
|
||||
cacheHourInput: string;
|
||||
cacheHourList: string;
|
||||
cacheMinuteInput: string;
|
||||
cacheMinuteList: string;
|
||||
cachePolicyInput: string;
|
||||
cachePolicyList: 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";
|
||||
|
||||
// LdapSettingsGeneral required input values
|
||||
this.ldapNameInput = "data-testid=ldap-name";
|
||||
this.ldapVendorInput = "#kc-vendor";
|
||||
|
@ -50,26 +56,34 @@ export default class CreateLdapProviderPage {
|
|||
this.ldapUserObjClassesInput = "data-testid=ldap-user-object-classes";
|
||||
|
||||
// SettingsCache input values
|
||||
this.ldapCacheDayInput = "#kc-eviction-day";
|
||||
this.ldapCacheDayList = "#kc-eviction-day + ul";
|
||||
this.ldapCacheHourInput = "#kc-eviction-hour";
|
||||
this.ldapCacheHourList = "#kc-eviction-hour + ul";
|
||||
this.ldapCacheMinuteInput = "#kc-eviction-minute";
|
||||
this.ldapCacheMinuteList = "#kc-eviction-minute + ul";
|
||||
this.ldapCachePolicyInput = "#kc-cache-policy";
|
||||
this.ldapCachePolicyList = "#kc-cache-policy + ul";
|
||||
|
||||
// LDAP settings enabled switch
|
||||
this.ldapEnabledInput = "#LDAP-switch";
|
||||
|
||||
// LDAP action buttons
|
||||
this.saveBtn = "data-testid=ldap-save";
|
||||
this.cancelBtn = "data-testid=ldap-cancel";
|
||||
this.cacheDayInput = "#kc-eviction-day";
|
||||
this.cacheDayList = "#kc-eviction-day + ul";
|
||||
this.cacheHourInput = "#kc-eviction-hour";
|
||||
this.cacheHourList = "#kc-eviction-hour + ul";
|
||||
this.cacheMinuteInput = "#kc-eviction-minute";
|
||||
this.cacheMinuteList = "#kc-eviction-minute + ul";
|
||||
this.cachePolicyInput = "#kc-cache-policy";
|
||||
this.cachePolicyList = "#kc-cache-policy + ul";
|
||||
}
|
||||
|
||||
changeTime(oldTime: string, newTime: string) {
|
||||
cy.contains(oldTime).click();
|
||||
cy.contains(newTime).click();
|
||||
changeCacheTime(unit: string, time: string) {
|
||||
switch (unit) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -79,14 +93,34 @@ export default class CreateLdapProviderPage {
|
|||
return this;
|
||||
}
|
||||
|
||||
deleteCardFromMenu(card: string) {
|
||||
deleteCardFromMenu(providerType: string, card: string) {
|
||||
this.clickExistingCard(card);
|
||||
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;
|
||||
}
|
||||
|
||||
// Required fields - these always must be filled out when testing a save
|
||||
fillLdapRequiredGeneralData(name: string, vendor: string) {
|
||||
if (name) {
|
||||
cy.get(`[${this.ldapNameInput}]`).type(name);
|
||||
|
@ -146,8 +180,8 @@ export default class CreateLdapProviderPage {
|
|||
}
|
||||
|
||||
selectCacheType(cacheType: string) {
|
||||
cy.get(this.ldapCachePolicyInput).click();
|
||||
cy.get(this.ldapCachePolicyList).contains(cacheType).click();
|
||||
cy.get(this.cachePolicyInput).click();
|
||||
cy.get(this.cachePolicyList).contains(cacheType).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -169,23 +203,23 @@ export default class CreateLdapProviderPage {
|
|||
return this;
|
||||
}
|
||||
|
||||
disableEnabledSwitch() {
|
||||
cy.get(this.ldapEnabledInput).uncheck({ force: true });
|
||||
disableEnabledSwitch(providerType: string) {
|
||||
cy.get(`#${providerType}-switch`).uncheck({ force: true });
|
||||
return this;
|
||||
}
|
||||
|
||||
enableEnabledSwitch() {
|
||||
cy.get(this.ldapEnabledInput).check({ force: true });
|
||||
enableEnabledSwitch(providerType: string) {
|
||||
cy.get(`#${providerType}-switch`).check({ force: true });
|
||||
return this;
|
||||
}
|
||||
|
||||
save() {
|
||||
cy.get(`[${this.saveBtn}]`).click();
|
||||
save(providerType: string) {
|
||||
cy.get(`[data-testid=${providerType}-save]`).click();
|
||||
return this;
|
||||
}
|
||||
|
||||
cancel() {
|
||||
cy.get(`[${this.cancelBtn}]`).click();
|
||||
cancel(providerType: string) {
|
||||
cy.get(`[data-testid=${providerType}-cancel]`).click();
|
||||
return this;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue