org.jbehave.web.selenium
Class SauceWebDriverProvider

java.lang.Object
  extended by org.jbehave.web.selenium.DelegatingWebDriverProvider
      extended by org.jbehave.web.selenium.RemoteWebDriverProvider
          extended by org.jbehave.web.selenium.SauceWebDriverProvider
All Implemented Interfaces:
WebDriverProvider

public class SauceWebDriverProvider
extends RemoteWebDriverProvider

Allows to connect to Sauce Labs to run Selenium tests in the cloud. Requires Sauce credentials, username and access key, which can be provided via system properties "SAUCE_USERNAME" and "SAUCE_ACCESS_KEY". Firefox on Windows is the default browser choice. This is done via DesiredCapabilities passed in through the constructor. Like so - DesiredCapabilities desiredCapabilities = DesiredCapabilities.firefox(); desiredCapabilities.setVersion("3.6."); desiredCapabilities.setPlatform(Platform.WINDOWS); desiredCapabilities.setCapability(CapabilityType.TAKES_SCREENSHOT, true);


Nested Class Summary
 
Nested classes/interfaces inherited from class org.jbehave.web.selenium.RemoteWebDriverProvider
RemoteWebDriverProvider.SauceLabsJobHasEnded
 
Nested classes/interfaces inherited from class org.jbehave.web.selenium.DelegatingWebDriverProvider
DelegatingWebDriverProvider.DelegateWebDriverNotFound
 
Field Summary
 
Fields inherited from class org.jbehave.web.selenium.DelegatingWebDriverProvider
delegate
 
Constructor Summary
SauceWebDriverProvider()
          With default capabilities and a selenium version specified in getSeleniumVersion()
SauceWebDriverProvider(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities)
           
 
Method Summary
 URL createRemoteURL()
           
protected  String getCommandTimeout()
          Command Timeout for an individual command for a Job on Sauce Labs.
protected  String getDefaultSeleniumVersion()
           
protected  String getIdleTimeout()
          Idle Timeout for a Job on Sauce Labs.
protected  String getMaxDuration()
          Max duration of Job on Sauce Labs.
static String getSauceAccessKey()
           
static String getSauceCredentials()
           
static String getSauceUser()
           
protected  String getSeleniumVersion()
          Get selenium version from System property 'selenium.version' if there.
protected  org.openqa.selenium.remote.DesiredCapabilities makeDesiredCapabilities()
          Default Desired Capabilities: Any-Platform, Any Firefox Version, unless something is specified via a system-property "browser.version" and 'Takes Screen-Shot'
 
Methods inherited from class org.jbehave.web.selenium.RemoteWebDriverProvider
getBrowserVersion, initialize, useVerbosity, wrapCommandExecutor
 
Methods inherited from class org.jbehave.web.selenium.DelegatingWebDriverProvider
end, get, saveScreenshotTo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SauceWebDriverProvider

public SauceWebDriverProvider(org.openqa.selenium.remote.DesiredCapabilities desiredCapabilities)
Parameters:
desiredCapabilities -

SauceWebDriverProvider

public SauceWebDriverProvider()
With default capabilities and a selenium version specified in getSeleniumVersion()

See Also:
RemoteWebDriverProvider.makeDesiredCapabilities(), getSeleniumVersion()
Method Detail

makeDesiredCapabilities

protected org.openqa.selenium.remote.DesiredCapabilities makeDesiredCapabilities()
Description copied from class: RemoteWebDriverProvider
Default Desired Capabilities: Any-Platform, Any Firefox Version, unless something is specified via a system-property "browser.version" and 'Takes Screen-Shot'

Overrides:
makeDesiredCapabilities in class RemoteWebDriverProvider
Returns:
a DesiredCapabilities matching the above.

getSeleniumVersion

protected String getSeleniumVersion()
Get selenium version from System property 'selenium.version' if there. User '2.13.0' if property not set.

Returns:
Selenium version.

getDefaultSeleniumVersion

protected String getDefaultSeleniumVersion()

createRemoteURL

public URL createRemoteURL()
                    throws MalformedURLException
Overrides:
createRemoteURL in class RemoteWebDriverProvider
Throws:
MalformedURLException

getSauceUser

public static String getSauceUser()

getSauceAccessKey

public static String getSauceAccessKey()

getSauceCredentials

public static String getSauceCredentials()

getMaxDuration

protected String getMaxDuration()
Max duration of Job on Sauce Labs. If you don't override this, and have not set a value on system property 'SAUCE_MAX_DURATION', 30 minutes is the default.

Returns:
max duration in seconds

getCommandTimeout

protected String getCommandTimeout()
Command Timeout for an individual command for a Job on Sauce Labs. If you don't override this, and you don't specify a value on a system property 'SAUCE_COMMAND_TIMEOUT', then 300 seconds is the default.

Returns:
command timeout in seconds

getIdleTimeout

protected String getIdleTimeout()
Idle Timeout for a Job on Sauce Labs. If you don't override this, and don't specify a value on the system property 'SAUCE_IDLE_TIMEOUT', then 90 seconds is the default.

Returns:
command timeout in seconds


Copyright © 2012. All Rights Reserved.