[java-idp-integration-tests] 06/14: Support testing local Safari
Tom Zeller
tzeller at dragonacea.biz
Thu Jun 17 13:55:50 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=bae64efbd8fef9630f05a3d69c658e85f11c51af
commit bae64efbd8fef9630f05a3d69c658e85f11c51af
Author: Tom Zeller <tzeller at dragonacea.biz>
AuthorDate: Wed Jun 16 21:37:17 2021 -0500
Support testing local Safari
Requires :
-DSELENIUM_BROWSER=safari
-Dno-secure=true
---
.../shibboleth/idp/test/BaseIntegrationTest.java | 32 ++++++++++++++++++----
1 file changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
index ea54912..9edbace 100644
--- a/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
+++ b/src/test/java/net/shibboleth/idp/test/BaseIntegrationTest.java
@@ -80,6 +80,7 @@ import org.openqa.selenium.remote.BrowserType;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;
import org.openqa.selenium.remote.RemoteWebDriver;
+import org.openqa.selenium.safari.SafariDriver;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
@@ -947,18 +948,23 @@ public abstract class BaseIntegrationTest
}
/**
- * Start the web driver.
+ * Start the web driver (browser).
*
- * If the test is remote, as defined by {@link #isRemote()}, then start a
- * {@link RemoteWebDriver} on Sauce Labs.
- * Otherwise, start a {@link HtmlUnitDriver}.
+ * If test is remote, as defined by {@link #isRemote()}, then start a {@link RemoteWebDriver} on Sauce Labs.
+ *
+ * If test is local and 'SELENIUM_BROWSER' system property is 'safari', start a Safari web driver.
+ *
+ * If test is local and 'SELENIUM_BROWSER' system property is 'chrome', throw an IllegalArgumentException.
+ *
+ * Otherwise, start a Firefox web driver.
*
* <p>
* Note : this method must be called in each test.
* </p>
*
- * @param browserData the browser data
+ * @param browserData the platform+browser+version triplet
*
+ * @throws IllegalArgumentException if browser is chrome
* @throws Exception if an error occurs
*/
public void startSeleniumClient(@Nullable final BrowserData browserData) throws Exception {
@@ -966,8 +972,13 @@ public abstract class BaseIntegrationTest
if (BaseIntegrationTest.isRemote()) {
log.debug("Setting up remote web driver with desired capabilities '{}'", desiredCapabilities);
setUpSauceDriver();
+ } else if (browserData.getBrowser().equalsIgnoreCase("chrome")) {
+ throw new IllegalArgumentException("Chrome web driver not supported");
+ } else if (browserData.getBrowser().equalsIgnoreCase("safari")) {
+ log.debug("Setting up local Safari web driver with desired capabilities '{}'", desiredCapabilities);
+ setUpSafariDriver();
} else {
- log.debug("Setting up local web driver with desired capabilities '{}'", desiredCapabilities);
+ log.debug("Setting up local Firefox web driver with desired capabilities '{}'", desiredCapabilities);
setUpFirefoxDriver();
}
log.debug("Started web driver '{}' with desired capabilities '{}'", driver, desiredCapabilities);
@@ -1447,6 +1458,15 @@ public abstract class BaseIntegrationTest
driver.manage().window().setSize(new Dimension(1024, 768));
}
+ /**
+ * Set up Safari web driver.
+ *
+ * Note that Safari does not support running headless.
+ */
+ public void setUpSafariDriver() {
+ driver = new SafariDriver();
+ }
+
/**
* Set up remote web driver to Sauce Labs.
*
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list