Skip to content

Commit

Permalink
Merge pull request #199 from mafraba/JENKINS-38794
Browse files Browse the repository at this point in the history
[JENKINS-38794] make @WithPlugins check required version when 'uploadPlugins=false'
  • Loading branch information
olivergondza committed Oct 13, 2016
2 parents da7bc56 + 1d64704 commit 4fe2d2b
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/main/java/org/jenkinsci/test/acceptance/po/PluginManager.java
Expand Up @@ -148,6 +148,12 @@ public boolean isInstalled(String... specs) {
return true;
}

private VersionNumber getAvailableVersionForPlugin(String pluginName) {
// assuming we are on 'available' page
String v = find(by.xpath("//input[starts-with(@name,'plugin.%s.')]/../../td[last()]", pluginName)).getText();
return new VersionNumber(v);
}

/**
* Installs specified plugins.
*
Expand Down Expand Up @@ -224,6 +230,13 @@ public boolean installPlugins(final String... specs) throws UnableToResolveDepen
for (int attempt = 0; attempt < 2; attempt++) {// # of installations attempted, considering retries
visit("available");
check(find(by.xpath("//input[starts-with(@name,'plugin.%s.')]", n)));
VersionNumber availableVersion = getAvailableVersionForPlugin(n);
VersionNumber requiredVersion = new VersionNumber(candidates.get(n));
if (availableVersion.isOlderThan(requiredVersion)) {
throw new AssumptionViolatedException(
String.format("Version '%s' of '%s' is required, but available version is '%s'",
requiredVersion, n, availableVersion));
}

clickButton("Install");

Expand Down

0 comments on commit 4fe2d2b

Please sign in to comment.