removed not working filter option (#2067)
This commit is contained in:
parent
83d9018f6d
commit
6ef3dc16f5
3 changed files with 25 additions and 149 deletions
|
@ -8,58 +8,31 @@ const sidebarPage = new SidebarPage();
|
||||||
const sessionsPage = new SessionsPage();
|
const sessionsPage = new SessionsPage();
|
||||||
|
|
||||||
describe("Sessions test", () => {
|
describe("Sessions test", () => {
|
||||||
describe("Session type dropdown", () => {
|
beforeEach(() => {
|
||||||
beforeEach(() => {
|
keycloakBefore();
|
||||||
keycloakBefore();
|
loginPage.logIn();
|
||||||
loginPage.logIn();
|
sidebarPage.goToSessions();
|
||||||
sidebarPage.goToSessions();
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it("Check dropdown display and all options exist", () => {
|
it("Set revocation notBefore", () => {
|
||||||
sessionsPage.shouldDisplay();
|
sessionsPage.setToNow();
|
||||||
sessionsPage.shouldNotBeEmpty();
|
});
|
||||||
});
|
|
||||||
|
|
||||||
it("Select 'All session types' dropdown option", () => {
|
it("Check if notBefore saved", () => {
|
||||||
sessionsPage.selectAllSessionsType();
|
sessionsPage.checkNotBeforeValueExists();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Select 'Regular SSO' dropdown option", () => {
|
it("Clear revocation notBefore", () => {
|
||||||
sessionsPage.selectRegularSSO();
|
sessionsPage.clearNotBefore();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Select 'Offline' dropdown option", () => {
|
it("Check if notBefore cleared", () => {
|
||||||
sessionsPage.selectOffline();
|
sessionsPage.checkNotBeforeCleared();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Select 'Direct grant' dropdown option", () => {
|
it("logout all sessions", () => {
|
||||||
sessionsPage.selectDirectGrant();
|
sessionsPage.logoutAllSessions();
|
||||||
});
|
|
||||||
|
|
||||||
it("Select 'Service account' dropdown option", () => {
|
cy.get("#kc-page-title").contains("Sign in to your account");
|
||||||
sessionsPage.selectServiceAccount();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Set revocation notBefore", () => {
|
|
||||||
sessionsPage.setToNow();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Check if notBefore saved", () => {
|
|
||||||
sessionsPage.checkNotBeforeValueExists();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Clear revocation notBefore", () => {
|
|
||||||
sessionsPage.clearNotBefore();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("Check if notBefore cleared", () => {
|
|
||||||
sessionsPage.checkNotBeforeCleared();
|
|
||||||
});
|
|
||||||
|
|
||||||
it("logout all sessions", () => {
|
|
||||||
sessionsPage.logoutAllSessions();
|
|
||||||
|
|
||||||
cy.get("#kc-page-title").contains("Sign in to your account");
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
export default class SessionsPage {
|
export default class SessionsPage {
|
||||||
sessionTypeDrpDwn = ".pf-c-select__toggle";
|
|
||||||
sessionTypeList = ".pf-c-select__toggle + ul";
|
sessionTypeList = ".pf-c-select__toggle + ul";
|
||||||
allSessionTypesOption = "all-sessions-option";
|
allSessionTypesOption = "all-sessions-option";
|
||||||
regularSSOOption = "regular-sso-option";
|
regularSSOOption = "regular-sso-option";
|
||||||
|
@ -15,47 +14,6 @@ export default class SessionsPage {
|
||||||
logoutAll = "logout-all";
|
logoutAll = "logout-all";
|
||||||
logoutAllConfirm = "logout-all-confirm-button";
|
logoutAllConfirm = "logout-all-confirm-button";
|
||||||
|
|
||||||
shouldDisplay() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist");
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldNotBeEmpty() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist").click();
|
|
||||||
cy.get(this.sessionTypeList).should("exist");
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
selectAllSessionsType() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist").click();
|
|
||||||
cy.findByTestId(this.allSessionTypesOption).should("exist").click();
|
|
||||||
cy.get(this.selectedType).should("have.text", "All session types");
|
|
||||||
}
|
|
||||||
|
|
||||||
selectRegularSSO() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist").click();
|
|
||||||
cy.findByTestId(this.regularSSOOption).should("exist").click();
|
|
||||||
cy.get(this.selectedType).should("have.text", "Regular SSO");
|
|
||||||
}
|
|
||||||
|
|
||||||
selectOffline() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist").click();
|
|
||||||
cy.findByTestId(this.offlineOption).should("exist").click();
|
|
||||||
cy.get(this.selectedType).should("have.text", "Offline");
|
|
||||||
}
|
|
||||||
|
|
||||||
selectDirectGrant() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist").click();
|
|
||||||
cy.findByTestId(this.directGrantOption).should("exist").click();
|
|
||||||
cy.get(this.selectedType).should("have.text", "Direct grant");
|
|
||||||
}
|
|
||||||
|
|
||||||
selectServiceAccount() {
|
|
||||||
cy.get(this.sessionTypeDrpDwn).should("exist").click();
|
|
||||||
cy.findByTestId(this.serviceAccountOption).should("exist").click();
|
|
||||||
cy.get(this.selectedType).should("have.text", "Service account");
|
|
||||||
}
|
|
||||||
|
|
||||||
setToNow() {
|
setToNow() {
|
||||||
cy.findByTestId(this.actionDropdown).should("exist").click();
|
cy.findByTestId(this.actionDropdown).should("exist").click();
|
||||||
cy.findByTestId(this.revocationActionItem).should("exist").click();
|
cy.findByTestId(this.revocationActionItem).should("exist").click();
|
||||||
|
|
|
@ -2,28 +2,21 @@ import React, { useState } from "react";
|
||||||
import { Link } from "react-router-dom";
|
import { Link } from "react-router-dom";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import {
|
import { DropdownItem, PageSection } from "@patternfly/react-core";
|
||||||
DropdownItem,
|
import { CubesIcon } from "@patternfly/react-icons";
|
||||||
PageSection,
|
|
||||||
Select,
|
|
||||||
SelectOption,
|
|
||||||
SelectVariant,
|
|
||||||
} from "@patternfly/react-core";
|
|
||||||
import { FilterIcon } from "@patternfly/react-icons";
|
|
||||||
|
|
||||||
import type UserSessionRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation";
|
import type UserSessionRepresentation from "@keycloak/keycloak-admin-client/lib/defs/userSessionRepresentation";
|
||||||
|
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
||||||
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
import { ListEmptyState } from "../components/list-empty-state/ListEmptyState";
|
||||||
import { ViewHeader } from "../components/view-header/ViewHeader";
|
import { ViewHeader } from "../components/view-header/ViewHeader";
|
||||||
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
|
import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable";
|
||||||
import { useAdminClient } from "../context/auth/AdminClient";
|
import { useAdminClient } from "../context/auth/AdminClient";
|
||||||
|
|
||||||
import { CubesIcon } from "@patternfly/react-icons";
|
|
||||||
import "./SessionsSection.css";
|
|
||||||
import { RevocationModal } from "./RevocationModal";
|
import { RevocationModal } from "./RevocationModal";
|
||||||
import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation";
|
|
||||||
import { LogoutAllSessionsModal } from "./LogoutAllSessionsModal";
|
import { LogoutAllSessionsModal } from "./LogoutAllSessionsModal";
|
||||||
import helpUrls from "../help-urls";
|
import helpUrls from "../help-urls";
|
||||||
|
|
||||||
|
import "./SessionsSection.css";
|
||||||
|
|
||||||
const Clients = (row: UserSessionRepresentation) => {
|
const Clients = (row: UserSessionRepresentation) => {
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -39,23 +32,14 @@ const Clients = (row: UserSessionRepresentation) => {
|
||||||
export default function SessionsSection() {
|
export default function SessionsSection() {
|
||||||
const { t } = useTranslation("sessions");
|
const { t } = useTranslation("sessions");
|
||||||
const adminClient = useAdminClient();
|
const adminClient = useAdminClient();
|
||||||
const [filterDropdownOpen, setFilterDropdownOpen] = useState(false);
|
|
||||||
const [revocationModalOpen, setRevocationModalOpen] = useState(false);
|
const [revocationModalOpen, setRevocationModalOpen] = useState(false);
|
||||||
const [logoutAllSessionsModalOpen, setLogoutAllSessionsModalOpen] =
|
const [logoutAllSessionsModalOpen, setLogoutAllSessionsModalOpen] =
|
||||||
useState(false);
|
useState(false);
|
||||||
const [activeClientDetails, setActiveClientDetails] = useState<
|
const [activeClientDetails, setActiveClientDetails] = useState<
|
||||||
ClientRepresentation[]
|
ClientRepresentation[]
|
||||||
>([]);
|
>([]);
|
||||||
const [filterType, setFilterType] = useState(
|
|
||||||
t("sessionsType.allSessions").toString()
|
|
||||||
);
|
|
||||||
const [key, setKey] = useState(0);
|
|
||||||
const [noSessions, setNoSessions] = useState(false);
|
const [noSessions, setNoSessions] = useState(false);
|
||||||
|
|
||||||
const refresh = () => {
|
|
||||||
setKey(new Date().getTime());
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleRevocationModalToggle = () => {
|
const handleRevocationModalToggle = () => {
|
||||||
setRevocationModalOpen(!revocationModalOpen);
|
setRevocationModalOpen(!revocationModalOpen);
|
||||||
};
|
};
|
||||||
|
@ -140,48 +124,9 @@ export default function SessionsSection() {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
<KeycloakDataTable
|
<KeycloakDataTable
|
||||||
key={key}
|
|
||||||
loader={loader}
|
loader={loader}
|
||||||
ariaLabelKey="session:title"
|
ariaLabelKey="session:title"
|
||||||
searchPlaceholderKey="sessions:searchForSession"
|
searchPlaceholderKey="sessions:searchForSession"
|
||||||
searchTypeComponent={
|
|
||||||
<Select
|
|
||||||
data-testid="filter-session-type-select"
|
|
||||||
isOpen={filterDropdownOpen}
|
|
||||||
className="kc-filter-session-type-select"
|
|
||||||
variant={SelectVariant.single}
|
|
||||||
onToggle={(isExpanded) => setFilterDropdownOpen(isExpanded)}
|
|
||||||
toggleIcon={<FilterIcon />}
|
|
||||||
onSelect={(_, value) => {
|
|
||||||
setFilterType(value.toString());
|
|
||||||
refresh();
|
|
||||||
setFilterDropdownOpen(false);
|
|
||||||
}}
|
|
||||||
selections={filterType}
|
|
||||||
>
|
|
||||||
<SelectOption
|
|
||||||
data-testid="all-sessions-option"
|
|
||||||
value={t("sessionsType.allSessions")}
|
|
||||||
isPlaceholder
|
|
||||||
/>
|
|
||||||
<SelectOption
|
|
||||||
data-testid="regular-sso-option"
|
|
||||||
value={t("sessionsType.regularSSO")}
|
|
||||||
/>
|
|
||||||
<SelectOption
|
|
||||||
data-testid="offline-option"
|
|
||||||
value={t("sessionsType.offline")}
|
|
||||||
/>
|
|
||||||
<SelectOption
|
|
||||||
data-testid="direct-grant-option"
|
|
||||||
value={t("sessionsType.directGrant")}
|
|
||||||
/>
|
|
||||||
<SelectOption
|
|
||||||
data-testid="service-account-option"
|
|
||||||
value={t("sessionsType.serviceAccount")}
|
|
||||||
/>
|
|
||||||
</Select>
|
|
||||||
}
|
|
||||||
columns={[
|
columns={[
|
||||||
{
|
{
|
||||||
name: "username",
|
name: "username",
|
||||||
|
|
Loading…
Reference in a new issue