From fe740c0c218bd66846eb55bf66646863d257ce8b Mon Sep 17 00:00:00 2001 From: Erik Jan de Wit Date: Tue, 10 Aug 2021 14:41:56 +0200 Subject: [PATCH] added test for adding service account role (#954) --- cypress/integration/clients_test.spec.ts | 10 ++++++++++ .../pages/admin_console/manage/RoleMappingTab.ts | 7 ++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/cypress/integration/clients_test.spec.ts b/cypress/integration/clients_test.spec.ts index 3b3169717b..0844406fe4 100644 --- a/cypress/integration/clients_test.spec.ts +++ b/cypress/integration/clients_test.spec.ts @@ -188,6 +188,16 @@ describe("Clients test", function () { .goToServiceAccountTab() .checkRoles(["manage-account", "offline_access", "uma_authorization"]); }); + + it("assign", () => { + listingPage.goToItemDetails(serviceAccountName); + serviceAccountTab + .goToServiceAccountTab() + .clickAssignRole(false) + .selectRow("create-realm") + .clickAssign(); + masthead.checkNotificationMessage("Role mapping updated"); + }); }); describe("Keys tab test", () => { diff --git a/cypress/support/pages/admin_console/manage/RoleMappingTab.ts b/cypress/support/pages/admin_console/manage/RoleMappingTab.ts index 30bf1f2b74..4c01c2916b 100644 --- a/cypress/support/pages/admin_console/manage/RoleMappingTab.ts +++ b/cypress/support/pages/admin_console/manage/RoleMappingTab.ts @@ -2,7 +2,8 @@ const expect = chai.expect; export default class RoleMappingTab { private tab = "#pf-tab-serviceAccount-serviceAccount"; private scopeTab = "scopeTab"; - private assignRole = "no-roles-for-this-client-empty-action"; + private assignEmptyRole = "no-roles-for-this-client-empty-action"; + private assignRole = "assignRole"; private unAssign = "unAssignRole"; private assign = "assign"; private hide = "#hideInheritedRoles"; @@ -19,8 +20,8 @@ export default class RoleMappingTab { return this; } - clickAssignRole() { - cy.getId(this.assignRole).click(); + clickAssignRole(notEmpty = true) { + cy.getId(notEmpty ? this.assignEmptyRole : this.assignRole).click(); return this; }