diff --git a/cypress/integration/client_scopes_test.spec.ts b/cypress/integration/client_scopes_test.spec.ts index 43c2debcd6..3a0b5ca3b3 100644 --- a/cypress/integration/client_scopes_test.spec.ts +++ b/cypress/integration/client_scopes_test.spec.ts @@ -124,10 +124,10 @@ describe("Client Scopes test", () => { it("Assign role", () => { const role = "offline_access"; listingPage.searchItem(scopeName, false).goToItemDetails(scopeName); - scopeTab.goToScopeTab().clickAssignRole().selectRow(role).clickAssign(); + scopeTab.goToScopeTab().assignRole().selectRow(role).assign(); masthead.checkNotificationMessage("Role mapping updated"); scopeTab.checkRoles([role]); - scopeTab.hideInheritedRoles().selectRow(role).clickUnAssign(); + scopeTab.hideInheritedRoles().selectRow(role).unAssign(); modalUtils.checkModalTitle("Remove mapping?").confirmModal(); scopeTab.checkRoles([]); }); diff --git a/cypress/integration/clients_saml_test.spec.ts b/cypress/integration/clients_saml_test.spec.ts index 5eb180f5de..b90d19643d 100644 --- a/cypress/integration/clients_saml_test.spec.ts +++ b/cypress/integration/clients_saml_test.spec.ts @@ -5,7 +5,7 @@ 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_hooks"; -import AuthenticationTab from "../support/pages/admin_console/manage/clients/Authentication"; +import AuthenticationTab from "../support/pages/admin_console/manage/clients/AuthenticationTab"; const loginPage = new LoginPage(); const masthead = new Masthead(); @@ -137,7 +137,7 @@ describe("Clients SAML tests", () => { it("Should update the resource server settings", () => { listingPage.searchItem(clientName).goToItemDetails(clientName); - authenticationTab.goToTab(); + authenticationTab.goToAuthenticationTab(); authenticationTab.setPolicy("DISABLED").saveSettings(); masthead.checkNotificationMessage("Resource successfully updated"); @@ -145,7 +145,7 @@ describe("Clients SAML tests", () => { it("Should create a resource", () => { listingPage.searchItem(clientName).goToItemDetails(clientName); - authenticationTab.goToTab().goToResourceSubTab(); + authenticationTab.goToAuthenticationTab().goToResourceSubTab(); authenticationTab.assertDefaultResource(); authenticationTab diff --git a/cypress/integration/clients_test.spec.ts b/cypress/integration/clients_test.spec.ts index 85934eeeca..d6705cdfc3 100644 --- a/cypress/integration/clients_test.spec.ts +++ b/cypress/integration/clients_test.spec.ts @@ -64,7 +64,7 @@ describe("Clients test", () => { cy.intercept("/auth/admin/realms/master/clients/*").as("fetchClient"); listingPage.searchItem(clientId).goToItemDetails(clientId); cy.wait("@fetchClient"); - clientScopesTab.goToTab(); + clientScopesTab.goToClientScopesTab(); }); after(async () => { @@ -181,7 +181,7 @@ describe("Clients test", () => { .continue() .continue(); - advancedTab.goToTab(); + advancedTab.goToAdvancedTab(); }); afterEach(() => { @@ -191,10 +191,7 @@ describe("Clients test", () => { it("Clustering", () => { advancedTab.expandClusterNode(); - advancedTab - .clickRegisterNodeManually() - .fillHost("localhost") - .clickSaveHost(); + advancedTab.registerNodeManually().fillHost("localhost").saveHost(); advancedTab.checkTestClusterAvailability(true); }); @@ -202,11 +199,11 @@ describe("Clients test", () => { const algorithm = "ES384"; advancedTab .selectAccessTokenSignatureAlgorithm(algorithm) - .clickSaveFineGrain(); + .saveFineGrain(); advancedTab .selectAccessTokenSignatureAlgorithm("HS384") - .clickRevertFineGrain(); + .revertFineGrain(); advancedTab.checkAccessTokenSignatureAlgorithm(algorithm); }); }); @@ -215,11 +212,6 @@ describe("Clients test", () => { const serviceAccountTab = new RoleMappingTab(); const serviceAccountName = "service-account-client"; - beforeEach(() => { - keycloakBeforeEach(); - sidebarPage.goToClients(); - }); - before(() => { keycloakBefore(); loginPage.logIn(); @@ -233,6 +225,11 @@ describe("Clients test", () => { }); }); + beforeEach(() => { + keycloakBeforeEach(); + sidebarPage.goToClients(); + }); + after(() => { new AdminClient().deleteClient(serviceAccountName); }); @@ -250,10 +247,13 @@ describe("Clients test", () => { listingPage.goToItemDetails(serviceAccountName); serviceAccountTab .goToServiceAccountTab() - .clickAssignRole(false) + .assignRole(false) .selectRow("create-realm") - .clickAssign(); + .assign(); masthead.checkNotificationMessage("Role mapping updated"); + serviceAccountTab.selectRow("create-realm").unAssign(); + modalUtils.checkModalTitle("Remove mapping?").confirmModal(); + masthead.checkNotificationMessage("Scope mapping successfully removed"); }); }); diff --git a/cypress/support/pages/admin_console/manage/RoleMappingTab.ts b/cypress/support/pages/admin_console/manage/RoleMappingTab.ts index a63b6cb694..a4048b0dbb 100644 --- a/cypress/support/pages/admin_console/manage/RoleMappingTab.ts +++ b/cypress/support/pages/admin_console/manage/RoleMappingTab.ts @@ -2,13 +2,14 @@ const expect = chai.expect; export default class RoleMappingTab { private tab = "#pf-tab-serviceAccount-serviceAccount"; private scopeTab = "scopeTab"; - private assignEmptyRole = "no-roles-for-this-client-empty-action"; - private assignRole = "assignRole"; - private unAssign = "unAssignRole"; - private assign = "assign"; - private hide = "#hideInheritedRoles"; + private assignEmptyRoleBtn = "no-roles-for-this-client-empty-action"; + private assignRoleBtn = "assignRole"; + private unAssignBtn = "unAssignRole"; + private assignBtn = "assign"; + private hideInheritedRolesBtn = "#hideInheritedRoles"; private assignedRolesTable = "assigned-roles"; private namesColumn = 'td[data-label="Name"]:visible'; + private confirmModalBtn = "modalConfirm"; goToServiceAccountTab() { cy.get(this.tab).click(); @@ -20,23 +21,25 @@ export default class RoleMappingTab { return this; } - clickAssignRole(notEmpty = true) { - cy.findByTestId(notEmpty ? this.assignEmptyRole : this.assignRole).click(); + assignRole(notEmpty = true) { + cy.findByTestId( + notEmpty ? this.assignEmptyRoleBtn : this.assignRoleBtn + ).click(); return this; } - clickAssign() { - cy.findByTestId(this.assign).click(); + assign() { + cy.findByTestId(this.assignBtn).click(); return this; } - clickUnAssign() { - cy.findByTestId(this.unAssign).click(); + unAssign() { + cy.findByTestId(this.unAssignBtn).click(); return this; } hideInheritedRoles() { - cy.get(this.hide).check(); + cy.get(this.hideInheritedRolesBtn).check(); return this; } diff --git a/cypress/support/pages/admin_console/manage/clients/AdvancedTab.ts b/cypress/support/pages/admin_console/manage/clients/AdvancedTab.ts index dd9a4ff80c..0e5da0551f 100644 --- a/cypress/support/pages/admin_console/manage/clients/AdvancedTab.ts +++ b/cypress/support/pages/admin_console/manage/clients/AdvancedTab.ts @@ -1,58 +1,58 @@ import moment from "moment"; export default class AdvancedTab { - private setToNow = "#setToNow"; - private clear = "#clear"; - private push = "#push"; - private notBefore = "#kc-not-before"; + private setToNowBtn = "#setToNow"; + private clearBtn = "#clear"; + private pushBtn = "#push"; + private notBeforeInput = "#kc-not-before"; - private clusterNodesExpand = + private clusterNodesExpandBtn = ".pf-c-expandable-section .pf-c-expandable-section__toggle"; private testClusterAvailability = "#testClusterAvailability"; - private registerNodeManually = "no-nodes-registered-empty-action"; - private nodeHost = "#nodeHost"; - private addNodeConfirm = "#add-node-confirm"; + private registerNodeManuallyBtn = "no-nodes-registered-empty-action"; + private nodeHostInput = "#nodeHost"; + private addNodeConfirmBtn = "#add-node-confirm"; - private accessTokenSignatureAlgorithm = "#accessTokenSignatureAlgorithm"; - private fineGrainSave = "#fineGrainSave"; - private fineGrainRevert = "#fineGrainRevert"; + private accessTokenSignatureAlgorithmInput = "#accessTokenSignatureAlgorithm"; + private fineGrainSaveBtn = "#fineGrainSave"; + private fineGrainRevertBtn = "#fineGrainRevert"; private advancedTab = "#pf-tab-advanced-advanced"; - goToTab() { + goToAdvancedTab() { cy.get(this.advancedTab).click(); return this; } - clickSetToNow() { - cy.get(this.setToNow).click(); + setRevocationToNow() { + cy.get(this.setToNowBtn).click(); return this; } - clickClear() { - cy.get(this.clear).click(); + clearRevocation() { + cy.get(this.clearBtn).click(); return this; } - clickPush() { - cy.get(this.push).click(); + pushRevocation() { + cy.get(this.pushBtn).click(); return this; } - checkNone() { - cy.get(this.notBefore).should("have.value", "None"); + checkRevacationIsNone() { + cy.get(this.notBeforeInput).should("have.value", "None"); return this; } - checkSetToNow() { - cy.get(this.notBefore).should("have.value", moment().format("LLL")); + checkRevocationIsSetToNow() { + cy.get(this.notBeforeInput).should("have.value", moment().format("LLL")); return this; } expandClusterNode() { - cy.get(this.clusterNodesExpand).click(); + cy.get(this.clusterNodesExpandBtn).click(); return this; } @@ -64,24 +64,24 @@ export default class AdvancedTab { return this; } - clickRegisterNodeManually() { - cy.findByTestId(this.registerNodeManually).click(); + registerNodeManually() { + cy.findByTestId(this.registerNodeManuallyBtn).click(); return this; } fillHost(host: string) { - cy.get(this.nodeHost).type(host); + cy.get(this.nodeHostInput).type(host); return this; } - clickSaveHost() { - cy.get(this.addNodeConfirm).click(); + saveHost() { + cy.get(this.addNodeConfirmBtn).click(); return this; } selectAccessTokenSignatureAlgorithm(algorithm: string) { - cy.get(this.accessTokenSignatureAlgorithm).click(); - cy.get(this.accessTokenSignatureAlgorithm + " + ul") + cy.get(this.accessTokenSignatureAlgorithmInput).click(); + cy.get(this.accessTokenSignatureAlgorithmInput + " + ul") .contains(algorithm) .click(); @@ -89,17 +89,20 @@ export default class AdvancedTab { } checkAccessTokenSignatureAlgorithm(algorithm: string) { - cy.get(this.accessTokenSignatureAlgorithm).should("have.text", algorithm); + cy.get(this.accessTokenSignatureAlgorithmInput).should( + "have.text", + algorithm + ); return this; } - clickSaveFineGrain() { - cy.get(this.fineGrainSave).click(); + saveFineGrain() { + cy.get(this.fineGrainSaveBtn).click(); return this; } - clickRevertFineGrain() { - cy.get(this.fineGrainRevert).click(); + revertFineGrain() { + cy.get(this.fineGrainRevertBtn).click(); return this; } } diff --git a/cypress/support/pages/admin_console/manage/clients/Authentication.ts b/cypress/support/pages/admin_console/manage/clients/AuthenticationTab.ts similarity index 98% rename from cypress/support/pages/admin_console/manage/clients/Authentication.ts rename to cypress/support/pages/admin_console/manage/clients/AuthenticationTab.ts index 856124f48d..186c4cc84d 100644 --- a/cypress/support/pages/admin_console/manage/clients/Authentication.ts +++ b/cypress/support/pages/admin_console/manage/clients/AuthenticationTab.ts @@ -6,7 +6,7 @@ export default class AuthenticationTab { private nameColumnPrefix = "name-column-"; private createResourceButton = "createResource"; - goToTab() { + goToAuthenticationTab() { cy.get(this.tabName).click(); return this; } diff --git a/cypress/support/pages/admin_console/manage/clients/ClientScopesTab.ts b/cypress/support/pages/admin_console/manage/clients/ClientScopesTab.ts index f46c81a6c8..73b05a8a91 100644 --- a/cypress/support/pages/admin_console/manage/clients/ClientScopesTab.ts +++ b/cypress/support/pages/admin_console/manage/clients/ClientScopesTab.ts @@ -1,7 +1,7 @@ export default class ClientScopesTab { private clientScopesTab = "#pf-tab-clientScopes-clientScopes"; - goToTab() { + goToClientScopesTab() { cy.get(this.clientScopesTab).click(); return this; } diff --git a/src/user-federation/UserFederationSection.tsx b/src/user-federation/UserFederationSection.tsx index f89c39ab08..eb6a22db11 100644 --- a/src/user-federation/UserFederationSection.tsx +++ b/src/user-federation/UserFederationSection.tsx @@ -72,7 +72,9 @@ export default function UserFederationSection() { history.push(toProvider({ realm, providerId: p.id!, id: "new" })) } > - {toUpperCase(p.id)} + {p.id.toUpperCase() == "LDAP" + ? p.id.toUpperCase() + : toUpperCase(p.id)} )), []