Class SauceLabsIntegration


  • public class SauceLabsIntegration
    extends Object
    Integration methods for Sauce Labs testing used by ParallelTest
    • Constructor Detail

      • SauceLabsIntegration

        public SauceLabsIntegration()
    • Method Detail

      • 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:
        getSauceUser(), getSauceAccessKey(), getSauceTunnelIdentifier()
      • 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 object
        key - the option key
        value - 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 object
        key - the option key
        Returns:
        the option value that was set or null
      • getSauceTunnelIdentifier

        public static String getSauceTunnelIdentifier()
        Gets the configured Saucelabs tunnel identifier.

        Reads from the "sauce.tunnelId" system property or the "SAUCE_TUNNEL_ID" 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

        public static String 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

        public static String 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

        public static String 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