/** * Get selenium version from System property 'selenium.version' if there. * User '2.13.0' if property not set. * @return Selenium version. */ protected String getSeleniumVersion() { String seVersion = System.getProperty("selenium.version"); if (seVersion == null) { return getDefaultSeleniumVersion(); } return seVersion; }
public static String getSauceCredentials() { return getSauceUser() + ":" + getSauceAccessKey(); }
@Override public URL createRemoteURL() throws MalformedURLException { return new URL("http://" + getSauceCredentials() + "@ondemand.saucelabs.com/wd/hub"); }
@Override protected DesiredCapabilities makeDesiredCapabilities() { DesiredCapabilities dc = super.makeDesiredCapabilities(); dc.setCapability("name", "JBehave"); dc.setCapability("selenium-version", getSeleniumVersion()); dc.setCapability("max-duration", getMaxDuration()); dc.setCapability("command-timeout", getCommandTimeout()); dc.setCapability("idle-timeout", getIdleTimeout()); return dc; }
private void postJobUpdate(String storyName, SessionId sessionId, String payload) { try { URL url = new URL("http://saucelabs.com/rest/v1/" + getSauceUser() + "/jobs/" + sessionId.toString()); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(getSauceUser(), getSauceAccessKey().toCharArray()); } }); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("PUT"); OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(payload); writer.close(); int rc = connection.getResponseCode(); String jobUrl = null; if (rc == 200) { jobUrl = readResponseLinesFromSauceLabToGetJobUrl(new BufferedReader(new InputStreamReader(connection.getInputStream()))); storyToJobIds.put(storyName, jobUrl); } } catch (IOException e) { System.err.println("SauceContextStoryReporter: Error updating Saucelabs job info: " + e.getMessage()); } }
@Override protected DesiredCapabilities makeDesiredCapabilities() { DesiredCapabilities dc = super.makeDesiredCapabilities(); dc.setCapability("name", "JBehave"); dc.setCapability("selenium-version", getSeleniumVersion()); dc.setCapability("max-duration", getMaxDuration()); dc.setCapability("command-timeout", getCommandTimeout()); dc.setCapability("idle-timeout", getIdleTimeout()); return dc; }
private void postJobUpdate(String storyName, SessionId sessionId, String payload) { try { URL url = new URL("http://saucelabs.com/rest/v1/" + getSauceUser() + "/jobs/" + sessionId.toString()); Authenticator.setDefault(new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(getSauceUser(), getSauceAccessKey().toCharArray()); } }); HttpURLConnection connection = (HttpURLConnection) url.openConnection(); connection.setDoOutput(true); connection.setRequestMethod("PUT"); OutputStreamWriter writer = new OutputStreamWriter(connection.getOutputStream()); writer.write(payload); writer.close(); int rc = connection.getResponseCode(); String jobUrl = null; if (rc == 200) { jobUrl = readResponseLinesFromSauceLabToGetJobUrl(new BufferedReader(new InputStreamReader(connection.getInputStream()))); storyToJobIds.put(storyName, jobUrl); } } catch (IOException e) { System.err.println("SauceContextStoryReporter: Error updating Saucelabs job info: " + e.getMessage()); } }
public static String getSauceCredentials() { return getSauceUser() + ":" + getSauceAccessKey(); }
/** * Get selenium version from System property 'selenium.version' if there. * User '2.13.0' if property not set. * @return Selenium version. */ protected String getSeleniumVersion() { String seVersion = System.getProperty("selenium.version"); if (seVersion == null) { return getDefaultSeleniumVersion(); } return seVersion; }
@Override public URL createRemoteURL() throws MalformedURLException { return new URL("http://" + getSauceCredentials() + "@ondemand.saucelabs.com/wd/hub"); }
protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(getSauceUser(), getSauceAccessKey().toCharArray()); } });
protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(getSauceUser(), getSauceAccessKey().toCharArray()); } });