Merge pull request #371 from mfrances17/add-kerberos
User fed: Add Kerberos provider and tests
This commit is contained in:
commit
473d7840c6
11 changed files with 426 additions and 35 deletions
|
@ -58,6 +58,7 @@ export const KeycloakCard = ({
|
|||
<CardActions>
|
||||
{dropdownItems && (
|
||||
<Dropdown
|
||||
data-cy={`${title}-dropdown`}
|
||||
isPlain
|
||||
position={"right"}
|
||||
toggle={<KebabToggle onToggle={onDropdownToggle} />}
|
||||
|
@ -67,7 +68,7 @@ export const KeycloakCard = ({
|
|||
/>
|
||||
)}
|
||||
</CardActions>
|
||||
<CardTitle>{title}</CardTitle>
|
||||
<CardTitle data-cy="keycloak-card-title">{title}</CardTitle>
|
||||
</CardHeader>
|
||||
<CardBody />
|
||||
<CardFooter>
|
||||
|
|
|
@ -118,6 +118,7 @@ export const ViewHeader = ({
|
|||
}
|
||||
isOpen={isDropdownOpen}
|
||||
dropdownItems={dropdownItems}
|
||||
data-cy="action-dropdown"
|
||||
/>
|
||||
</ToolbarItem>
|
||||
)}
|
||||
|
|
|
@ -220,12 +220,24 @@ export const routes: RoutesFn = (t: TFunction) => [
|
|||
breadcrumb: t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/kerberos/new",
|
||||
component: UserFederationKerberosSettings,
|
||||
breadcrumb: t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/:id",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/user-federation/ldap/new",
|
||||
component: UserFederationLdapSettings,
|
||||
breadcrumb: t("common:settings"),
|
||||
access: "view-realm",
|
||||
},
|
||||
{
|
||||
path: "/:realm/",
|
||||
component: DashboardSection,
|
||||
|
|
|
@ -37,6 +37,7 @@ const KerberosSettingsHeader = ({
|
|||
toggleDeleteDialog,
|
||||
}: KerberosSettingsHeaderProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const { id } = useParams<{ id: string }>();
|
||||
const [toggleDisableDialog, DisableConfirm] = useConfirmDialog({
|
||||
titleKey: "user-federation:userFedDisableConfirmTitle",
|
||||
messageKey: "user-federation:userFedDisableConfirm",
|
||||
|
@ -49,24 +50,32 @@ const KerberosSettingsHeader = ({
|
|||
return (
|
||||
<>
|
||||
<DisableConfirm />
|
||||
<ViewHeader
|
||||
titleKey="Kerberos"
|
||||
subKey=""
|
||||
dropdownItems={[
|
||||
<DropdownItem key="delete" onClick={() => toggleDeleteDialog()}>
|
||||
{t("deleteProvider")}
|
||||
</DropdownItem>,
|
||||
]}
|
||||
isEnabled={value === "true"}
|
||||
onToggle={(value) => {
|
||||
if (!value) {
|
||||
toggleDisableDialog();
|
||||
} else {
|
||||
onChange("" + value);
|
||||
save();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
{id === "new" ? (
|
||||
<ViewHeader titleKey="Kerberos" subKey="" />
|
||||
) : (
|
||||
<ViewHeader
|
||||
titleKey="Kerberos"
|
||||
subKey=""
|
||||
dropdownItems={[
|
||||
<DropdownItem
|
||||
key="delete"
|
||||
onClick={() => toggleDeleteDialog()}
|
||||
data-cy="delete-provider-cmd"
|
||||
>
|
||||
{t("deleteProvider")}
|
||||
</DropdownItem>,
|
||||
]}
|
||||
isEnabled={value === "true"}
|
||||
onToggle={(value) => {
|
||||
if (!value) {
|
||||
toggleDisableDialog();
|
||||
} else {
|
||||
onChange("" + value);
|
||||
save();
|
||||
}
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -106,11 +115,23 @@ export const UserFederationKerberosSettings = () => {
|
|||
|
||||
const save = async (component: ComponentRepresentation) => {
|
||||
try {
|
||||
await adminClient.components.update({ id }, component);
|
||||
if (id) {
|
||||
if (id === "new") {
|
||||
await adminClient.components.create(component);
|
||||
} else {
|
||||
await adminClient.components.update({ id }, component);
|
||||
}
|
||||
}
|
||||
setupForm(component as ComponentRepresentation);
|
||||
addAlert(t("saveSuccess"), AlertVariant.success);
|
||||
addAlert(
|
||||
t(id === "new" ? "createSuccess" : "saveSuccess"),
|
||||
AlertVariant.success
|
||||
);
|
||||
} catch (error) {
|
||||
addAlert(`${t("saveError")} '${error}'`, AlertVariant.danger);
|
||||
addAlert(
|
||||
`${t(id === "new" ? "createError" : "saveError")} '${error}'`,
|
||||
AlertVariant.danger
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -135,7 +156,7 @@ export const UserFederationKerberosSettings = () => {
|
|||
<DeleteConfirm />
|
||||
<Controller
|
||||
name="config.enabled[0]"
|
||||
defaultValue={["true"]}
|
||||
defaultValue={["true"][0]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<KerberosSettingsHeader
|
||||
|
@ -153,12 +174,13 @@ export const UserFederationKerberosSettings = () => {
|
|||
<SettingsCache form={form} showSectionHeading />
|
||||
<Form onSubmit={form.handleSubmit(save)}>
|
||||
<ActionGroup>
|
||||
<Button variant="primary" type="submit">
|
||||
<Button variant="primary" type="submit" data-cy="kerberos-save">
|
||||
{t("common:save")}
|
||||
</Button>
|
||||
<Button
|
||||
variant="link"
|
||||
onClick={() => history.push(`/${realm}/user-federation`)}
|
||||
data-cy="kerberos-cancel"
|
||||
>
|
||||
{t("common:cancel")}
|
||||
</Button>
|
||||
|
|
|
@ -26,6 +26,8 @@ import { useAdminClient, asyncStateFetch } from "../context/auth/AdminClient";
|
|||
import { useConfirmDialog } from "../components/confirm-dialog/ConfirmDialog";
|
||||
import "./user-federation.css";
|
||||
|
||||
import { useHistory, useRouteMatch } from "react-router-dom";
|
||||
|
||||
export const UserFederationSection = () => {
|
||||
const [userFederations, setUserFederations] = useState<
|
||||
ComponentRepresentation[]
|
||||
|
@ -37,12 +39,15 @@ export const UserFederationSection = () => {
|
|||
const [key, setKey] = useState(0);
|
||||
const refresh = () => setKey(new Date().getTime());
|
||||
|
||||
const { url } = useRouteMatch();
|
||||
const history = useHistory();
|
||||
|
||||
useEffect(() => {
|
||||
return asyncStateFetch(
|
||||
() => {
|
||||
const testParams: { [name: string]: string | number } = {
|
||||
parentId: realm,
|
||||
type: "org.keycloak.storage.UserStorageProvider", // MF note that this is providerType in the output, but API call is still type
|
||||
type: "org.keycloak.storage.UserStorageProvider",
|
||||
};
|
||||
return adminClient.components.find(testParams);
|
||||
},
|
||||
|
@ -53,8 +58,18 @@ export const UserFederationSection = () => {
|
|||
}, [key]);
|
||||
|
||||
const ufAddProviderDropdownItems = [
|
||||
<DropdownItem key="itemLDAP">LDAP</DropdownItem>,
|
||||
<DropdownItem key="itemKerberos">Kerberos</DropdownItem>,
|
||||
<DropdownItem
|
||||
key="itemLDAP"
|
||||
onClick={() => history.push(`${url}/ldap/new`)}
|
||||
>
|
||||
LDAP
|
||||
</DropdownItem>,
|
||||
<DropdownItem
|
||||
key="itemKerberos"
|
||||
onClick={() => history.push(`${url}/kerberos/new`)}
|
||||
>
|
||||
Kerberos
|
||||
</DropdownItem>,
|
||||
];
|
||||
|
||||
const learnMoreLinkProps = {
|
||||
|
@ -95,6 +110,7 @@ export const UserFederationSection = () => {
|
|||
onClick={() => {
|
||||
toggleDeleteForCard(userFederation.id!);
|
||||
}}
|
||||
data-cy="card-delete"
|
||||
>
|
||||
{t("common:delete")}
|
||||
</DropdownItem>,
|
||||
|
@ -157,7 +173,11 @@ export const UserFederationSection = () => {
|
|||
</TextContent>
|
||||
<hr className="pf-u-mb-lg" />
|
||||
<Gallery hasGutter>
|
||||
<Card isHoverable>
|
||||
<Card
|
||||
isHoverable
|
||||
onClick={() => history.push(`${url}/kerberos/new`)}
|
||||
data-cy="kerberos-card"
|
||||
>
|
||||
<CardTitle>
|
||||
<Split hasGutter>
|
||||
<SplitItem>
|
||||
|
|
|
@ -11,6 +11,7 @@ import { useTranslation } from "react-i18next";
|
|||
import { UseFormMethods, Controller, useWatch } from "react-hook-form";
|
||||
|
||||
import { FormAccess } from "../../components/form-access/FormAccess";
|
||||
import { useRealm } from "../../context/realm-context/RealmContext";
|
||||
|
||||
import { HelpItem } from "../../components/help-enabler/HelpItem";
|
||||
import _ from "lodash";
|
||||
|
@ -29,6 +30,7 @@ export const KerberosSettingsRequired = ({
|
|||
}: KerberosSettingsRequiredProps) => {
|
||||
const { t } = useTranslation("user-federation");
|
||||
const helpText = useTranslation("user-federation-help").t;
|
||||
const { realm } = useRealm();
|
||||
|
||||
const [isEditModeDropdownOpen, setIsEditModeDropdownOpen] = useState(false);
|
||||
|
||||
|
@ -62,18 +64,19 @@ export const KerberosSettingsRequired = ({
|
|||
isRequired
|
||||
>
|
||||
{/* These hidden fields are required so data object written back matches data retrieved */}
|
||||
<TextInput
|
||||
{/* <TextInput
|
||||
hidden
|
||||
type="text"
|
||||
id="kc-console-id"
|
||||
name="id"
|
||||
ref={form.register}
|
||||
/>
|
||||
/> */}
|
||||
<TextInput
|
||||
hidden
|
||||
type="text"
|
||||
id="kc-console-providerId"
|
||||
name="providerId"
|
||||
defaultValue="kerberos"
|
||||
ref={form.register}
|
||||
/>
|
||||
<TextInput
|
||||
|
@ -81,6 +84,7 @@ export const KerberosSettingsRequired = ({
|
|||
type="text"
|
||||
id="kc-console-providerType"
|
||||
name="providerType"
|
||||
defaultValue="org.keycloak.storage.UserStorageProvider"
|
||||
ref={form.register}
|
||||
/>
|
||||
<TextInput
|
||||
|
@ -88,6 +92,7 @@ export const KerberosSettingsRequired = ({
|
|||
type="text"
|
||||
id="kc-console-parentId"
|
||||
name="parentId"
|
||||
defaultValue={realm}
|
||||
ref={form.register}
|
||||
/>
|
||||
|
||||
|
@ -102,6 +107,7 @@ export const KerberosSettingsRequired = ({
|
|||
message: `${t("validateName")}`,
|
||||
},
|
||||
})}
|
||||
data-cy="kerberos-name"
|
||||
/>
|
||||
{form.errors.name && (
|
||||
<div className="error">{form.errors.name.message}</div>
|
||||
|
@ -131,6 +137,7 @@ export const KerberosSettingsRequired = ({
|
|||
message: `${t("validateRealm")}`,
|
||||
},
|
||||
})}
|
||||
data-cy="kerberos-realm"
|
||||
/>
|
||||
{form.errors.config &&
|
||||
form.errors.config.kerberosRealm &&
|
||||
|
@ -164,6 +171,7 @@ export const KerberosSettingsRequired = ({
|
|||
message: `${t("validateServerPrincipal")}`,
|
||||
},
|
||||
})}
|
||||
data-cy="kerberos-principal"
|
||||
/>
|
||||
{form.errors.config &&
|
||||
form.errors.config.serverPrincipal &&
|
||||
|
@ -197,6 +205,7 @@ export const KerberosSettingsRequired = ({
|
|||
message: `${t("validateKeyTab")}`,
|
||||
},
|
||||
})}
|
||||
data-cy="kerberos-keytab"
|
||||
/>
|
||||
{form.errors.config &&
|
||||
form.errors.config.keyTab &&
|
||||
|
@ -222,7 +231,7 @@ export const KerberosSettingsRequired = ({
|
|||
{" "}
|
||||
<Controller
|
||||
name="config.debug"
|
||||
defaultValue={false}
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
|
@ -251,7 +260,7 @@ export const KerberosSettingsRequired = ({
|
|||
>
|
||||
<Controller
|
||||
name="config.allowPasswordAuthentication"
|
||||
defaultValue={false}
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
|
@ -324,7 +333,7 @@ export const KerberosSettingsRequired = ({
|
|||
>
|
||||
<Controller
|
||||
name="config.updateProfileFirstLogin"
|
||||
defaultValue={false}
|
||||
defaultValue={["false"]}
|
||||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Switch
|
||||
|
|
|
@ -80,8 +80,10 @@
|
|||
"oneLevel": "One Level",
|
||||
"subtree": "Subtree",
|
||||
|
||||
"saveSuccess": "User federation successfully saved",
|
||||
"saveError": "User federation could not be saved: {error}",
|
||||
"saveSuccess": "User federation provider successfully saved",
|
||||
"saveError": "User federation provider could not be saved: {error}",
|
||||
"createSuccess": "User federation provider successfully created",
|
||||
"createError": "User federation provider could not be created: {error}",
|
||||
|
||||
"learnMore": "Learn more",
|
||||
"addNewProvider": "Add new provider",
|
||||
|
|
|
@ -126,6 +126,7 @@ export const SettingsCache = ({
|
|||
}}
|
||||
selections={value}
|
||||
variant={SelectVariant.single}
|
||||
data-cy="kerberos-cache-policy"
|
||||
>
|
||||
<SelectOption key={0} value={["DEFAULT"]} isPlaceholder />
|
||||
<SelectOption key={1} value={["EVICT_DAILY"]} />
|
||||
|
@ -155,6 +156,7 @@ export const SettingsCache = ({
|
|||
control={form.control}
|
||||
render={({ onChange, value }) => (
|
||||
<Select
|
||||
data-cy="cache-day"
|
||||
toggleId="kc-eviction-day"
|
||||
required
|
||||
onToggle={() =>
|
||||
|
@ -292,6 +294,7 @@ export const SettingsCache = ({
|
|||
id="kc-max-lifespan"
|
||||
name="config.maxLifespan[0]"
|
||||
ref={form.register}
|
||||
data-cy="kerberos-cache-lifespan"
|
||||
/>
|
||||
</FormGroup>
|
||||
) : (
|
||||
|
|
224
tests/cypress/integration/user_fed_kerberos_test.spec.ts
Normal file
224
tests/cypress/integration/user_fed_kerberos_test.spec.ts
Normal file
|
@ -0,0 +1,224 @@
|
|||
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 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 modalUtils = new ModalUtils();
|
||||
|
||||
const firstKerberosName = "my-kerberos";
|
||||
const firstKerberosRealm = "my-realm";
|
||||
const firstKerberosPrincipal = "my-principal";
|
||||
const firstKerberosKeytab = "my-keytab";
|
||||
|
||||
const secondKerberosName = `${firstKerberosName}-2`;
|
||||
const secondKerberosRealm = `${firstKerberosRealm}-2`;
|
||||
const secondKerberosPrincipal = `${firstKerberosPrincipal}-2`;
|
||||
const secondKerberosKeytab = `${firstKerberosKeytab}-2`;
|
||||
|
||||
const defaultPolicy = "DEFAULT";
|
||||
const newPolicy = "EVICT_WEEKLY";
|
||||
const defaultKerberosDay = "Sunday";
|
||||
const defaultKerberosHour = "00";
|
||||
const defaultKerberosMinute = "00";
|
||||
const newKerberosDay = "Wednesday";
|
||||
const newKerberosHour = "15";
|
||||
const newKerberosMinute = "55";
|
||||
|
||||
const createdSuccessMessage = "User federation provider successfully created";
|
||||
const savedSuccessMessage = "User federation provider successfully saved";
|
||||
const deletedSuccessMessage = "The user federation provider has been deleted.";
|
||||
const deleteModalTitle = "Delete user federation provider?";
|
||||
const disableModalTitle = "Disable user federation provider?";
|
||||
|
||||
describe("User Fed Kerberos tests", () => {
|
||||
it("Create Kerberos provider from empty state", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
|
||||
sidebarPage.goToUserFederation();
|
||||
cy.get("[data-cy=kerberos-card]").click();
|
||||
|
||||
providersPage.fillKerberosRequiredData(
|
||||
firstKerberosName,
|
||||
firstKerberosRealm,
|
||||
firstKerberosPrincipal,
|
||||
firstKerberosKeytab
|
||||
);
|
||||
providersPage.save();
|
||||
|
||||
masthead.checkNotificationMessage(createdSuccessMessage);
|
||||
sidebarPage.goToUserFederation();
|
||||
});
|
||||
|
||||
it("Update an existing Kerberos provider and save", () => {
|
||||
cy.visit("");
|
||||
loginPage.logIn();
|
||||
sidebarPage.goToUserFederation();
|
||||
|
||||
cy.get('[data-cy="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
providersPage.selectCacheType(newPolicy);
|
||||
|
||||
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-cy="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
|
||||
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-cy="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
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-cy="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
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-cy="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
|
||||
providersPage.disableEnabledSwitch();
|
||||
|
||||
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();
|
||||
|
||||
cy.get('[data-cy="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();
|
||||
|
||||
cy.contains("Add new provider").click();
|
||||
cy.contains("Kerberos").click();
|
||||
providersPage.fillKerberosRequiredData(
|
||||
secondKerberosName,
|
||||
secondKerberosRealm,
|
||||
secondKerberosPrincipal,
|
||||
secondKerberosKeytab
|
||||
);
|
||||
providersPage.save();
|
||||
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-cy="my-kerberos-2-dropdown"]').click();
|
||||
cy.get('[data-cy="card-delete"]').click();
|
||||
|
||||
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-cy="keycloak-card-title"]')
|
||||
.contains(firstKerberosName)
|
||||
.click();
|
||||
cy.wait(1000);
|
||||
|
||||
cy.get('[data-cy="action-dropdown"]').click();
|
||||
cy.get('[data-cy="delete-provider-cmd"]').click();
|
||||
|
||||
modalUtils.checkModalTitle(deleteModalTitle).confirmModal();
|
||||
|
||||
masthead.checkNotificationMessage(deletedSuccessMessage);
|
||||
});
|
||||
});
|
|
@ -0,0 +1,87 @@
|
|||
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-cy=kerberos-name";
|
||||
this.kerberosRealmInput = "data-cy=kerberos-realm";
|
||||
this.kerberosPrincipalInput = "data-cy=kerberos-principal";
|
||||
this.kerberosKeytabInput = "data-cy=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-cy=kerberos-save";
|
||||
this.cancelBtn = "data-cy=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;
|
||||
}
|
||||
}
|
10
tests/cypress/tsconfig.json
Normal file
10
tests/cypress/tsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"lib": ["es5", "dom"],
|
||||
"types": ["cypress"]
|
||||
},
|
||||
"include": [
|
||||
"**/*.ts"
|
||||
]
|
||||
}
|
Loading…
Reference in a new issue