KEYCLOAK-5816, KEYCLOAK-5815 UI tests fixes

This commit is contained in:
vmuzikar 2017-11-23 13:51:38 +01:00
parent 94ba85c210
commit 6f4ab8870e
17 changed files with 265 additions and 133 deletions

View file

@ -25,6 +25,7 @@ import org.openqa.selenium.support.FindBy;
import java.util.List;
import static org.keycloak.testsuite.util.UIUtils.clickLink;
import static org.keycloak.testsuite.util.WaitUtils.pause;
import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
import static org.openqa.selenium.By.xpath;
@ -55,17 +56,15 @@ public class DataTable {
public void search(String pattern) {
searchInput.sendKeys(pattern);
searchButton.click();
clickLink(searchButton);
}
public void clickHeaderButton(String buttonText) {
header.findElement(By.xpath(".//button[text()='" + buttonText + "']")).click();
waitForPageToLoad();
clickLink(header.findElement(By.xpath(".//button[text()='" + buttonText + "']")));
}
public void clickHeaderLink(String linkText) {
header.findElement(By.linkText(linkText)).click();
waitForPageToLoad();
clickLink(header.findElement(By.linkText(linkText)));
}
public WebElement body() {
@ -73,6 +72,7 @@ public class DataTable {
}
public List<WebElement> rows() {
waitForPageToLoad();
pause(500); // wait a bit to ensure the table is no more changing
return rows;
}
@ -83,11 +83,11 @@ public class DataTable {
}
public void clickRowByLinkText(String text) {
body.findElement(By.xpath(".//tr/td/a[text()='" + text + "']")).click();
clickLink(body.findElement(By.xpath(".//tr/td/a[text()='" + text + "']")));
}
public void clickRowActionButton(WebElement row, String buttonText) {
row.findElement(xpath(".//td[contains(@class, 'kc-action-cell') and text()='" + buttonText + "']")).click();
clickLink(row.findElement(xpath(".//td[contains(@class, 'kc-action-cell') and text()='" + buttonText + "']")));
}
}

View file

@ -25,6 +25,7 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import static org.jboss.arquillian.graphene.Graphene.guardAjax;
import static org.keycloak.testsuite.util.UIUtils.clickLink;
/**
*
@ -46,8 +47,7 @@ public class Form {
public void save() {
// guardAjax(save).click();
save.click();
WaitUtils.waitForPageToLoad();
clickLink(save);
}
public void cancel() {

View file

@ -22,9 +22,9 @@ import org.keycloak.representations.idm.authorization.PolicyRepresentation;
import org.keycloak.representations.idm.authorization.ResourcePermissionRepresentation;
import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation;
import org.keycloak.testsuite.console.page.clients.authorization.policy.PolicyTypeUI;
import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
@ -49,6 +49,9 @@ public class Permissions extends Form {
@Page
private ScopePermission scopePermission;
@Page
private ModalDialog modalDialog;
public PermissionsTable permissions() {
return table;
}
@ -130,7 +133,7 @@ public class Permissions extends Form {
PolicyRepresentation actual = permissions().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
row.findElements(tagName("td")).get(4).click();
driver.findElement(By.xpath(".//button[text()='Delete']")).click();
modalDialog.confirmDeletion();
return;
}
}

View file

@ -16,21 +16,11 @@
*/
package org.keycloak.testsuite.console.page.clients.authorization.policy;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
import static org.openqa.selenium.By.tagName;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.jboss.arquillian.drone.api.annotation.Drone;
import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.representations.idm.authorization.GroupPolicyRepresentation;
import org.keycloak.representations.idm.authorization.Logic;
import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
@ -38,6 +28,12 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import java.util.HashSet;
import java.util.List;
import static org.keycloak.testsuite.util.WaitUtils.waitUntilElement;
import static org.openqa.selenium.By.tagName;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
@ -58,12 +54,12 @@ public class GroupPolicyForm extends Form {
@FindBy(xpath = "//i[contains(@class,'pficon-delete')]")
private WebElement deleteButton;
@FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']")
private WebElement confirmDelete;
@FindBy(id = "selectGroup")
private WebElement selectGroupButton;
@Page
private ModalDialog modalDialog;
@Drone
private WebDriver driver;
@ -131,7 +127,7 @@ public class GroupPolicyForm extends Form {
public void delete() {
deleteButton.click();
confirmDelete.click();
modalDialog.confirmDeletion();
}
public GroupPolicyRepresentation toRepresentation() {

View file

@ -27,8 +27,8 @@ import org.keycloak.representations.idm.authorization.RolePolicyRepresentation;
import org.keycloak.representations.idm.authorization.RulePolicyRepresentation;
import org.keycloak.representations.idm.authorization.TimePolicyRepresentation;
import org.keycloak.representations.idm.authorization.UserPolicyRepresentation;
import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
@ -72,6 +72,9 @@ public class Policies extends Form {
@Page
private GroupPolicy groupPolicy;
@Page
private ModalDialog modalDialog;
public PoliciesTable policies() {
return table;
}
@ -204,7 +207,7 @@ public class Policies extends Form {
PolicyRepresentation actual = policies().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
row.findElements(tagName("td")).get(4).click();
driver.findElement(By.xpath(".//button[text()='Delete']")).click();
modalDialog.confirmDeletion();
return;
}
}

View file

@ -25,6 +25,12 @@ import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import org.openqa.selenium.support.ui.Select;
import java.util.concurrent.TimeUnit;
import static org.jboss.arquillian.graphene.Graphene.waitGui;
import static org.keycloak.testsuite.util.UIUtils.clickLink;
import static org.openqa.selenium.By.id;
/**
* @author <a href="mailto:psilva@redhat.com">Pedro Igor</a>
*/
@ -76,8 +82,8 @@ public class RulePolicyForm extends Form {
setInputValue(artifactId, expected.getArtifactId());
setInputValue(artifactVersion, expected.getArtifactVersion());
resolveModuleButton.click();
WaitUtils.waitForPageToLoad();
clickLink(resolveModuleButton);
waitGui().withTimeout(30, TimeUnit.SECONDS).until().element(id("moduleName")).is().enabled();
moduleName.selectByVisibleText(expected.getModuleName());
WaitUtils.pause(1000);

View file

@ -18,9 +18,9 @@ package org.keycloak.testsuite.console.page.clients.authorization.resource;
import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@ -41,6 +41,9 @@ public class Resources extends Form {
@Page
private Resource resource;
@Page
private ModalDialog modalDialog;
public ResourcesTable resources() {
return table;
}
@ -79,7 +82,7 @@ public class Resources extends Form {
ResourceRepresentation actual = resources().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
row.findElements(tagName("td")).get(6).click();
driver.findElement(By.xpath(".//button[text()='Delete']")).click();
modalDialog.confirmDeletion();
return;
}
}

View file

@ -18,8 +18,8 @@ package org.keycloak.testsuite.console.page.clients.authorization.scope;
import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.representations.idm.authorization.ScopeRepresentation;
import org.keycloak.testsuite.console.page.fragment.ModalDialog;
import org.keycloak.testsuite.page.Form;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@ -40,6 +40,9 @@ public class Scopes extends Form {
@Page
private Scope scope;
@Page
private ModalDialog modalDialog;
public ScopesTable scopes() {
return table;
}
@ -74,7 +77,7 @@ public class Scopes extends Form {
ScopeRepresentation actual = scopes().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
row.findElements(tagName("td")).get(3).click();
driver.findElement(By.xpath(".//button[text()='Delete']")).click();
modalDialog.confirmDeletion();
}
}
}

View file

@ -28,9 +28,9 @@ public class ClientRole extends ClientRoles {
return getUriParameter(ROLE_ID).toString();
}
private RoleForm form;
private RoleDetailsForm form;
public RoleForm form() {
public RoleDetailsForm form() {
return form;
}

View file

@ -14,9 +14,9 @@ public class CreateRole extends AdminConsoleCreate {
}
@Page
private RoleForm form;
private RoleDetailsForm form;
public RoleForm form() {
public RoleDetailsForm form() {
return form;
}

View file

@ -1,6 +1,9 @@
package org.keycloak.testsuite.console.page.roles;
import org.jboss.arquillian.graphene.page.Page;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import static org.keycloak.testsuite.util.UIUtils.clickLink;
/**
*
@ -23,11 +26,34 @@ public class Role extends RealmRoles {
return getUriParameter(ROLE_ID).toString();
}
@Page
private RoleForm form;
@FindBy(css = "ul.nav-tabs")
private RoleTabs tabs;
public RoleForm form() {
return form;
public RoleTabs roleTabs() {
return tabs;
}
public class RoleTabs {
@FindBy(linkText = "Details")
private WebElement detailsTab;
@FindBy(linkText = "Permissions")
private WebElement permissionsTab;
@FindBy(linkText = "Users in Role")
private WebElement usersInRoleTab;
public void details() {
clickLink(detailsTab);
}
public void permissions() {
clickLink(permissionsTab);
}
public void usersInRole() {
clickLink(usersInRoleTab);
}
}
}

View file

@ -0,0 +1,33 @@
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.console.page.roles;
import org.jboss.arquillian.graphene.page.Page;
/**
* @author Vaclav Muzikar <vmuzikar@redhat.com>
*/
public class RoleDetails extends Role {
@Page
private RoleDetailsForm form;
public RoleDetailsForm form() {
return form;
}
}

View file

@ -10,7 +10,7 @@ import org.openqa.selenium.support.FindBy;
*
* @author tkyjovsk
*/
public class RoleForm extends Form {
public class RoleDetailsForm extends Form {
@FindBy(id = "name")
private WebElement nameInput;

View file

@ -0,0 +1,84 @@
/*
* Copyright 2017 Red Hat, Inc. and/or its affiliates
* and other contributors as indicated by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.keycloak.testsuite.console.page.roles;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.console.page.fragment.DataTable;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static org.openqa.selenium.By.tagName;
import static org.openqa.selenium.By.xpath;
/**
* @author Vaclav Muzikar <vmuzikar@redhat.com>
*/
public class UsersInRole extends Role {
@FindBy(css = "table[class*='table']")
private UsersInRoleTable usersInRoleTable;
public UsersInRoleTable usersTable() {
return usersInRoleTable;
}
public class UsersInRoleTable extends DataTable {
public void clickUser(String userName) {
clickRowByLinkText(userName);
}
public void editUser(String userName) {
clickRowActionButton(getRowByLinkText(userName), "Edit");
}
public UserRepresentation getUserFromTableRow(WebElement row) {
UserRepresentation user = null;
List<WebElement> tds = row.findElements(tagName("td"));
if (tds.size() == 5 && !tds.get(0).getText().isEmpty()) {
user = new UserRepresentation();
user.setUsername(tds.get(0).getText());
user.setLastName(tds.get(1).getText());
user.setFirstName(tds.get(2).getText());
user.setEmail(tds.get(3).getText());
}
return user;
}
public List<UserRepresentation> getUsersFromTableRows() {
return rows().stream()
.map(this::getUserFromTableRow)
.filter(Objects::nonNull)
.collect(Collectors.toList());
}
public boolean noRoleMembersIsDisplayed() {
try {
return body().findElement(xpath(".//td[text()='No role members' and not(contains(@class, 'ng-hide'))]")).isDisplayed();
}
catch (NoSuchElementException e) {
return false;
}
}
}
}

View file

@ -21,7 +21,6 @@ import org.jboss.arquillian.drone.api.annotation.Drone;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.console.page.AdminConsoleRealm;
import org.keycloak.testsuite.console.page.fragment.DataTable;
import org.keycloak.testsuite.util.URLUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
@ -30,8 +29,8 @@ import org.openqa.selenium.support.FindBy;
import java.util.ArrayList;
import java.util.List;
import static org.keycloak.testsuite.util.WaitUtils.waitForPageToLoad;
import static org.openqa.selenium.By.*;
import static org.keycloak.testsuite.util.UIUtils.clickLink;
import static org.openqa.selenium.By.tagName;
/**
*
@ -79,18 +78,15 @@ public class Users extends AdminConsoleRealm {
}
public void clickUser(String username) {
URLUtils.navigateToUri(getRowByUsername(username).findElement(By.xpath("./td[position()=1]/a")).getAttribute("href"), true);
waitForPageToLoad();
clickLink(getRowByUsername(username).findElement(By.xpath("./td[position()=1]/a")));
}
public void editUser(String username) {
clickRowActionButton(getRowByUsername(username), EDIT);
waitForPageToLoad();
}
public void impersonateUser(String username) {
clickRowActionButton(getRowByUsername(username), IMPERSONATE);
waitForPageToLoad();
}
public void deleteUser(String username) {

View file

@ -7,10 +7,13 @@ import org.junit.Test;
import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.testsuite.console.page.roles.CreateRole;
import org.keycloak.testsuite.console.page.roles.RealmRoles;
import org.keycloak.testsuite.console.page.roles.Role;
import org.keycloak.testsuite.console.page.roles.RoleDetails;
import org.keycloak.testsuite.util.Timer;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
import static org.keycloak.testsuite.util.WaitUtils.pause;
@ -26,7 +29,7 @@ public class RealmRolesTest extends AbstractRolesTest {
@Page
private CreateRole createRolePage;
@Page
private Role rolePage;
private RoleDetails roleDetailsPage;
private RoleRepresentation testRole;
@ -51,10 +54,10 @@ public class RealmRolesTest extends AbstractRolesTest {
assertCurrentUrlEquals(realmRolesPage);
realmRolesPage.table().editRole(roleRep.getName());
// assertCurrentUrl(role); // can't do this, role id needed as uri param
rolePage.form().setBasicAttributes(roleRep);
rolePage.form().save();
roleDetailsPage.form().setBasicAttributes(roleRep);
roleDetailsPage.form().save();
assertAlertSuccess();
rolePage.form().setCompositeRoles(roleRep);
roleDetailsPage.form().setCompositeRoles(roleRep);
}
public void assertBasicRoleAttributesEqual(RoleRepresentation r1, RoleRepresentation r2) {
@ -72,12 +75,12 @@ public class RealmRolesTest extends AbstractRolesTest {
RoleRepresentation foundRole = realmRolesPage.table().findRole(testRole.getName()); // search & get role from table
assertBasicRoleAttributesEqual(testRole, foundRole);
realmRolesPage.table().editRole(testRole.getName());
foundRole = rolePage.form().getBasicAttributes();
foundRole = roleDetailsPage.form().getBasicAttributes();
assertBasicRoleAttributesEqual(testRole, foundRole);
testRole.setDescription("updated role description");
rolePage.form().setDescription(testRole.getDescription());
rolePage.form().save();
roleDetailsPage.form().setDescription(testRole.getDescription());
roleDetailsPage.form().save();
assertAlertSuccess();
configure().roles();
@ -96,7 +99,7 @@ public class RealmRolesTest extends AbstractRolesTest {
// add again
addRole(testRole);
// delete from page
rolePage.form().delete();
roleDetailsPage.form().delete();
modalDialog.confirmDeletion();
assertCurrentUrlEquals(realmRolesPage);
}

View file

@ -3,33 +3,28 @@
*/
package org.keycloak.testsuite.console.roles;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.admin.ApiUtil.createUserWithAdminClient;
import java.util.Collections;
import java.util.LinkedList;
import java.util.List;
import org.jboss.arquillian.graphene.page.Page;
import org.junit.Before;
import org.junit.Test;
import org.keycloak.admin.client.resource.RoleResource;
import org.keycloak.admin.client.resource.RolesResource;
import org.keycloak.admin.client.resource.UserResource;
import org.keycloak.representations.idm.RoleRepresentation;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.console.page.roles.DefaultRoles;
import org.keycloak.testsuite.console.page.roles.RealmRoles;
import org.keycloak.testsuite.console.page.roles.Role;
import org.keycloak.testsuite.console.page.roles.Roles;
import org.keycloak.testsuite.console.page.roles.UsersInRole;
import org.keycloak.testsuite.console.page.users.UserRoleMappings;
import org.keycloak.testsuite.console.page.users.Users;
import org.keycloak.testsuite.util.RealmRepUtil;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.keycloak.testsuite.admin.ApiUtil.assignRealmRoles;
import static org.keycloak.testsuite.admin.ApiUtil.createUserWithAdminClient;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlEquals;
/**
* @author <a href="mailto:antonio.ferreira@fiercely.pt">Antonio Ferreira</a>
* See KEYCLOAK-2035
*
* @author <a href="mailto:antonio.ferreira@fiercely.pt">Antonio Ferreira</a>
* @author Vaclav Muzikar <vmuzikar@redhat.com>
*/
public class UsersInRoleTest extends AbstractRolesTest {
@ -39,80 +34,61 @@ public class UsersInRoleTest extends AbstractRolesTest {
@Page
private UserRoleMappings userRolesPage;
@Page
private Users usersPage;
@Page
private Roles rolesPage;
@Page
private Role rolePage;
private UsersInRole usersInRolePage;
@Page
private RealmRoles realmRolesPage;
private RoleRepresentation testRoleRep;
private RoleRepresentation emptyTestRoleRep;
private UserRepresentation newUser;
@Before
public void beforeDefaultRolesTest() {
public void beforeUsersInRoleTestClass() {
// create a role via admin client
testRoleRep = new RoleRepresentation("test-role", "", false);
rolesResource().create(testRoleRep);
testRealmResource().roles().create(testRoleRep);
emptyTestRoleRep = new RoleRepresentation("empty-test-role", "", false);
testRealmResource().roles().create(emptyTestRoleRep);
newUser = new UserRepresentation();
newUser.setUsername("test_user");
newUser.setEnabled(true);
newUser.setEmail("test-role-member@test-role-member.com");
newUser.setRequiredActions(Collections.<String>emptyList());
//testRealmResource().users().create(newUser);
createUserWithAdminClient(testRealmResource(), newUser);
rolesResource().create(testRoleRep);
rolesPage.navigateTo();
newUser.setId(createUserWithAdminClient(testRealmResource(), newUser));
assignRealmRoles(testRealmResource(), newUser.getId(), testRoleRep.getName());
userPage.setId(newUser.getId());
}
public RolesResource rolesResource() {
return testRealmResource().roles();
}
//Added for KEYCLOAK-2035
@Test
public void usersInRoleTabIsPresent() {
public void userInRoleIsPresent() {
// Clicking user name link
navigateToUsersInRole(testRoleRep);
assertEquals(1, usersInRolePage.usersTable().getUsersFromTableRows().size());
usersInRolePage.usersTable().clickUser(newUser.getUsername());
assertCurrentUrlEquals(userPage);
rolesPage.navigateTo();
rolesPage.tabs().realmRoles();
realmRolesPage.table().search(testRoleRep.getName());
realmRolesPage.table().clickRole(testRoleRep.getName());
//assert no users in list
//Role Page class missing a getUsers() method
List<UserRepresentation> users = testRealmResource().users().search("test_user", null, null, null, null, null);
assertEquals(1, users.size());
UserResource user = testRealmResource().users().get(users.get(0).getId());
UserRepresentation userRep = user.toRepresentation();
usersPage.navigateTo();
usersPage.table().search(userRep.getUsername());
usersPage.table().clickUser(userRep.getUsername());
assertFalse(userRolesPage.form().isAssignedRole(testRoleRep.getName()));
RoleResource roleResource = testRealmResource().roles().get(testRoleRep.getName());
List<RoleRepresentation> rolesToAdd = new LinkedList<>();
rolesToAdd.add(roleResource.toRepresentation());
testRealmResource().users().get(userRep.getId()).roles().realmLevel().add(rolesToAdd);
rolesPage.navigateTo();
rolesPage.tabs().realmRoles();
realmRolesPage.table().search(testRoleRep.getName());
realmRolesPage.table().clickRole(testRoleRep.getName());
assertTrue(userRolesPage.form().isAssignedRole(testRoleRep.getName()));
// Clicking edit button
navigateToUsersInRole(testRoleRep);
usersInRolePage.usersTable().editUser(newUser.getUsername());
assertCurrentUrlEquals(userPage);
}
@Test
public void emptyRoleTest() {
navigateToUsersInRole(emptyTestRoleRep);
assertEquals(0, usersInRolePage.usersTable().getUsersFromTableRows().size());
assertTrue("No roles members message is not displayed", usersInRolePage.usersTable().noRoleMembersIsDisplayed());
}
private void navigateToUsersInRole(RoleRepresentation role) {
realmRolesPage.navigateTo();
realmRolesPage.tabs().realmRoles();
realmRolesPage.table().clickRole(role.getName());
usersInRolePage.roleTabs().usersInRole();
}
}