diff --git a/js/apps/admin-ui/cypress/e2e/realm_roles_test.spec.ts b/js/apps/admin-ui/cypress/e2e/realm_roles_test.spec.ts index b75025598d..93994f140a 100644 --- a/js/apps/admin-ui/cypress/e2e/realm_roles_test.spec.ts +++ b/js/apps/admin-ui/cypress/e2e/realm_roles_test.spec.ts @@ -127,8 +127,25 @@ describe("Realm roles test", () => { masthead.checkNotificationMessage("Associated roles have been added", true); }); - it("Should search existing associated role by name", () => { - listingPage.searchItem("create-realm", false).itemExist("create-realm"); + it("should search existing associated role by name and go to it", () => { + listingPage + .searchItem("create-realm", false) + .itemExist("create-realm") + .goToItemDetails("create-realm"); + + cy.findByTestId("view-header").should("contain.text", "create-realm"); + cy.findByTestId("cancel").click(); + }); + + it("should go to default-roles-master link role name and check assign roles table is not empty", () => { + listingPage.goToItemDetails("default-roles-master"); + + rolesTab.goToDefaultGroupsTab(); + cy.findByTestId("assigned-roles").find("tr").should("have.length.gt", 0); + cy.findByTestId("empty-state").contains("No default groups"); + + rolesTab.goToDefaultRolesTab(); + cy.findByTestId("assigned-roles").find("tr").should("have.length.gt", 0); }); it("Should search non-existent associated role by name", () => { @@ -283,11 +300,20 @@ describe("Realm roles test", () => { }); const role = "a11y-role"; + const defaultRolesMaster = "default-roles-master"; it("Check a11y violations on load/ realm roles", () => { cy.checkA11y(); }); + it("Check a11y violations on default-roles-master default tab and default roles tabs", () => { + listingPage.goToItemDetails(defaultRolesMaster); + cy.checkA11y(); + + rolesTab.goToDefaultGroupsTab(); + cy.checkA11y(); + }); + it("Check a11y violations on empty create role form", () => { rolesTab.goToCreateRoleFromToolbar(); cy.checkA11y(); diff --git a/js/apps/admin-ui/cypress/e2e/realm_user_registration.spec.ts b/js/apps/admin-ui/cypress/e2e/realm_user_registration.spec.ts index d255691887..0e04163435 100644 --- a/js/apps/admin-ui/cypress/e2e/realm_user_registration.spec.ts +++ b/js/apps/admin-ui/cypress/e2e/realm_user_registration.spec.ts @@ -1,4 +1,5 @@ import ListingPage from "../support/pages/admin-ui/ListingPage"; +import ClientRolesTab from "../support/pages/admin-ui/manage/clients/ClientRolesTab"; import UserRegistration, { GroupPickerDialog, } from "../support/pages/admin-ui/manage/realm_settings/UserRegistration"; @@ -18,6 +19,7 @@ describe("Realm settings - User registration tab", () => { const listingPage = new ListingPage(); const groupPicker = new GroupPickerDialog(); const userRegistration = new UserRegistration(); + const rolesTab = new ClientRolesTab(); const groupName = "The default group"; @@ -39,6 +41,11 @@ describe("Realm settings - User registration tab", () => { userRegistration.selectRow(role).assign(); masthead.checkNotificationMessage("Associated roles have been added"); listingPage.searchItem(role, false).itemExist(role); + + sidebarPage.goToRealmRoles(); + listingPage.goToItemDetails("admin"); + rolesTab.goToUsersInRoleTab(); + cy.findByTestId("users-in-role-table").contains("admin"); }); it("Remove admin role", () => { diff --git a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/clients/ClientRolesTab.ts b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/clients/ClientRolesTab.ts index a1ca765877..5f07c6da59 100644 --- a/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/clients/ClientRolesTab.ts +++ b/js/apps/admin-ui/cypress/support/pages/admin-ui/manage/clients/ClientRolesTab.ts @@ -13,6 +13,8 @@ export default class ClientRolesTab extends CommonPage { #hideInheritedRolesChkBox = "#hideInheritedRoles"; #rolesTab = "rolesTab"; #associatedRolesTab = "associatedRolesTab"; + #defaultRolesTab = "default-roles-tab"; + #defaultGroupsTab = "default-groups-tab"; goToDetailsTab() { this.tabUtils().clickTab(ClientRolesTabItems.Details); @@ -63,4 +65,14 @@ export default class ClientRolesTab extends CommonPage { cy.get(this.#hideInheritedRolesChkBox).check(); return this; } + + goToDefaultRolesTab() { + cy.findByTestId(this.#defaultRolesTab).click(); + return this; + } + + goToDefaultGroupsTab() { + cy.findByTestId(this.#defaultGroupsTab).click(); + return this; + } } diff --git a/js/apps/admin-ui/src/realm-roles/UsersInRoleTab.tsx b/js/apps/admin-ui/src/realm-roles/UsersInRoleTab.tsx index 136f9f3ef4..d1b735744f 100644 --- a/js/apps/admin-ui/src/realm-roles/UsersInRoleTab.tsx +++ b/js/apps/admin-ui/src/realm-roles/UsersInRoleTab.tsx @@ -50,6 +50,7 @@ export const UsersInRoleTab = () => { loader={loader} ariaLabelKey="roleList" searchPlaceholderKey="" + data-testid="users-in-role-table" toolbarItem={ enabled && ( { id="roles" eventKey={10} title={{t("defaultRoles")}} + data-testid="default-roles-tab" > { id="groups" eventKey={20} title={{t("defaultGroups")}} + data-testid="default-groups-tab" >