Skip to content

Commit

Permalink
Upgrade to 2.480 (#1773)
Browse files Browse the repository at this point in the history
  • Loading branch information
basil authored Oct 9, 2024
1 parent 04c99b6 commit fbc575f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<properties>
<changelist>999999-SNAPSHOT</changelist>
<spotbugs.skip>true</spotbugs.skip>
<jenkins.version>2.479</jenkins.version>
<jenkins.version>2.480</jenkins.version>
<selenium.version>4.25.0</selenium.version>
<!-- aligned with selenium -->
<guava.version>33.3.1-jre</guava.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import static org.junit.Assert.assertTrue;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import hudson.util.VersionNumber;
import java.time.Duration;
import org.jenkinsci.test.acceptance.plugins.credentials.UserPwdCredential;
import org.jenkinsci.test.acceptance.plugins.ssh_credentials.SshCredentialDialog;
Expand Down Expand Up @@ -37,17 +38,27 @@ public SshCredentialDialog addCredential() {
find(by.button("Add")).click();

if (getElement(By.cssSelector(".credentials-add-menu-items")) != null) {
// This condition is for backwards compatability, can be removed in the future
/*
* This condition is for backwards compatibility and can be removed when we drop support for Credentials
* 1381 and earlier.
*/
String providerXpathExpr = "//div[contains(@class,'credentials-add-menu-items')]"
+ "/div[@class='bd']/ul[@class='first-of-type']/li[contains(@class, 'yuimenuitem')]"
+ "/span[contains(@class,'yuimenuitemlabel') and contains(@tooltip, 'Jenkins Credentials Provider')]";
waitFor(by.xpath(providerXpathExpr)).click();
} else {
// Can be changed to 'find(...)' when https://github.com/jenkinsci/jenkins/pull/9835 is merged
} else if (getPage().getJenkins().getVersion().isOlderThan(new VersionNumber("2.480"))) {
/*
* This condition is for backwards compatibility and can be removed when we drop support for 2.479 and
* earlier.
*/
all(by.css(".jenkins-dropdown"))
.get(1)
.findElement(by.button("Jenkins Credentials Provider"))
.click();
} else {
find(by.css(".jenkins-dropdown"))
.findElement(by.button("Jenkins Credentials Provider"))
.click();
}

return new SshCredentialDialog(getPage(), "/credentials");
Expand Down

0 comments on commit fbc575f

Please sign in to comment.