Fix SecurityDefensesTest

(cherry picked from commit 1973f02)
This commit is contained in:
Vaclav Muzikar 2016-02-16 12:27:07 +01:00
parent 9bde0af0f1
commit 02851989b3
2 changed files with 13 additions and 4 deletions

View file

@ -17,6 +17,7 @@
*/ */
package org.keycloak.testsuite.console.page.users; package org.keycloak.testsuite.console.page.users;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.FindBy;
@ -77,15 +78,15 @@ public class Users extends AdminConsoleRealm {
} }
public void editUser(String username) { public void editUser(String username) {
clickRowActionButton(getRowByLinkText(username), EDIT); clickRowActionButton(getRowByUsername(username), EDIT);
} }
public void impersonateUser(String username) { public void impersonateUser(String username) {
clickRowActionButton(getRowByLinkText(username), IMPERSONATE); clickRowActionButton(getRowByUsername(username), IMPERSONATE);
} }
public void deleteUser(String username) { public void deleteUser(String username) {
clickRowActionButton(getRowByLinkText(username), DELETE); clickRowActionButton(getRowByUsername(username), DELETE);
modalDialog.confirmDeletion(); modalDialog.confirmDeletion();
} }
@ -132,6 +133,14 @@ public class Users extends AdminConsoleRealm {
return users; return users;
} }
protected WebElement getRowByUsername(String userName) {
WebElement row = body().findElement(
By.xpath(".//tr[./td/following::td[text()='" + userName + "']]")
);
waitUntilElement(row).is().present();
return row;
}
} }
} }

View file

@ -173,7 +173,7 @@ public class SecurityDefensesTest extends AbstractRealmTest {
} }
private void assertFeedbackText(String text) { private void assertFeedbackText(String text) {
waitUntilElement(feedbackTextElement); waitUntilElement(feedbackTextElement).is().present();
assertEquals(text, feedbackTextElement.getText()); assertEquals(text, feedbackTextElement.getText());
} }