Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Forward compatibility with jenkinsci/credentials-plugin#551 #1756

Merged
merged 4 commits into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.jenkinsci.test.acceptance.po.Describable;
import org.jenkinsci.test.acceptance.po.PageObject;
import org.jenkinsci.test.acceptance.selenium.UselessFileDetectorReplacement;
import org.openqa.selenium.By;

/**
* @author Kohsuke Kawaguchi
Expand All @@ -33,14 +34,22 @@ public SshSlaveLauncher(PageObject context, String path) {
}

public SshCredentialDialog addCredential() {

find(by.button("Add")).click();

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')]";
if (getElement(By.cssSelector(".credentials-add-menu-items")) != null) {
// This condition is for backwards compatability, can be removed in the future
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
all(by.css(".jenkins-dropdown"))
.get(1)
.findElement(by.button("Jenkins Credentials Provider"))
.click();
basil marked this conversation as resolved.
Show resolved Hide resolved
}

waitFor(by.xpath(providerXpathExpr)).click();
return new SshCredentialDialog(getPage(), "/credentials");
}

Expand Down
Loading