Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
JENKINS-15261 Present separate browser axis for SeleniumRC/WebDriver
- Loading branch information
Showing
3 changed files
with
110 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/main/java/hudson/plugins/sauce_ondemand/SeleniumRCAxis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package hudson.plugins.sauce_ondemand; | ||
|
||
import com.saucelabs.ci.Browser; | ||
import com.saucelabs.ci.BrowserFactory; | ||
import hudson.Extension; | ||
import hudson.matrix.AxisDescriptor; | ||
import org.json.JSONException; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* @author Ross Rowe | ||
*/ | ||
public class SeleniumRCAxis extends BrowserAxis { | ||
|
||
private static final Logger logger = Logger.getLogger(SeleniumRCAxis.class.getName()); | ||
|
||
@DataBoundConstructor | ||
public SeleniumRCAxis(List<String> values) { | ||
super(values); | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends AxisDescriptor { | ||
@Override | ||
public String getDisplayName() { | ||
return "Sauce OnDemand SeleniumRC tests"; | ||
} | ||
|
||
public List<Browser> getBrowsers() { | ||
try { | ||
return BrowserFactory.getInstance().getSeleniumBrowsers(); | ||
} catch (IOException e) { | ||
logger.log(Level.WARNING, "Error retrieving browsers from Saucelabs", e); | ||
} catch (JSONException e) { | ||
logger.log(Level.WARNING, "Error parsing JSON response", e); | ||
} | ||
return Collections.emptyList(); | ||
} | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
src/main/java/hudson/plugins/sauce_ondemand/WebDriverAxis.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package hudson.plugins.sauce_ondemand; | ||
|
||
import com.saucelabs.ci.Browser; | ||
import com.saucelabs.ci.BrowserFactory; | ||
import hudson.Extension; | ||
import hudson.matrix.AxisDescriptor; | ||
import org.json.JSONException; | ||
import org.kohsuke.stapler.DataBoundConstructor; | ||
|
||
import java.io.IOException; | ||
import java.util.Collections; | ||
import java.util.List; | ||
import java.util.logging.Level; | ||
import java.util.logging.Logger; | ||
|
||
/** | ||
* @author Ross Rowe | ||
*/ | ||
public class WebDriverAxis extends BrowserAxis { | ||
private static final Logger logger = Logger.getLogger(WebDriverAxis.class.getName()); | ||
|
||
@DataBoundConstructor | ||
public WebDriverAxis(List<String> values) { | ||
super(values); | ||
} | ||
|
||
@Extension | ||
public static class DescriptorImpl extends AxisDescriptor { | ||
@Override | ||
public String getDisplayName() { | ||
return "Sauce OnDemand WebDriver tests"; | ||
} | ||
|
||
public List<Browser> getBrowsers() { | ||
try { | ||
return BrowserFactory.getInstance().getWebDriverBrowsers(); | ||
} catch (IOException e) { | ||
logger.log(Level.WARNING, "Error retrieving browsers from Saucelabs", e); | ||
} catch (JSONException e) { | ||
logger.log(Level.WARNING, "Error parsing JSON response", e); | ||
} | ||
return Collections.emptyList(); | ||
} | ||
} | ||
} |