diff --git a/cypress/integration/sessions_test.spec.ts b/cypress/integration/sessions_test.spec.ts index 7a55ef548f..f7d246bff1 100644 --- a/cypress/integration/sessions_test.spec.ts +++ b/cypress/integration/sessions_test.spec.ts @@ -8,58 +8,31 @@ const sidebarPage = new SidebarPage(); const sessionsPage = new SessionsPage(); describe("Sessions test", () => { - describe("Session type dropdown", () => { - beforeEach(() => { - keycloakBefore(); - loginPage.logIn(); - sidebarPage.goToSessions(); - }); + beforeEach(() => { + keycloakBefore(); + loginPage.logIn(); + sidebarPage.goToSessions(); + }); - it("Check dropdown display and all options exist", () => { - sessionsPage.shouldDisplay(); - sessionsPage.shouldNotBeEmpty(); - }); + it("Set revocation notBefore", () => { + sessionsPage.setToNow(); + }); - it("Select 'All session types' dropdown option", () => { - sessionsPage.selectAllSessionsType(); - }); + it("Check if notBefore saved", () => { + sessionsPage.checkNotBeforeValueExists(); + }); - it("Select 'Regular SSO' dropdown option", () => { - sessionsPage.selectRegularSSO(); - }); + it("Clear revocation notBefore", () => { + sessionsPage.clearNotBefore(); + }); - it("Select 'Offline' dropdown option", () => { - sessionsPage.selectOffline(); - }); + it("Check if notBefore cleared", () => { + sessionsPage.checkNotBeforeCleared(); + }); - it("Select 'Direct grant' dropdown option", () => { - sessionsPage.selectDirectGrant(); - }); + it("logout all sessions", () => { + sessionsPage.logoutAllSessions(); - it("Select 'Service account' dropdown option", () => { - 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"); - }); + cy.get("#kc-page-title").contains("Sign in to your account"); }); }); diff --git a/cypress/support/pages/admin_console/manage/sessions/SessionsPage.ts b/cypress/support/pages/admin_console/manage/sessions/SessionsPage.ts index 1506ef3080..4483eeb439 100644 --- a/cypress/support/pages/admin_console/manage/sessions/SessionsPage.ts +++ b/cypress/support/pages/admin_console/manage/sessions/SessionsPage.ts @@ -1,5 +1,4 @@ export default class SessionsPage { - sessionTypeDrpDwn = ".pf-c-select__toggle"; sessionTypeList = ".pf-c-select__toggle + ul"; allSessionTypesOption = "all-sessions-option"; regularSSOOption = "regular-sso-option"; @@ -15,47 +14,6 @@ export default class SessionsPage { logoutAll = "logout-all"; 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() { cy.findByTestId(this.actionDropdown).should("exist").click(); cy.findByTestId(this.revocationActionItem).should("exist").click(); diff --git a/src/sessions/SessionsSection.tsx b/src/sessions/SessionsSection.tsx index 0ba164fb79..afcee05f70 100644 --- a/src/sessions/SessionsSection.tsx +++ b/src/sessions/SessionsSection.tsx @@ -2,28 +2,21 @@ import React, { useState } from "react"; import { Link } from "react-router-dom"; import { useTranslation } from "react-i18next"; import moment from "moment"; -import { - DropdownItem, - PageSection, - Select, - SelectOption, - SelectVariant, -} from "@patternfly/react-core"; -import { FilterIcon } from "@patternfly/react-icons"; +import { DropdownItem, PageSection } from "@patternfly/react-core"; +import { CubesIcon } from "@patternfly/react-icons"; 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 { ViewHeader } from "../components/view-header/ViewHeader"; import { KeycloakDataTable } from "../components/table-toolbar/KeycloakDataTable"; import { useAdminClient } from "../context/auth/AdminClient"; - -import { CubesIcon } from "@patternfly/react-icons"; -import "./SessionsSection.css"; import { RevocationModal } from "./RevocationModal"; -import type ClientRepresentation from "@keycloak/keycloak-admin-client/lib/defs/clientRepresentation"; import { LogoutAllSessionsModal } from "./LogoutAllSessionsModal"; import helpUrls from "../help-urls"; +import "./SessionsSection.css"; + const Clients = (row: UserSessionRepresentation) => { return ( <> @@ -39,23 +32,14 @@ const Clients = (row: UserSessionRepresentation) => { export default function SessionsSection() { const { t } = useTranslation("sessions"); const adminClient = useAdminClient(); - const [filterDropdownOpen, setFilterDropdownOpen] = useState(false); const [revocationModalOpen, setRevocationModalOpen] = useState(false); const [logoutAllSessionsModalOpen, setLogoutAllSessionsModalOpen] = useState(false); const [activeClientDetails, setActiveClientDetails] = useState< ClientRepresentation[] >([]); - const [filterType, setFilterType] = useState( - t("sessionsType.allSessions").toString() - ); - const [key, setKey] = useState(0); const [noSessions, setNoSessions] = useState(false); - const refresh = () => { - setKey(new Date().getTime()); - }; - const handleRevocationModalToggle = () => { setRevocationModalOpen(!revocationModalOpen); }; @@ -140,48 +124,9 @@ export default function SessionsSection() { /> )} setFilterDropdownOpen(isExpanded)} - toggleIcon={} - onSelect={(_, value) => { - setFilterType(value.toString()); - refresh(); - setFilterDropdownOpen(false); - }} - selections={filterType} - > - - - - - - - } columns={[ { name: "username",