Skip to content
Permalink
Browse files

Merge pull request #88 from tfennelly/2.0-JENKINS-33730

[JENKINS-33730] More ATH tweaks for Jenkins 2.0
  • Loading branch information...
olivergondza committed Apr 3, 2016
2 parents 4de2dfc + c22403d commit c1512e4da9dc3b4dd701988dae103eaec405ec25
@@ -179,11 +179,41 @@ public void populateJenkinsHome(byte[] _template, boolean clean) throws IOExcept
} finally {
template.delete();
}
installDetachedPlugins();
} catch (Exception e) {
throw new IOException(e.getMessage(), e);
}
}

private void installDetachedPlugins() throws Exception {
File expandedWarDir = new File(tempDir, "war");

// Expand the war file so we can get the detached plugins from it.
Expand expand = new Expand();
expand.setSrc(war);
expand.setOverwrite(true);
expand.setDest(expandedWarDir);
expand.execute();

// Copy the detached plugins into the plugin dir
File pluginsDir = new File(tempDir, "plugins");
File detachedPluginsDir = new File(expandedWarDir, "WEB-INF/detached-plugins");
if (detachedPluginsDir.isDirectory()) {
File[] detachedPlugins = detachedPluginsDir.listFiles();
if (detachedPlugins != null) {
for (File detachedPlugin : detachedPlugins) {
String pluginName = detachedPlugin.getName().replace(".hpi", "").replace(".jpi", "");

// Only copy in the HPI file if it doesn't already exist in the plugins dir
// (checking for both .hpi and .jpi).
if (!new File(pluginsDir, pluginName + ".hpi").exists() && !new File(pluginsDir, pluginName + ".jpi").exists()) {
FileUtils.copyFile(detachedPlugin, new File(pluginsDir, detachedPlugin.getName()));
}
}
}
}
}

public File getJavaHome() {
String javaHome = getenv("JENKINS_JAVA_HOME");
File home = StringUtils.isBlank(javaHome) ? null : new File(javaHome);
@@ -95,7 +95,10 @@ public ToolInstallation(Jenkins jenkins, String path) {
}

protected static ConfigurablePageObject getPageObject(Jenkins jenkins) {
return jenkins.getVersion().isOlderThan(new VersionNumber("2"))
// TODO: change to jenkins.getVersion().isOlderThan(new VersionNumber("2")) after 2.0 is released.
// yeah, you could do a number of things here e.g. isNewerThan("1.1000") etc,
// but this is fine as it's temporary.
return jenkins.getVersion().toString().startsWith("1.")
? new JenkinsConfig(jenkins)
: new GlobalToolConfig(jenkins);
}
@@ -78,6 +78,7 @@ public void beforeChangeValueOf(WebElement element, WebDriver driver) {
}

private void scrollIntoView(WebElement e, WebDriver driver) {
((JavascriptExecutor)driver).executeScript(scrollJs,e);
int eYCoord = e.getLocation().getY();
((JavascriptExecutor)driver).executeScript(scrollJs, eYCoord);
}
}
@@ -1,11 +1,8 @@
// Visually navigate to the element in order to interact with it.
// Elements without path attribute are ignored

var e = arguments[0];
var eYCoord = arguments[0];

if (e.getAttribute("path")) {
// Scroll to the element. It will appear at the top edge of the screen.
e.scrollIntoView();
// Scroll a bit back so breadcrumbs are not hiding the element.
window.scrollBy(0, -40);
}
// Scroll to the element. It will appear at the top edge of the screen.
// We subtract a bit so as to accommodate fixed position banners at the top
// (e.g. breadcrumbs, tabbars etc), making sure they are not hiding the element.
window.scrollTo(0, eYCoord - 200);

0 comments on commit c1512e4

Please sign in to comment.
You can’t perform that action at this time.