Class SauceLabsIntegration
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceSauce Labs specific remote webdriver capabilities -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringReturns the HubUrl for running tests in Sauce Labs.static StringGets the configured Saucelabs access key.static ObjectgetSauceLabsOption(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities, String key) Gets the given SauceLabs option.static StringGets the configured Saucelabs tunnel identifier.static StringGets the configured Saucelabs user name.static booleanChecks if parameters needed to run in Saucelabs have been set.static voidsetDesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities) Sets needed desired capabilities for authentication and using the correct sauce tunnel (if in use).static voidsetSauceLabsOption(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities, String key, Object value) Sets the given SauceLabs option to the given value.
-
Constructor Details
-
SauceLabsIntegration
public SauceLabsIntegration()
-
-
Method Details
-
setDesiredCapabilities
public static void setDesiredCapabilities(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities) Sets needed desired capabilities for authentication and using the correct sauce tunnel (if in use).- Parameters:
desiredCapabilities- the capabilities object to populate, not null- See Also:
-
setSauceLabsOption
public static void setSauceLabsOption(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities, String key, Object value) Sets the given SauceLabs option to the given value.The available SauceLabs options are listed at https://docs.saucelabs.com/dev/test-configuration-options/.
- Parameters:
desiredCapabilities- the desired capabilities objectkey- the option keyvalue- the option value
-
getSauceLabsOption
public static Object getSauceLabsOption(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities, String key) Gets the given SauceLabs option.The available SauceLabs options are listed at https://docs.saucelabs.com/dev/test-configuration-options/.
- Parameters:
desiredCapabilities- the desired capabilities objectkey- the option key- Returns:
- the option value that was set or null
-
getSauceTunnelIdentifier
Gets the configured Saucelabs tunnel identifier.Reads from the "sauce.tunnelId" system property or the "SAUCE_TUNNEL_IDENTIFIER" environment variable.
If both system property and environment variable are defined, the system property is used.
- Returns:
- the configured Saucelabs tunnel identifier or null
-
getHubUrl
Returns the HubUrl for running tests in Sauce Labs.The available SauceLabs URLs are listed at https://docs.saucelabs.com/basics/data-center-endpoints/#data-center-endpoints.
- Returns:
- url String to be used in Sauce Labs test run
-
isConfiguredForSauceLabs
public static boolean isConfiguredForSauceLabs()Checks if parameters needed to run in Saucelabs have been set.- Returns:
- true if the Saucelabs configuration was found
-
getSauceUser
Gets the configured Saucelabs user name.Reads from the "sauce.user" system property or the "SAUCE_USERNAME" environment variable.
If both system property and environment variable are defined, the system property is used.
- Returns:
- the configured Saucelabs user name or null
-
getSauceAccessKey
Gets the configured Saucelabs access key.Reads from the "sauce.sauceAccessKey" system property or the "SAUCE_ACCESS_KEY" environment variable.
If both system property and environment variable are defined, the system property is used.
- Returns:
- the configured Saucelabs access key or null
-