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;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
@ -77,15 +78,15 @@ public class Users extends AdminConsoleRealm {
}
public void editUser(String username) {
clickRowActionButton(getRowByLinkText(username), EDIT);
clickRowActionButton(getRowByUsername(username), EDIT);
}
public void impersonateUser(String username) {
clickRowActionButton(getRowByLinkText(username), IMPERSONATE);
clickRowActionButton(getRowByUsername(username), IMPERSONATE);
}
public void deleteUser(String username) {
clickRowActionButton(getRowByLinkText(username), DELETE);
clickRowActionButton(getRowByUsername(username), DELETE);
modalDialog.confirmDeletion();
}
@ -132,6 +133,14 @@ public class Users extends AdminConsoleRealm {
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) {
waitUntilElement(feedbackTextElement);
waitUntilElement(feedbackTextElement).is().present();
assertEquals(text, feedbackTextElement.getText());
}