From 35857bf649c4aa5e895d998d70b18502a600f4e4 Mon Sep 17 00:00:00 2001 From: Vaclav Muzikar Date: Tue, 13 Jun 2017 11:24:45 +0200 Subject: [PATCH] KEYCLOAK-5055 Stabilize UI tests --- testsuite/integration-arquillian/HOW-TO-RUN.md | 2 ++ .../console/page/fragment/AdminConsoleAlert.java | 5 +++++ .../authorization/permission/Permissions.java | 9 ++++----- .../permission/ResourcePermissionForm.java | 7 ++++--- .../permission/ScopePermissionForm.java | 7 ++++--- .../policy/AggregatePolicyForm.java | 7 ++++--- .../authorization/policy/ClientPolicyForm.java | 7 ++++--- .../authorization/policy/JSPolicyForm.java | 7 ++++--- .../clients/authorization/policy/Policies.java | 16 ++++------------ .../authorization/policy/RolePolicyForm.java | 7 ++++--- .../authorization/policy/RulePolicyForm.java | 7 ++++--- .../authorization/policy/TimePolicyForm.java | 7 ++++--- .../authorization/policy/UserPolicyForm.java | 7 ++++--- .../authorization/resource/ResourceForm.java | 7 ++++--- .../authorization/resource/Resources.java | 7 ++++--- .../clients/authorization/scope/ScopeForm.java | 7 ++++--- .../page/clients/authorization/scope/Scopes.java | 5 +++-- .../console/clients/ClientMappersOIDCTest.java | 4 +--- 18 files changed, 67 insertions(+), 58 deletions(-) diff --git a/testsuite/integration-arquillian/HOW-TO-RUN.md b/testsuite/integration-arquillian/HOW-TO-RUN.md index 14ebce5c8d..a5fb843cfd 100644 --- a/testsuite/integration-arquillian/HOW-TO-RUN.md +++ b/testsuite/integration-arquillian/HOW-TO-RUN.md @@ -246,6 +246,8 @@ The UI tests are focused on the Admin Console as well as on some login scenarios The tests also use some constants placed in [test-constants.properties](tests/base/src/test/resources/test-constants.properties). A different file can be specified by `-Dtestsuite.constants=path/to/different-test-constants.properties` +In case a custom `settings.xml` is used for Maven, you need to specify it also in `-Dkie.maven.settings.custom=path/to/settings.xml`. + #### Execution example ``` mvn -f testsuite/integration-arquillian/tests/other/console/pom.xml \ diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/AdminConsoleAlert.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/AdminConsoleAlert.java index 9e582d8a04..bc089a94ce 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/AdminConsoleAlert.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/console/page/fragment/AdminConsoleAlert.java @@ -16,7 +16,9 @@ */ package org.keycloak.testsuite.console.page.fragment; +import org.jboss.arquillian.graphene.fragment.Root; import org.keycloak.testsuite.page.AbstractAlert; +import org.keycloak.testsuite.util.WaitUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -44,6 +46,9 @@ public class AdminConsoleAlert extends AbstractAlert { public void close() { closeButton.click(); + WaitUtils.pause(500); // Sometimes, when a test is too fast, + // one of the consecutive alerts is not displayed; + // to prevent this we need to slow down a bit } } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/Permissions.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/Permissions.java index a6c95276d8..fee3da3e57 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/Permissions.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/Permissions.java @@ -25,6 +25,7 @@ import org.keycloak.representations.idm.authorization.ResourcePermissionRepresen import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation; import org.keycloak.testsuite.console.page.clients.authorization.policy.PolicyTypeUI; import org.keycloak.testsuite.page.Form; +import org.keycloak.testsuite.util.URLUtils; import org.keycloak.testsuite.util.WaitUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -58,11 +59,9 @@ public class Permissions extends Form { if ("resource".equals(type)) { resourcePermission.form().populate((ResourcePermissionRepresentation) expected); - resourcePermission.form().save(); return (P) resourcePermission; } else if ("scope".equals(type)) { scopePermission.form().populate((ScopePermissionRepresentation) expected); - scopePermission.form().save(); return (P) scopePermission; } @@ -73,7 +72,7 @@ public class Permissions extends Form { for (WebElement row : permissions().rows()) { PolicyRepresentation actual = permissions().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); String type = representation.getType(); @@ -92,7 +91,7 @@ public class Permissions extends Form { for (WebElement row : permissions().rows()) { PolicyRepresentation actual = permissions().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); String type = actual.getType(); if ("resource".equals(type)) { @@ -109,7 +108,7 @@ public class Permissions extends Form { for (WebElement row : permissions().rows()) { PolicyRepresentation actual = permissions().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); String type = actual.getType(); diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ResourcePermissionForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ResourcePermissionForm.java index cf39523b21..e31ac2a43f 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ResourcePermissionForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ResourcePermissionForm.java @@ -18,6 +18,7 @@ package org.keycloak.testsuite.console.page.clients.authorization.permission; import org.keycloak.representations.idm.authorization.DecisionStrategy; import org.keycloak.representations.idm.authorization.ResourcePermissionRepresentation; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.MultipleStringSelect2; import org.keycloak.testsuite.console.page.fragment.OnOffSwitch; import org.keycloak.testsuite.page.Form; @@ -48,8 +49,8 @@ public class ResourcePermissionForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; @FindBy(id = "s2id_policies") private MultipleStringSelect2 policySelect; @@ -78,7 +79,7 @@ public class ResourcePermissionForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public ResourcePermissionRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ScopePermissionForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ScopePermissionForm.java index f16cd5c55f..deb7f0663b 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ScopePermissionForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/permission/ScopePermissionForm.java @@ -21,6 +21,7 @@ import java.util.function.Function; import org.keycloak.representations.idm.authorization.DecisionStrategy; import org.keycloak.representations.idm.authorization.ScopePermissionRepresentation; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.MultipleStringSelect2; import org.keycloak.testsuite.console.page.fragment.SingleStringSelect2; import org.keycloak.testsuite.page.Form; @@ -45,8 +46,8 @@ public class ScopePermissionForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; @FindBy(id = "s2id_policies") private MultipleStringSelect2 policySelect; @@ -81,7 +82,7 @@ public class ScopePermissionForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public ScopePermissionRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/AggregatePolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/AggregatePolicyForm.java index 5e7170d6df..12c4289d59 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/AggregatePolicyForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/AggregatePolicyForm.java @@ -20,6 +20,7 @@ import java.util.Set; import org.keycloak.representations.idm.authorization.AggregatePolicyRepresentation; import org.keycloak.representations.idm.authorization.Logic; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.MultipleStringSelect2; import org.keycloak.testsuite.page.Form; import org.openqa.selenium.WebElement; @@ -46,8 +47,8 @@ public class AggregatePolicyForm extends Form { @FindBy(id = "s2id_policies") private MultipleStringSelect2 policySelect; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(AggregatePolicyRepresentation expected) { setInputValue(name, expected.getName()); @@ -83,7 +84,7 @@ public class AggregatePolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public AggregatePolicyRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/ClientPolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/ClientPolicyForm.java index 9095a3207d..cedaceeca8 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/ClientPolicyForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/ClientPolicyForm.java @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import org.keycloak.representations.idm.authorization.ClientPolicyRepresentation; import org.keycloak.representations.idm.authorization.Logic; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.MultipleStringSelect2; import org.keycloak.testsuite.page.Form; import org.openqa.selenium.By; @@ -52,8 +53,8 @@ public class ClientPolicyForm extends Form { @FindBy(id = "s2id_clients") private ClientSelect clientsInput; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(ClientPolicyRepresentation expected) { setInputValue(name, expected.getName()); @@ -67,7 +68,7 @@ public class ClientPolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public ClientPolicyRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/JSPolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/JSPolicyForm.java index e83585b9bb..9c1c1eaa8f 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/JSPolicyForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/JSPolicyForm.java @@ -18,6 +18,7 @@ package org.keycloak.testsuite.console.page.clients.authorization.policy; import org.keycloak.representations.idm.authorization.JSPolicyRepresentation; 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.JavascriptExecutor; import org.openqa.selenium.WebElement; @@ -41,8 +42,8 @@ public class JSPolicyForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(JSPolicyRepresentation expected) { setInputValue(name, expected.getName()); @@ -58,7 +59,7 @@ public class JSPolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public JSPolicyRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/Policies.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/Policies.java index af2a5402bd..5cc1b646f5 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/Policies.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/Policies.java @@ -29,6 +29,7 @@ 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.page.Form; +import org.keycloak.testsuite.util.URLUtils; import org.keycloak.testsuite.util.WaitUtils; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; @@ -77,31 +78,24 @@ public class Policies extends Form { if ("role".equals(type)) { rolePolicy.form().populate((RolePolicyRepresentation) expected); - rolePolicy.form().save(); return (P) rolePolicy; } else if ("user".equals(type)) { userPolicy.form().populate((UserPolicyRepresentation) expected); - userPolicy.form().save(); return (P) userPolicy; } else if ("aggregate".equals(type)) { aggregatePolicy.form().populate((AggregatePolicyRepresentation) expected); - aggregatePolicy.form().save(); return (P) aggregatePolicy; } else if ("js".equals(type)) { jsPolicy.form().populate((JSPolicyRepresentation) expected); - jsPolicy.form().save(); return (P) jsPolicy; } else if ("time".equals(type)) { timePolicy.form().populate((TimePolicyRepresentation) expected); - timePolicy.form().save(); return (P) timePolicy; } else if ("rules".equals(type)) { rulePolicy.form().populate((RulePolicyRepresentation) expected); - rulePolicy.form().save(); return (P) rulePolicy; } else if ("client".equals(type)) { clientPolicy.form().populate((ClientPolicyRepresentation) expected); - clientPolicy.form().save(); return (P) clientPolicy; } @@ -112,7 +106,7 @@ public class Policies extends Form { for (WebElement row : policies().rows()) { PolicyRepresentation actual = policies().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); String type = representation.getType(); @@ -141,8 +135,7 @@ public class Policies extends Form { for (WebElement row : policies().rows()) { PolicyRepresentation actual = policies().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); - WaitUtils.waitForPageToLoad(driver); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); String type = actual.getType(); if ("role".equals(type)) { return (P) rolePolicy; @@ -168,8 +161,7 @@ public class Policies extends Form { for (WebElement row : policies().rows()) { PolicyRepresentation actual = policies().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); - WaitUtils.waitForPageToLoad(driver); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); String type = actual.getType(); diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RolePolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RolePolicyForm.java index 8b6f114765..f917678b28 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RolePolicyForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/RolePolicyForm.java @@ -28,6 +28,7 @@ import java.util.stream.Collectors; import org.keycloak.representations.idm.authorization.Logic; import org.keycloak.representations.idm.authorization.RolePolicyRepresentation; import org.keycloak.testsuite.console.page.fragment.AbstractMultipleSelect2; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.page.Form; import org.openqa.selenium.By; import org.openqa.selenium.WebElement; @@ -60,8 +61,8 @@ public class RolePolicyForm extends Form { @FindBy(id = "s2id_clientRoles") private ClientRoleSelect clientRoleSelect; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(RolePolicyRepresentation expected) { setInputValue(name, expected.getName()); @@ -115,7 +116,7 @@ public class RolePolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public RolePolicyRepresentation toRepresentation() { 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 17b4d464cb..0ba43f14d6 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 @@ -18,6 +18,7 @@ package org.keycloak.testsuite.console.page.clients.authorization.policy; import org.keycloak.representations.idm.authorization.Logic; import org.keycloak.representations.idm.authorization.RulePolicyRepresentation; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.page.Form; import org.keycloak.testsuite.util.WaitUtils; import org.openqa.selenium.WebElement; @@ -62,8 +63,8 @@ public class RulePolicyForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; @FindBy(id = "resolveModule") private WebElement resolveModuleButton; @@ -92,7 +93,7 @@ public class RulePolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public RulePolicyRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/TimePolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/TimePolicyForm.java index 5c31f3373f..47be24d8f6 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/TimePolicyForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/TimePolicyForm.java @@ -18,6 +18,7 @@ package org.keycloak.testsuite.console.page.clients.authorization.policy; import org.keycloak.representations.idm.authorization.TimePolicyRepresentation; 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.WebElement; import org.openqa.selenium.support.FindBy; @@ -77,8 +78,8 @@ public class TimePolicyForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(TimePolicyRepresentation expected) { setInputValue(name, expected.getName()); @@ -102,7 +103,7 @@ public class TimePolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public TimePolicyRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/UserPolicyForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/UserPolicyForm.java index e403d1b8b2..ec24ace72a 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/UserPolicyForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/policy/UserPolicyForm.java @@ -25,6 +25,7 @@ import java.util.stream.Collectors; import org.keycloak.representations.idm.authorization.Logic; import org.keycloak.representations.idm.authorization.UserPolicyRepresentation; +import org.keycloak.testsuite.console.page.fragment.ModalDialog; import org.keycloak.testsuite.console.page.fragment.MultipleStringSelect2; import org.keycloak.testsuite.page.Form; import org.openqa.selenium.By; @@ -52,8 +53,8 @@ public class UserPolicyForm extends Form { @FindBy(id = "s2id_users") private UserSelect usersInput; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(UserPolicyRepresentation expected) { setInputValue(name, expected.getName()); @@ -67,7 +68,7 @@ public class UserPolicyForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public UserPolicyRepresentation toRepresentation() { diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourceForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourceForm.java index 8f4a66f9fb..c4d2b2b9db 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourceForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/resource/ResourceForm.java @@ -23,6 +23,7 @@ import java.util.Set; import org.jboss.arquillian.graphene.fragment.Root; import org.keycloak.representations.idm.authorization.ResourceRepresentation; import org.keycloak.representations.idm.authorization.ScopeRepresentation; +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; @@ -54,8 +55,8 @@ public class ResourceForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; @FindBy(id = "s2id_scopes") private ScopesInput scopesInput; @@ -94,7 +95,7 @@ public class ResourceForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } public ResourceRepresentation toRepresentation() { 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 280af3f2df..0290bc1f20 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 @@ -21,6 +21,7 @@ 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.WebElement; import org.openqa.selenium.support.FindBy; @@ -52,7 +53,7 @@ public class Resources extends Form { for (WebElement row : resources().rows()) { ResourceRepresentation actual = resources().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); resource.form().populate(representation); return; @@ -64,7 +65,7 @@ public class Resources extends Form { for (WebElement row : resources().rows()) { ResourceRepresentation actual = resources().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); resource.form().delete(); return; @@ -76,7 +77,7 @@ public class Resources extends Form { for (WebElement row : resources().rows()) { ResourceRepresentation actual = resources().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); WaitUtils.waitForPageToLoad(driver); return resource; } diff --git a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopeForm.java b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopeForm.java index ed01a2b453..29ec514fc2 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopeForm.java +++ b/testsuite/integration-arquillian/tests/other/console/src/main/java/org/keycloak/testsuite/console/page/clients/authorization/scope/ScopeForm.java @@ -17,6 +17,7 @@ package org.keycloak.testsuite.console.page.clients.authorization.scope; 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.WebElement; import org.openqa.selenium.support.FindBy; @@ -35,8 +36,8 @@ public class ScopeForm extends Form { @FindBy(xpath = "//i[contains(@class,'pficon-delete')]") private WebElement deleteButton; - @FindBy(xpath = ACTIVE_DIV_XPATH + "/button[text()='Delete']") - private WebElement confirmDelete; + @FindBy(xpath = "//div[@class='modal-dialog']") + protected ModalDialog modalDialog; public void populate(ScopeRepresentation expected) { setInputValue(name, expected.getName()); @@ -46,6 +47,6 @@ public class ScopeForm extends Form { public void delete() { deleteButton.click(); - confirmDelete.click(); + modalDialog.confirmDeletion(); } } \ No newline at end of file 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 a59869c7e9..4e706e7db4 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 @@ -21,6 +21,7 @@ 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.WebElement; import org.openqa.selenium.support.FindBy; @@ -51,7 +52,7 @@ public class Scopes extends Form { for (WebElement row : scopes().rows()) { ScopeRepresentation actual = scopes().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); scope.form().populate(representation); } } @@ -61,7 +62,7 @@ public class Scopes extends Form { for (WebElement row : scopes().rows()) { ScopeRepresentation actual = scopes().toRepresentation(row); if (actual.getName().equalsIgnoreCase(name)) { - row.findElements(tagName("a")).get(0).click(); + URLUtils.navigateToUri(driver, row.findElements(tagName("a")).get(0).getAttribute("href"), true); scope.form().delete(); } } diff --git a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java index 0d8e6b2cd8..eaa45dedad 100644 --- a/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java +++ b/testsuite/integration-arquillian/tests/other/console/src/test/java/org/keycloak/testsuite/console/clients/ClientMappersOIDCTest.java @@ -23,6 +23,7 @@ package org.keycloak.testsuite.console.clients; import org.jboss.arquillian.graphene.page.Page; import org.junit.Before; +import org.junit.Ignore; import org.junit.Test; import org.keycloak.representations.idm.ClientRepresentation; import org.keycloak.representations.idm.ProtocolMapperRepresentation; @@ -92,7 +93,6 @@ public class ClientMappersOIDCTest extends AbstractClientTest { assertEquals("oidc-hardcoded-role-mapper", found.getProtocolMapper()); Map config = found.getConfig(); - assertEquals(1, config.size()); assertEquals("offline_access", config.get("role")); //edit @@ -164,8 +164,6 @@ public class ClientMappersOIDCTest extends AbstractClientTest { assertEquals("oidc-usersessionmodel-note-mapper", found.getProtocolMapper()); Map config = found.getConfig(); - assertNull(config.get("id.token.claim")); - assertNull(config.get("access.token.claim")); assertEquals("claim name", config.get("claim.name")); assertEquals("session note", config.get("user.session.note")); assertEquals("int", config.get("jsonType.label"));