From ced1008ad5743d5bff1db8443294f9c862979d45 Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Fri, 7 Jan 2022 08:27:58 +0100 Subject: [PATCH] now only logs in per test suite for client tests (#1828) --- .../integration/authentication_test.spec.ts | 2 +- .../integration/client_scopes_test.spec.ts | 2 +- cypress/integration/clients_saml_test.spec.ts | 2 +- cypress/integration/clients_test.spec.ts | 52 ++++++++++++------- cypress/integration/events_test.spec.ts | 2 +- cypress/integration/group_test.spec.ts | 2 +- .../identity_providers_oidc_test.spec.ts | 2 +- .../identity_providers_saml_test.spec.ts | 2 +- .../identity_providers_test.spec.ts | 2 +- cypress/integration/login_test.spec.ts | 2 +- cypress/integration/masthead_test.spec.ts | 2 +- .../integration/partial_export_test.spec.ts | 2 +- .../integration/partial_import_test.spec.ts | 2 +- cypress/integration/realm_roles_test.spec.ts | 2 +- ...ealm_settings_client_policies_test.spec.ts | 2 +- ...ealm_settings_client_profiles_test.spec.ts | 2 +- .../realm_settings_events_test.spec.ts | 2 +- .../realm_settings_tabs_test.spec.ts | 2 +- cypress/integration/realm_test.spec.ts | 2 +- cypress/integration/sessions_test.spec.ts | 2 +- .../user_fed_kerberos_test.spec.ts | 2 +- ...ser_fed_ldap_hardcoded_mapper_test.spec.ts | 2 +- .../user_fed_ldap_mapper_test.spec.ts | 2 +- .../integration/user_fed_ldap_test.spec.ts | 2 +- cypress/integration/users_test.spec.ts | 2 +- .../{keycloak_before.ts => keycloak_hooks.ts} | 4 ++ 26 files changed, 62 insertions(+), 42 deletions(-) rename cypress/support/util/{keycloak_before.ts => keycloak_hooks.ts} (78%) diff --git a/cypress/integration/authentication_test.spec.ts b/cypress/integration/authentication_test.spec.ts index c3a049d7ff..7d4fee9b4b 100644 --- a/cypress/integration/authentication_test.spec.ts +++ b/cypress/integration/authentication_test.spec.ts @@ -1,4 +1,4 @@ -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import LoginPage from "../support/pages/LoginPage"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import Masthead from "../support/pages/admin_console/Masthead"; diff --git a/cypress/integration/client_scopes_test.spec.ts b/cypress/integration/client_scopes_test.spec.ts index fbdc647da4..43c2debcd6 100644 --- a/cypress/integration/client_scopes_test.spec.ts +++ b/cypress/integration/client_scopes_test.spec.ts @@ -3,7 +3,7 @@ import Masthead from "../support/pages/admin_console/Masthead"; import ListingPage from "../support/pages/admin_console/ListingPage"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import CreateClientScopePage from "../support/pages/admin_console/manage/client_scopes/CreateClientScopePage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import RoleMappingTab from "../support/pages/admin_console/manage/RoleMappingTab"; import ModalUtils from "../support/util/ModalUtils"; import AdminClient from "../support/util/AdminClient"; diff --git a/cypress/integration/clients_saml_test.spec.ts b/cypress/integration/clients_saml_test.spec.ts index 3a3040f163..5eb180f5de 100644 --- a/cypress/integration/clients_saml_test.spec.ts +++ b/cypress/integration/clients_saml_test.spec.ts @@ -4,7 +4,7 @@ import ListingPage from "../support/pages/admin_console/ListingPage"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import ModalUtils from "../support/util/ModalUtils"; import AdminClient from "../support/util/AdminClient"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import AuthenticationTab from "../support/pages/admin_console/manage/clients/Authentication"; const loginPage = new LoginPage(); diff --git a/cypress/integration/clients_test.spec.ts b/cypress/integration/clients_test.spec.ts index 3038199582..85934eeeca 100644 --- a/cypress/integration/clients_test.spec.ts +++ b/cypress/integration/clients_test.spec.ts @@ -7,7 +7,10 @@ import ModalUtils from "../support/util/ModalUtils"; import AdvancedTab from "../support/pages/admin_console/manage/clients/AdvancedTab"; import AdminClient from "../support/util/AdminClient"; import InitialAccessTokenTab from "../support/pages/admin_console/manage/clients/InitialAccessTokenTab"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { + keycloakBefore, + keycloakBeforeEach, +} from "../support/util/keycloak_hooks"; import RoleMappingTab from "../support/pages/admin_console/manage/RoleMappingTab"; import KeysTab from "../support/pages/admin_console/manage/clients/KeysTab"; import ClientScopesTab from "../support/pages/admin_console/manage/clients/ClientScopesTab"; @@ -78,9 +81,13 @@ describe("Clients test", () => { }); describe("Client creation", () => { - beforeEach(() => { + before(() => { keycloakBefore(); loginPage.logIn(); + }); + + beforeEach(() => { + keycloakBeforeEach(); sidebarPage.goToClients(); }); @@ -155,9 +162,13 @@ describe("Clients test", () => { const advancedTab = new AdvancedTab(); let client: string; - beforeEach(() => { + before(() => { keycloakBefore(); loginPage.logIn(); + }); + + beforeEach(() => { + keycloakBeforeEach(); sidebarPage.goToClients(); client = "client_" + (Math.random() + 1).toString(36).substring(7); @@ -205,13 +216,14 @@ describe("Clients test", () => { const serviceAccountName = "service-account-client"; beforeEach(() => { - keycloakBefore(); - loginPage.logIn(); + keycloakBeforeEach(); sidebarPage.goToClients(); }); - before(async () => { - await new AdminClient().createClient({ + before(() => { + keycloakBefore(); + loginPage.logIn(); + new AdminClient().createClient({ protocol: "openid-connect", clientId: serviceAccountName, publicClient: false, @@ -234,7 +246,6 @@ describe("Clients test", () => { .checkRoles(["manage-account", "offline_access", "uma_authorization"]); }); - /* this test causes the test(s) that follow it to fail - it should be rewritten it("assign", () => { listingPage.goToItemDetails(serviceAccountName); serviceAccountTab @@ -244,7 +255,6 @@ describe("Clients test", () => { .clickAssign(); masthead.checkNotificationMessage("Role mapping updated"); }); - */ }); describe("Mapping tab", () => { @@ -280,13 +290,14 @@ describe("Clients test", () => { describe("Keys tab test", () => { const keysName = "keys-client"; beforeEach(() => { - keycloakBefore(); - loginPage.logIn(); + keycloakBeforeEach(); sidebarPage.goToClients(); listingPage.searchItem(keysName).goToItemDetails(keysName); }); before(() => { + keycloakBefore(); + loginPage.logIn(); new AdminClient().createClient({ protocol: "openid-connect", clientId: keysName, @@ -319,13 +330,17 @@ describe("Clients test", () => { describe("Realm client", () => { const clientName = "master-realm"; - beforeEach(() => { + before(() => { keycloakBefore(); loginPage.logIn(); sidebarPage.goToClients(); listingPage.searchItem(clientName).goToItemDetails(clientName); }); + beforeEach(() => { + keycloakBeforeEach(); + }); + it("displays the correct tabs", () => { cy.findByTestId("client-tabs") .find("#pf-tab-settings-settings") @@ -352,12 +367,18 @@ describe("Clients test", () => { const clientId = "bearer-only"; before(() => { + keycloakBefore(); + loginPage.logIn(); new AdminClient().createClient({ clientId, protocol: "openid-connect", publicClient: false, bearerOnly: true, }); + sidebarPage.goToClients(); + cy.intercept("/auth/admin/realms/master/clients/*").as("fetchClient"); + listingPage.searchItem(clientId).goToItemDetails(clientId); + cy.wait("@fetchClient"); }); after(() => { @@ -365,12 +386,7 @@ describe("Clients test", () => { }); beforeEach(() => { - keycloakBefore(); - loginPage.logIn(); - sidebarPage.goToClients(); - cy.intercept("/auth/admin/realms/master/clients/*").as("fetchClient"); - listingPage.searchItem(clientId).goToItemDetails(clientId); - cy.wait("@fetchClient"); + keycloakBeforeEach(); }); it("shows an explainer text for bearer only clients", () => { diff --git a/cypress/integration/events_test.spec.ts b/cypress/integration/events_test.spec.ts index c9798225f6..0a8b038dba 100644 --- a/cypress/integration/events_test.spec.ts +++ b/cypress/integration/events_test.spec.ts @@ -4,7 +4,7 @@ import UserEventsTab from "../support/pages/admin_console/manage/events/UserEven import AdminEventsTab from "../support/pages/admin_console/manage/events/AdminEventsTab"; import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage"; import Masthead from "../support/pages/admin_console/Masthead"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const sidebarPage = new SidebarPage(); diff --git a/cypress/integration/group_test.spec.ts b/cypress/integration/group_test.spec.ts index b87dbd0d09..7d092505bb 100644 --- a/cypress/integration/group_test.spec.ts +++ b/cypress/integration/group_test.spec.ts @@ -9,7 +9,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; import ViewHeaderPage from "../support/pages/ViewHeaderPage"; import AdminClient from "../support/util/AdminClient"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import ModalUtils from "../support/util/ModalUtils"; describe("Group test", () => { diff --git a/cypress/integration/identity_providers_oidc_test.spec.ts b/cypress/integration/identity_providers_oidc_test.spec.ts index f238dfd231..34953879bd 100644 --- a/cypress/integration/identity_providers_oidc_test.spec.ts +++ b/cypress/integration/identity_providers_oidc_test.spec.ts @@ -1,7 +1,7 @@ import Masthead from "../support/pages/admin_console/Masthead"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import ListingPage from "../support/pages/admin_console/ListingPage"; import CreateProviderPage from "../support/pages/admin_console/manage/identity_providers/CreateProviderPage"; import ModalUtils from "../support/util/ModalUtils"; diff --git a/cypress/integration/identity_providers_saml_test.spec.ts b/cypress/integration/identity_providers_saml_test.spec.ts index 95b472dff2..e88dd3f86c 100644 --- a/cypress/integration/identity_providers_saml_test.spec.ts +++ b/cypress/integration/identity_providers_saml_test.spec.ts @@ -1,7 +1,7 @@ import Masthead from "../support/pages/admin_console/Masthead"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import ListingPage from "../support/pages/admin_console/ListingPage"; import CreateProviderPage from "../support/pages/admin_console/manage/identity_providers/CreateProviderPage"; import ModalUtils from "../support/util/ModalUtils"; diff --git a/cypress/integration/identity_providers_test.spec.ts b/cypress/integration/identity_providers_test.spec.ts index 94a1d1bbf1..06e115130c 100644 --- a/cypress/integration/identity_providers_test.spec.ts +++ b/cypress/integration/identity_providers_test.spec.ts @@ -1,7 +1,7 @@ import Masthead from "../support/pages/admin_console/Masthead"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import ListingPage from "../support/pages/admin_console/ListingPage"; import CreateProviderPage from "../support/pages/admin_console/manage/identity_providers/CreateProviderPage"; diff --git a/cypress/integration/login_test.spec.ts b/cypress/integration/login_test.spec.ts index 22b7b4d238..bd5eaa7d8a 100644 --- a/cypress/integration/login_test.spec.ts +++ b/cypress/integration/login_test.spec.ts @@ -1,6 +1,6 @@ import LoginPage from "../support/pages/LoginPage"; import Masthead from "../support/pages/admin_console/Masthead"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const username = "admin"; const password = "admin"; diff --git a/cypress/integration/masthead_test.spec.ts b/cypress/integration/masthead_test.spec.ts index b932b3b500..e5002d0e8f 100644 --- a/cypress/integration/masthead_test.spec.ts +++ b/cypress/integration/masthead_test.spec.ts @@ -2,7 +2,7 @@ import ListingPage from "../support/pages/admin_console/ListingPage"; import LoginPage from "../support/pages/LoginPage"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import Masthead from "../support/pages/admin_console/Masthead"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const masthead = new Masthead(); diff --git a/cypress/integration/partial_export_test.spec.ts b/cypress/integration/partial_export_test.spec.ts index 851e6a1826..7ef7f2ae14 100644 --- a/cypress/integration/partial_export_test.spec.ts +++ b/cypress/integration/partial_export_test.spec.ts @@ -3,7 +3,7 @@ import RealmSettings from "../support/pages/admin_console/configure/realm_settin import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; import AdminClient from "../support/util/AdminClient"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; describe("Partial realm export", () => { const REALM_NAME = "partial-export-test-realm"; diff --git a/cypress/integration/partial_import_test.spec.ts b/cypress/integration/partial_import_test.spec.ts index 088e016733..1f7ac14f81 100644 --- a/cypress/integration/partial_import_test.spec.ts +++ b/cypress/integration/partial_import_test.spec.ts @@ -3,7 +3,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; import PartialImportModal from "../support/pages/admin_console/configure/realm_settings/PartialImportModal"; import RealmSettings from "../support/pages/admin_console/configure/realm_settings/RealmSettings"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import AdminClient from "../support/util/AdminClient"; describe("Partial import test", () => { diff --git a/cypress/integration/realm_roles_test.spec.ts b/cypress/integration/realm_roles_test.spec.ts index a0d81dd3af..894533ec69 100644 --- a/cypress/integration/realm_roles_test.spec.ts +++ b/cypress/integration/realm_roles_test.spec.ts @@ -5,7 +5,7 @@ import ListingPage from "../support/pages/admin_console/ListingPage"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import CreateRealmRolePage from "../support/pages/admin_console/manage/realm_roles/CreateRealmRolePage"; import AssociatedRolesPage from "../support/pages/admin_console/manage/realm_roles/AssociatedRolesPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; let itemId = "realm_role_crud"; const loginPage = new LoginPage(); diff --git a/cypress/integration/realm_settings_client_policies_test.spec.ts b/cypress/integration/realm_settings_client_policies_test.spec.ts index 6eb4ae6887..d8414f4021 100644 --- a/cypress/integration/realm_settings_client_policies_test.spec.ts +++ b/cypress/integration/realm_settings_client_policies_test.spec.ts @@ -1,7 +1,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import AdminClient from "../support/util/AdminClient"; const loginPage = new LoginPage(); diff --git a/cypress/integration/realm_settings_client_profiles_test.spec.ts b/cypress/integration/realm_settings_client_profiles_test.spec.ts index 2c8f9cd911..1a4d61dfae 100644 --- a/cypress/integration/realm_settings_client_profiles_test.spec.ts +++ b/cypress/integration/realm_settings_client_profiles_test.spec.ts @@ -1,7 +1,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import AdminClient from "../support/util/AdminClient"; const loginPage = new LoginPage(); diff --git a/cypress/integration/realm_settings_events_test.spec.ts b/cypress/integration/realm_settings_events_test.spec.ts index efcbfbf72a..344cedfe72 100644 --- a/cypress/integration/realm_settings_events_test.spec.ts +++ b/cypress/integration/realm_settings_events_test.spec.ts @@ -3,7 +3,7 @@ import LoginPage from "../support/pages/LoginPage"; import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage"; import Masthead from "../support/pages/admin_console/Masthead"; import ModalUtils from "../support/util/ModalUtils"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import ListingPage from "../support/pages/admin_console/ListingPage"; import AdminClient from "../support/util/AdminClient"; diff --git a/cypress/integration/realm_settings_tabs_test.spec.ts b/cypress/integration/realm_settings_tabs_test.spec.ts index 445e8c7634..9c83490110 100644 --- a/cypress/integration/realm_settings_tabs_test.spec.ts +++ b/cypress/integration/realm_settings_tabs_test.spec.ts @@ -2,7 +2,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import LoginPage from "../support/pages/LoginPage"; import RealmSettingsPage from "../support/pages/admin_console/manage/realm_settings/RealmSettingsPage"; import Masthead from "../support/pages/admin_console/Masthead"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import AdminClient from "../support/util/AdminClient"; const loginPage = new LoginPage(); diff --git a/cypress/integration/realm_test.spec.ts b/cypress/integration/realm_test.spec.ts index 8273211e18..b549f96733 100644 --- a/cypress/integration/realm_test.spec.ts +++ b/cypress/integration/realm_test.spec.ts @@ -3,7 +3,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import CreateRealmPage from "../support/pages/admin_console/CreateRealmPage"; import Masthead from "../support/pages/admin_console/Masthead"; import AdminClient from "../support/util/AdminClient"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const masthead = new Masthead(); const loginPage = new LoginPage(); diff --git a/cypress/integration/sessions_test.spec.ts b/cypress/integration/sessions_test.spec.ts index 32a78685a9..7a55ef548f 100644 --- a/cypress/integration/sessions_test.spec.ts +++ b/cypress/integration/sessions_test.spec.ts @@ -1,7 +1,7 @@ import LoginPage from "../support/pages/LoginPage"; import SidebarPage from "../support/pages/admin_console/SidebarPage"; import SessionsPage from "../support/pages/admin_console/manage/sessions/SessionsPage"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const sidebarPage = new SidebarPage(); diff --git a/cypress/integration/user_fed_kerberos_test.spec.ts b/cypress/integration/user_fed_kerberos_test.spec.ts index 7a8448473d..fbe6f62876 100644 --- a/cypress/integration/user_fed_kerberos_test.spec.ts +++ b/cypress/integration/user_fed_kerberos_test.spec.ts @@ -3,7 +3,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage"; import Masthead from "../support/pages/admin_console/Masthead"; import ModalUtils from "../support/util/ModalUtils"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const masthead = new Masthead(); diff --git a/cypress/integration/user_fed_ldap_hardcoded_mapper_test.spec.ts b/cypress/integration/user_fed_ldap_hardcoded_mapper_test.spec.ts index 5f05d0ec08..2056f20b80 100644 --- a/cypress/integration/user_fed_ldap_hardcoded_mapper_test.spec.ts +++ b/cypress/integration/user_fed_ldap_hardcoded_mapper_test.spec.ts @@ -6,7 +6,7 @@ import ProviderPage from "../support/pages/admin_console/manage/providers/Provid import CreateClientPage from "../support/pages/admin_console/manage/clients/CreateClientPage"; import Masthead from "../support/pages/admin_console/Masthead"; import ModalUtils from "../support/util/ModalUtils"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const masthead = new Masthead(); diff --git a/cypress/integration/user_fed_ldap_mapper_test.spec.ts b/cypress/integration/user_fed_ldap_mapper_test.spec.ts index ffb2e2d64d..e88e8e34ff 100644 --- a/cypress/integration/user_fed_ldap_mapper_test.spec.ts +++ b/cypress/integration/user_fed_ldap_mapper_test.spec.ts @@ -4,7 +4,7 @@ import ListingPage from "../support/pages/admin_console/ListingPage"; import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage"; import Masthead from "../support/pages/admin_console/Masthead"; import ModalUtils from "../support/util/ModalUtils"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const masthead = new Masthead(); diff --git a/cypress/integration/user_fed_ldap_test.spec.ts b/cypress/integration/user_fed_ldap_test.spec.ts index df6fe7d0e6..66a94303da 100644 --- a/cypress/integration/user_fed_ldap_test.spec.ts +++ b/cypress/integration/user_fed_ldap_test.spec.ts @@ -3,7 +3,7 @@ import SidebarPage from "../support/pages/admin_console/SidebarPage"; import ProviderPage from "../support/pages/admin_console/manage/providers/ProviderPage"; import Masthead from "../support/pages/admin_console/Masthead"; import ModalUtils from "../support/util/ModalUtils"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; const loginPage = new LoginPage(); const masthead = new Masthead(); diff --git a/cypress/integration/users_test.spec.ts b/cypress/integration/users_test.spec.ts index 03697884be..2b8f88545e 100644 --- a/cypress/integration/users_test.spec.ts +++ b/cypress/integration/users_test.spec.ts @@ -6,7 +6,7 @@ import ListingPage from "../support/pages/admin_console/ListingPage"; import UserDetailsPage from "../support/pages/admin_console/manage/users/UserDetailsPage"; import AttributesTab from "../support/pages/admin_console/manage/AttributesTab"; import ModalUtils from "../support/util/ModalUtils"; -import { keycloakBefore } from "../support/util/keycloak_before"; +import { keycloakBefore } from "../support/util/keycloak_hooks"; import GroupModal from "../support/pages/admin_console/manage/groups/GroupModal"; import UserGroupsPage from "../support/pages/admin_console/manage/users/UserGroupsPage"; import AdminClient from "../support/util/AdminClient"; diff --git a/cypress/support/util/keycloak_before.ts b/cypress/support/util/keycloak_hooks.ts similarity index 78% rename from cypress/support/util/keycloak_before.ts rename to cypress/support/util/keycloak_hooks.ts index a3ee13e674..84d7e81806 100644 --- a/cypress/support/util/keycloak_before.ts +++ b/cypress/support/util/keycloak_hooks.ts @@ -13,3 +13,7 @@ export const keycloakBefore = () => { }); cy.visit(""); }; + +export const keycloakBeforeEach = () => { + Cypress.Cookies.preserveOnce("KEYCLOAK_SESSION", "KEYCLOAK_IDENTITY"); +};