[java-idp-integration-tests] 01/03: Wait for page text when using Safari
Tom Zeller
tzeller at dragonacea.biz
Thu Jun 24 20:29:02 UTC 2021
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=e2a3ccc6ccc646d9e3040431f594661507421e58
commit e2a3ccc6ccc646d9e3040431f594661507421e58
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Thu Jun 24 15:28:16 2021 -0500
Wait for page text when using Safari
---
.../shibboleth/idp/test/BaseIntegrationTest.java | 48 ++++++++++++++++++++++
.../idp/test/cas/CASIntegrationTest.java | 8 ++++
.../saml2/SAML2AttributeQueryIntegrationTest.java | 3 +-
3 files changed, 58 insertions(+), 1 deletion(-)
diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index 7405ac7..9ebfe3a 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -1706,6 +1706,26 @@ public abstract class BaseIntegrationTest
return desiredCapabilities.getBrowserName().equals(BrowserType.IE);
}
+ /**
+ * Whether the browser is Safari on macOS or iOS.
+ *
+ * @return whether the browser is Safari.
+ */
+ public boolean isSafari(@Nullable final BrowserData browserData) {
+ if (browserData != null) {
+ if (browserData.getBrowser().equalsIgnoreCase("safari")) {
+ return true;
+ }
+ if (browserData.getBrowser().equalsIgnoreCase("iphone")) {
+ return true;
+ }
+ if (browserData.getBrowser().equalsIgnoreCase("ipad")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Set up the client IP range used in conf/access-control.xml to Sauce Labs {@link #SAUCE_LABS_IP_RANGE} if Selenium
* is not local.
@@ -1965,6 +1985,34 @@ public abstract class BaseIntegrationTest
new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains(fraction));
}
+ /**
+ * Wait for page whose body has text that starts with the given text.
+ *
+ * @param prefix the prefix of the page body text
+ */
+ public void waitForPageBodyStartsWith(@Nonnull final String prefix) {
+ Assert.assertNotNull(prefix);
+ (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
+ public Boolean apply(WebDriver d) {
+ return d.findElement(By.tagName("body")).getText().startsWith(prefix);
+ }
+ });
+ }
+
+ /**
+ * Wait for page whose body contains the given text.
+ *
+ * @param fraction the fraction of the page body text
+ */
+ public void waitForPageBodyContains(@Nonnull final String fraction) {
+ Assert.assertNotNull(fraction);
+ (new WebDriverWait(driver, 10)).until(new ExpectedCondition<Boolean>() {
+ public Boolean apply(WebDriver d) {
+ return d.findElement(By.tagName("body")).getText().contains(fraction);
+ }
+ });
+ }
+
/**
* Select web element with id {@link #REMEMBER_CONSENT_ID}.
*/
diff --git a/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java
index 5676cff..ae33b4f 100644
--- a/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/cas/CASIntegrationTest.java
@@ -119,10 +119,14 @@ public class CASIntegrationTest extends BaseIntegrationTest {
waitForPageWithURL(getBaseURL() + spServicePageURLPath);
+ waitForPageBodyStartsWith("CAS Service Validate");
+
driver.findElement(By.id("cas-service-validate")).click();
waitForPageWithURL(getBaseURL() + idpServiceValidatePageURLPath);
+ waitForPageBodyContains("jdoe");
+
final String actualCASServiceResponse = getCASServiceResponse(driver.getPageSource());
Assert.assertEquals(actualCASServiceResponse, expectedCASServiceResponse);
@@ -151,10 +155,14 @@ public class CASIntegrationTest extends BaseIntegrationTest {
waitForPageWithURL(getBaseURL() + spServicePageURLPath);
+ waitForPageBodyStartsWith("CAS Service Validate");
+
driver.findElement(By.id("cas-service-validate")).click();
waitForPageWithURL(getBaseURL() + idpServiceValidatePageURLPath);
+ waitForPageBodyContains("jdoe");
+
final String actualCASServiceResponse = getCASServiceResponse(driver.getPageSource());
if (idpVersion.startsWith("3")) {
diff --git a/src/test/java/net/shibboleth/idp/test/saml2/SAML2AttributeQueryIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/saml2/SAML2AttributeQueryIntegrationTest.java
index afea0f8..2f2d49d 100644
--- a/src/test/java/net/shibboleth/idp/test/saml2/SAML2AttributeQueryIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/saml2/SAML2AttributeQueryIntegrationTest.java
@@ -300,6 +300,7 @@ public class SAML2AttributeQueryIntegrationTest extends AbstractSAML2Integration
protected void submitAttributeQueryForm() {
driver.findElement(By.id("saml2-attribute-query")).submit();
waitForPageURLContains("/sp/SAML2/AttributeQuery");
+ waitForPageBodyStartsWith("<?xml");
}
/**
@@ -532,7 +533,7 @@ public class SAML2AttributeQueryIntegrationTest extends AbstractSAML2Integration
// attribute query, should have attributes
submitAttributeQueryForm();
-
+
validateResponse();
// start SSO
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list