Skip to content

Commit

Permalink
JENKINS-15261 Store selected webdriver/seleniumrc-specific browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
rossrowe committed Sep 28, 2012
1 parent ee1ebed commit 992e9c6
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 9 deletions.
Expand Up @@ -46,6 +46,7 @@
import org.json.JSONException;
import org.json.JSONObject;
import org.kohsuke.stapler.DataBoundConstructor;
import org.kohsuke.stapler.StaplerRequest;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -108,16 +109,14 @@ public SauceOnDemandBuildWrapper(Credentials
String seleniumHost,
String seleniumPort,
boolean enableSauceConnect,
List<String> seleniumBrowsers,
List<String> webDriverBrowsers,
boolean launchSauceConnectOnSlave) {
this.credentials = credentials;
this.seleniumInformation = seleniumInformation;
this.enableSauceConnect = enableSauceConnect;
this.seleniumHost = seleniumHost;
this.seleniumPort = seleniumPort;
this.seleniumBrowsers = seleniumBrowsers;
this.webDriverBrowsers = webDriverBrowsers;
this.seleniumBrowsers = seleniumInformation.getSeleniumBrowsers();
this.webDriverBrowsers = seleniumInformation.getWebDriverBrowsers();
this.launchSauceConnectOnSlave = launchSauceConnectOnSlave;
}

Expand Down Expand Up @@ -527,11 +526,19 @@ public ITunnelHolder call() throws IOException {

@Extension
public static final class DescriptorImpl extends Descriptor<BuildWrapper> {

@Override
public BuildWrapper newInstance(StaplerRequest req, net.sf.json.JSONObject formData) throws FormException {
return super.newInstance(req, formData);
}

@Override
public String getDisplayName() {
return "Sauce OnDemand Support";
}



public List<Browser> getSeleniumBrowsers() {
try {
return BrowserFactory.getInstance().getSeleniumBrowsers();
Expand Down
Expand Up @@ -3,6 +3,7 @@
import org.kohsuke.stapler.DataBoundConstructor;

import java.io.Serializable;
import java.util.List;

/**
* @author Ross Rowe
Expand All @@ -11,11 +12,18 @@ public class SeleniumInformation implements Serializable {

private String startingURL;

private List<String> seleniumBrowsers;
private List<String> webDriverBrowsers;
private boolean isWebDriver;

@DataBoundConstructor
public SeleniumInformation(String startingURL) {
public SeleniumInformation(String value, String startingURL, List<String> seleniumBrowsers, List<String> webDriverBrowsers) {
this.isWebDriver = value != null && value.equals("webDriver");
this.startingURL = startingURL;
this.seleniumBrowsers = seleniumBrowsers;
this.webDriverBrowsers = webDriverBrowsers;
}

public String getStartingURL() {
return startingURL;
}
Expand Down Expand Up @@ -48,4 +56,28 @@ public boolean equals(Object object) {
public String toString() {
return startingURL == null ? super.toString() : startingURL;
}

public List<String> getSeleniumBrowsers() {
return seleniumBrowsers;
}

public void setSeleniumBrowsers(List<String> seleniumBrowsers) {
this.seleniumBrowsers = seleniumBrowsers;
}

public List<String> getWebDriverBrowsers() {
return webDriverBrowsers;
}

public void setWebDriverBrowsers(List<String> webDriverBrowsers) {
this.webDriverBrowsers = webDriverBrowsers;
}

public boolean isWebDriver() {
return isWebDriver;
}

public void setWebDriver(boolean webDriver) {
isWebDriver = webDriver;
}
}
Expand Up @@ -7,8 +7,8 @@
<f:checkbox title="${%Enable Sauce Connect?}" default="checked"/>
</f:entry>

<f:radioBlock name="seleniumInformation" value="webdriver" title="${%WebDriver}"
checked="${instance.seleniumInformation == null}">
<f:radioBlock name="seleniumInformation" value="webDriver" title="${%WebDriver}"
checked="${instance.seleniumInformation.isWebDriver()}">
<f:nested>
<select name="webDriverBrowsers" multiple="multiple">
<j:forEach var="b" items="${descriptor.webDriverBrowsers}">
Expand All @@ -26,7 +26,7 @@
</f:nested>
</f:radioBlock>
<f:radioBlock name="seleniumInformation" value="selenium" title="${%Selenium RC}"
checked="${instance.seleniumInformation != null}">
checked="${!instance.seleniumInformation.isWebDriver()}">

<f:nested>
<select name="seleniumBrowsers" multiple="multiple">
Expand Down

0 comments on commit 992e9c6

Please sign in to comment.