Skip to content
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 @@ -26,6 +26,8 @@

import com.gargoylesoftware.htmlunit.html.HtmlPage;
import com.gargoylesoftware.htmlunit.html.HtmlTextArea;
import hudson.util.VersionNumber;
import jenkins.model.Jenkins;
import org.hamcrest.Matchers;
import org.jenkinsci.plugins.scriptsecurity.sandbox.Whitelist;
import org.jenkinsci.plugins.scriptsecurity.scripts.languages.GroovyLanguage;
Expand Down Expand Up @@ -87,7 +89,11 @@ public void malformedScriptApproval() throws Exception {
HtmlPage managePage = wc.goTo("manage");

List<?> scriptApprovalLinks = managePage.getByXPath("//a[@href='scriptApproval']");
assertEquals(2, scriptApprovalLinks.size()); // the icon link and the textual link
int expectedLinkCount = 2;
if (Jenkins.getVersion().isNewerThan(new VersionNumber("2.102"))) {
expectedLinkCount = 1; // https://github.com/jenkinsci/jenkins/pull/2857 made major changes to management page
}
assertEquals(expectedLinkCount, scriptApprovalLinks.size()); // the icon link and the textual link

String managePageBodyText = managePage.getBody().getTextContent();
assertThat(managePageBodyText, Matchers.containsString("1 dangerous signatures previously approved which ought not have been."));
Expand Down