[java-idp-integration-tests] branch main updated: Workaround being unable to click because of accessibility changes

Tom Zeller tzeller at dragonacea.biz
Tue Mar 1 14:05:04 UTC 2022


This is an automated email from the git hooks/post-receive script.

tzeller pushed a commit to branch main
in repository java-idp-integration-tests.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-integration-tests.git;a=commit;h=5c589ada3ae457a2afec8715472d59bb0db908fa

The following commit(s) were added to refs/heads/main by this push:
     new 5c589ad  Workaround being unable to click because of accessibility changes
5c589ad is described below

commit 5c589ada3ae457a2afec8715472d59bb0db908fa
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Tue Mar 1 08:04:53 2022 -0600

    Workaround being unable to click because of accessibility changes
    
    https://shibboleth.atlassian.net/browse/IDP-1910
---
 .../shibboleth/idp/test/BaseIntegrationTest.java   | 35 +++++++++++++++++-----
 1 file changed, 27 insertions(+), 8 deletions(-)

diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 3fab9b8..a92f6c6 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -70,6 +70,7 @@ import org.apache.http.impl.client.CloseableHttpClient;
 import org.apache.http.util.EntityUtils;
 import org.openqa.selenium.By;
 import org.openqa.selenium.Dimension;
+import org.openqa.selenium.ElementClickInterceptedException;
 import org.openqa.selenium.Platform;
 import org.openqa.selenium.Point;
 import org.openqa.selenium.StaleElementReferenceException;
@@ -77,6 +78,7 @@ import org.openqa.selenium.WebDriver;
 import org.openqa.selenium.WebElement;
 import org.openqa.selenium.firefox.FirefoxDriver;
 import org.openqa.selenium.firefox.FirefoxOptions;
+import org.openqa.selenium.interactions.Actions;
 import org.openqa.selenium.remote.BrowserType;
 import org.openqa.selenium.remote.CapabilityType;
 import org.openqa.selenium.remote.DesiredCapabilities;
@@ -1322,7 +1324,7 @@ public abstract class BaseIntegrationTest
                 "<bean parent=\"SAML2.SSO\" p:postAuthenticationFlows=\"#{ {'terms-of-use', 'attribute-release'} }\" />";
         replaceIdPHomeFile(pathToRelyingPartyXML, oldPostAuthenticationFlowsText, newPostAuthenticationFlowsText);
     }
-
+    
     /**
      * Disable Local Storage in conf/idp.properties.
      * 
@@ -2085,22 +2087,22 @@ public abstract class BaseIntegrationTest
     public void releaseEmailAttributeOnly() {
         final WebElement email = driver.findElement(By.id(EMAIL_ID));
         if (!email.isSelected()) {
-            email.click();
+            clickWorkaround(email);
         }
 
         final WebElement eduPersonAffiliation = driver.findElement(By.id(EDU_PERSON_AFFILIATION_ID));
         if (eduPersonAffiliation.isSelected()) {
-            eduPersonAffiliation.click();
+            clickWorkaround(eduPersonAffiliation);
         }
 
         final WebElement eduPersonPrincipalName = driver.findElement(By.id(EDU_PERSON_PRINCIPAL_NAME_ID));
         if (eduPersonPrincipalName.isSelected()) {
-            eduPersonPrincipalName.click();
+            clickWorkaround(eduPersonPrincipalName);
         }
 
         final WebElement uid = driver.findElement(By.id(UID_ID));
         if (uid.isSelected()) {
-            uid.click();
+            clickWorkaround(uid);
         }
     }
 
@@ -2110,7 +2112,7 @@ public abstract class BaseIntegrationTest
     public void rememberConsent() {
         final WebElement element = driver.findElement(By.id(REMEMBER_CONSENT_ID));
         if (!element.isSelected()) {
-            element.click();
+            clickWorkaround(element);
         }
     }
 
@@ -2120,7 +2122,7 @@ public abstract class BaseIntegrationTest
     public void doNotRememberConsent() {
         final WebElement element = driver.findElement(By.id(DO_NOT_REMEMBER_CONSENT_ID));
         if (!element.isSelected()) {
-            element.click();
+            clickWorkaround(element);
         }
     }
 
@@ -2130,7 +2132,7 @@ public abstract class BaseIntegrationTest
     public void globalConsent() {
         final WebElement element = driver.findElement(By.id(GLOBAL_CONSENT_ID));
         if (!element.isSelected()) {
-            element.click();
+            clickWorkaround(element);
         }
     }
 
@@ -2207,4 +2209,21 @@ public abstract class BaseIntegrationTest
         return getEC2Metadata(url);
     }
 
+    /**
+     * Workaround being unable to click an element because of accessibility changes.
+     * 
+     * Catch {@link ElementClickInterceptedException} and click via {@link Actions}.
+     * 
+     * @param element element to be clicked
+     */
+    public void clickWorkaround(final WebElement element) {
+        try {
+            element.click();
+        } catch (ElementClickInterceptedException e) {
+            log.trace("Unable to click element {}, will try again", element);
+            final Actions action = new Actions(driver);
+            action.moveToElement(element).click().build().perform();
+        }
+    }
+
 }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list