P create(AbstractPolicyRepresentation expected) {
String type = expected.getType();
- createSelect.selectByValue(type);
+ performOperationWithPageReload(() -> createSelect.selectByValue(type));
if ("role".equals(type)) {
rolePolicy.form().populate((RolePolicyRepresentation) expected);
@@ -104,7 +104,6 @@ public class Policies extends Form {
return (P) clientPolicy;
} else if ("group".equals(type)) {
groupPolicy.form().populate((GroupPolicyRepresentation) expected);
- groupPolicy.form().save();
return (P) groupPolicy;
}
@@ -115,8 +114,7 @@ public class Policies extends Form {
for (WebElement row : policies().rows()) {
PolicyRepresentation actual = policies().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
- WaitUtils.waitForPageToLoad(driver);
+ clickLink(row.findElements(tagName("a")).get(0));
String type = representation.getType();
if ("role".equals(type)) {
@@ -146,7 +144,7 @@ public class Policies extends Form {
for (WebElement row : policies().rows()) {
PolicyRepresentation actual = policies().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
+ clickLink(row.findElements(tagName("a")).get(0));
String type = actual.getType();
if ("role".equals(type)) {
return (P) rolePolicy;
@@ -174,7 +172,7 @@ public class Policies extends Form {
for (WebElement row : policies().rows()) {
PolicyRepresentation actual = policies().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
+ clickLink(row.findElements(tagName("a")).get(0));
String type = actual.getType();
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RulePolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RulePolicyForm.java
index 0ba43f14d6..3b02288a43 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RulePolicyForm.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RulePolicyForm.java
@@ -77,7 +77,7 @@ public class RulePolicyForm extends Form {
setInputValue(artifactVersion, expected.getArtifactVersion());
resolveModuleButton.click();
- WaitUtils.waitForPageToLoad(driver);
+ WaitUtils.waitForPageToLoad();
moduleName.selectByVisibleText(expected.getModuleName());
WaitUtils.pause(1000);
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java
index 199be95091..d079ce69d8 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/Resources.java
@@ -16,17 +16,17 @@
*/
package org.keycloak.testsuite.console.page.clients.authorization.resource;
-import static org.openqa.selenium.By.tagName;
-
import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.representations.idm.authorization.ResourceRepresentation;
import org.keycloak.testsuite.page.Form;
-import org.keycloak.testsuite.util.URLUtils;
import org.keycloak.testsuite.util.WaitUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
+import static org.keycloak.testsuite.util.UIUtils.clickLink;
+import static org.openqa.selenium.By.tagName;
+
/**
* @author Pedro Igor
*/
@@ -54,8 +54,8 @@ public class Resources extends Form {
for (WebElement row : resources().rows()) {
ResourceRepresentation actual = resources().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
- WaitUtils.waitForPageToLoad(driver);
+ clickLink(row.findElements(tagName("a")).get(0));
+ WaitUtils.waitForPageToLoad();
resource.form().populate(representation);
return;
}
@@ -66,8 +66,8 @@ public class Resources extends Form {
for (WebElement row : resources().rows()) {
ResourceRepresentation actual = resources().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
- WaitUtils.waitForPageToLoad(driver);
+ clickLink(row.findElements(tagName("a")).get(0));
+ WaitUtils.waitForPageToLoad();
resource.form().delete();
return;
}
@@ -89,8 +89,8 @@ public class Resources extends Form {
for (WebElement row : resources().rows()) {
ResourceRepresentation actual = resources().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
- WaitUtils.waitForPageToLoad(driver);
+ clickLink(row.findElements(tagName("a")).get(0));
+ WaitUtils.waitForPageToLoad();
return resource;
}
}
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java
index 3974e35fae..7324996aa6 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/Scopes.java
@@ -16,16 +16,16 @@
*/
package org.keycloak.testsuite.console.page.clients.authorization.scope;
-import static org.openqa.selenium.By.tagName;
-
import org.jboss.arquillian.graphene.page.Page;
import org.keycloak.representations.idm.authorization.ScopeRepresentation;
import org.keycloak.testsuite.page.Form;
-import org.keycloak.testsuite.util.URLUtils;
import org.openqa.selenium.By;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.support.FindBy;
+import static org.keycloak.testsuite.util.UIUtils.clickLink;
+import static org.openqa.selenium.By.tagName;
+
/**
* @author Pedro Igor
*/
@@ -53,7 +53,7 @@ public class Scopes extends Form {
for (WebElement row : scopes().rows()) {
ScopeRepresentation actual = scopes().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
+ clickLink(row.findElements(tagName("a")).get(0));
scope.form().populate(representation);
}
}
@@ -63,7 +63,7 @@ public class Scopes extends Form {
for (WebElement row : scopes().rows()) {
ScopeRepresentation actual = scopes().toRepresentation(row);
if (actual.getName().equalsIgnoreCase(name)) {
- URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true);
+ clickLink(row.findElements(tagName("a")).get(0));
scope.form().delete();
}
}
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/credentials/ClientCredentialsForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/credentials/ClientCredentialsForm.java
index 3ec2773e74..b29de62c0e 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/credentials/ClientCredentialsForm.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/credentials/ClientCredentialsForm.java
@@ -57,18 +57,18 @@ public class ClientCredentialsForm extends Form {
public void regenerateSecret() {
waitUntilElement(regenerateSecretButton).is().visible();
regenerateSecretButton.click();
- waitForPageToLoad(driver);
+ waitForPageToLoad();
}
public void regenerateRegistrationAccessToken() {
waitUntilElement(regenerateRegistrationAccessTokenButton).is().visible();
regenerateRegistrationAccessTokenButton.click();
- waitForPageToLoad(driver);
+ waitForPageToLoad();
}
public void generateNewKeysAndCert() {
waitUntilElement(generateNewKeysAndCert).is().visible();
generateNewKeysAndCert.click();
- waitForPageToLoad(driver);
+ waitForPageToLoad();
}
}
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java
index fbd415ab69..2458931d06 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/installation/ClientInstallationForm.java
@@ -41,7 +41,7 @@ public class ClientInstallationForm extends Form {
public void setConfigFormat(String value) {
configFormatsSelect.selectByVisibleText(value);
- WaitUtils.waitForPageToLoad(driver);
+ WaitUtils.waitForPageToLoad();
}
public String getTextareaContent() {
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/CreateClientMappersForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/CreateClientMappersForm.java
index a4b3107919..c43dfe0f52 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/CreateClientMappersForm.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/mappers/CreateClientMappersForm.java
@@ -116,7 +116,7 @@ public class CreateClientMappersForm extends Form {
}
WaitUtils.pause(1000);
selectRealmRoleButton.click();
- WaitUtils.waitForModalFadeOut(driver);
+ WaitUtils.waitForModalFadeOut();
}
public void selectClientRole(String clientName, String roleName) {
@@ -126,7 +126,7 @@ public class CreateClientMappersForm extends Form {
}
WaitUtils.pause(1000);
selectClientRoleButton.click();
- WaitUtils.waitForModalFadeOut(driver);
+ WaitUtils.waitForModalFadeOut();
}
}
diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/users/Users.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/users/Users.java
index 4232289415..ca1fa9eb18 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/users/Users.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/users/Users.java
@@ -79,18 +79,18 @@ public class Users extends AdminConsoleRealm {
}
public void clickUser(String username) {
- URLUtils.navigateToUri(driver, getRowByUsername(username).findElement(By.xpath("./td[position()=1]/a")).getAttribute("href"), true);
- waitForPageToLoad(driver);
+ URLUtils.navigateToUri(getRowByUsername(username).findElement(By.xpath("./td[position()=1]/a")).getAttribute("href"), true);
+ waitForPageToLoad();
}
public void editUser(String username) {
clickRowActionButton(getRowByUsername(username), EDIT);
- waitForPageToLoad(driver);
+ waitForPageToLoad();
}
public void impersonateUser(String username) {
clickRowActionButton(getRowByUsername(username), IMPERSONATE);
- waitForPageToLoad(driver);
+ waitForPageToLoad();
}
public void deleteUser(String username) {
diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java
index b879e18322..d0c9068a5a 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/authentication/RequiredActionsTest.java
@@ -22,10 +22,8 @@ import org.junit.Before;
import org.junit.Test;
import org.keycloak.representations.idm.UserRepresentation;
import org.keycloak.testsuite.Assert;
-import org.keycloak.testsuite.auth.page.AuthRealm;
import org.keycloak.testsuite.auth.page.login.Registration;
import org.keycloak.testsuite.console.AbstractConsoleTest;
-import org.keycloak.testsuite.console.page.AdminConsoleRealm;
import org.keycloak.testsuite.console.page.authentication.RequiredActions;
import org.keycloak.testsuite.console.page.realm.LoginSettings;
import org.openqa.selenium.By;
diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java
index 7a12f61a67..24b7a083a5 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/events/LoginEventsTest.java
@@ -62,7 +62,7 @@ public class LoginEventsTest extends AbstractConsoleTest {
resultList.get(0).findElement(By.xpath("//td[text()='LOGIN']"));
resultList.get(0).findElement(By.xpath("//td[text()='User']/../td[text()='" + testUser.getId() + "']"));
resultList.get(0).findElement(By.xpath("//td[text()='Client']/../td[text()='security-admin-console']"));
- resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1']"));
+ resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1' or text()='0:0:0:0:0:0:0:1']"));
loginEventsPage.table().reset();
loginEventsPage.table().filterForm().addEventType("LOGOUT");
@@ -73,7 +73,7 @@ public class LoginEventsTest extends AbstractConsoleTest {
assertEquals(1, resultList.size());
resultList.get(0).findElement(By.xpath("//td[text()='LOGOUT']"));
resultList.get(0).findElement(By.xpath("//td[text()='User']/../td[text()='" + testUser.getId() + "']"));
- resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1']"));
+ resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1' or text()='0:0:0:0:0:0:0:1']"));
loginEventsPage.table().reset();
loginEventsPage.table().filterForm().addEventType("LOGIN_ERROR");
@@ -86,7 +86,7 @@ public class LoginEventsTest extends AbstractConsoleTest {
resultList.get(0).findElement(By.xpath("//td[text()='User']/../td[text()='" + testUser.getId() + "']"));
resultList.get(0).findElement(By.xpath("//td[text()='Client']/../td[text()='security-admin-console']"));
resultList.get(0).findElement(By.xpath("//td[text()='Error']/../td[text()='invalid_user_credentials']"));
- resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1']"));
+ resultList.get(0).findElement(By.xpath("//td[text()='IP Address']/../td[text()='127.0.0.1' or text()='0:0:0:0:0:0:0:1']"));
}
diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/LoginSettingsTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/LoginSettingsTest.java
index 9495cdefea..d92b493884 100644
--- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/LoginSettingsTest.java
+++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/realm/LoginSettingsTest.java
@@ -42,6 +42,7 @@ import static org.keycloak.testsuite.admin.ApiUtil.createUserAndResetPasswordWit
import static org.keycloak.testsuite.admin.Users.setPasswordFor;
import static org.keycloak.testsuite.auth.page.AuthRealm.TEST;
import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWith;
+import static org.keycloak.testsuite.util.URLAssert.assertCurrentUrlStartsWithLoginUrlOf;
/**
*
@@ -136,15 +137,16 @@ public class LoginSettingsTest extends AbstractRealmTest {
log.info("edit username");
testAccountPage.navigateTo();
testRealmLoginPage.form().login(testUser);
- testAccountPage.waitForAccountLinkPresent();
+ assertCurrentUrlStartsWith(testAccountPage);
testAccountPage.setUsername(NEW_USERNAME);
testAccountPage.save();
testAccountPage.signOut();
log.debug("edited");
log.info("log in with edited username");
+ assertCurrentUrlStartsWithLoginUrlOf(testAccountPage);
testRealmLoginPage.form().login(NEW_USERNAME, PASSWORD);
- testAccountPage.waitForAccountLinkPresent();
+ assertCurrentUrlStartsWith(testAccountPage);
log.debug("user is logged in with edited username");
log.info("disabling edit username");
@@ -202,6 +204,7 @@ public class LoginSettingsTest extends AbstractRealmTest {
testAccountPage.navigateTo();
testRealmLoginPage.form().rememberMe(true);
testRealmLoginPage.form().login(testUser);
+ assertCurrentUrlStartsWith(testAccountPage);
assertTrue("Cookie KEYCLOAK_REMEMBER_ME should be present.", getCookieNames().contains("KEYCLOAK_REMEMBER_ME"));
@@ -265,7 +268,7 @@ public class LoginSettingsTest extends AbstractRealmTest {
log.info("log in as new user");
testAccountPage.navigateTo();
testRealmLoginPage.form().login(newUser);
- testAccountPage.waitForAccountLinkPresent();
+ assertCurrentUrlStartsWith(testAccountPage);
log.info("verified verify email is disabled");
diff --git a/testsuite/integration-arquillian/tests/other/nodejs_adapter/src/main/java/org/keycloak/testsuite/adapter/nodejs/page/NodejsExamplePage.java b/testsuite/integration-arquillian/tests/other/nodejs_adapter/src/main/java/org/keycloak/testsuite/adapter/nodejs/page/NodejsExamplePage.java
index 0c223f429d..0feb8ecc16 100644
--- a/testsuite/integration-arquillian/tests/other/nodejs_adapter/src/main/java/org/keycloak/testsuite/adapter/nodejs/page/NodejsExamplePage.java
+++ b/testsuite/integration-arquillian/tests/other/nodejs_adapter/src/main/java/org/keycloak/testsuite/adapter/nodejs/page/NodejsExamplePage.java
@@ -50,11 +50,11 @@ public class NodejsExamplePage extends AbstractNodejsExamplePage {
public boolean isOnLoginSecuredPage() {
UriBuilder uriBuilder = createUriBuilder().path("login");
- return URLUtils.currentUrlEqual(driver, uriBuilder.build().toASCIIString());
+ return URLUtils.currentUrlEqual(uriBuilder.build().toASCIIString());
}
@Override
public boolean isCurrent() {
- return URLUtils.currentUrlStartWith(driver, toString());
+ return URLUtils.currentUrlStartWith(toString());
}
}
diff --git a/testsuite/integration-arquillian/tests/pom.xml b/testsuite/integration-arquillian/tests/pom.xml
index 324f7265e8..4a8fb3e425 100755
--- a/testsuite/integration-arquillian/tests/pom.xml
+++ b/testsuite/integration-arquillian/tests/pom.xml
@@ -93,9 +93,12 @@