Skip to content

Commit d2808e3

Browse files
committed
Adapt DockerServerCredentialsTest for 2.413 UI improvement
Jenkins 2.412 and earlier use a text area for the client key. Jenkins 2.413 and newer use an input field for the client key. Jenkins 2.413 looks much nicer with a button that is consistent with the other buttons used in the Jenkins pages. jenkinsci/jenkins#8179 is the Jenkins core pull request that implemented the change in Jenkins 2.413. Other plugins that use HTMLUnit to enter a value for the secret text may need a similar change.
1 parent 3dc5357 commit d2808e3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/test/java/org/jenkinsci/plugins/docker/commons/credentials/DockerServerCredentialsTest.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
import org.htmlunit.html.HtmlForm;
3636
import hudson.security.ACL;
3737
import hudson.util.Secret;
38+
import hudson.util.VersionNumber;
3839
import org.junit.Rule;
3940
import org.junit.Test;
4041
import org.jvnet.hudson.test.JenkinsRule;
@@ -98,7 +99,13 @@ public void configRoundTripUpdateCertificates() throws Exception {
9899
button.click();
99100
}
100101

101-
form.getTextAreaByName("_.clientKeySecret").setText("new key");
102+
if (j.jenkins.getVersion().isOlderThan(new VersionNumber("2.413"))) {
103+
/* Jenkins 2.412 and earlier use a text area for the client key */
104+
form.getTextAreaByName("_.clientKeySecret").setText("new key");
105+
} else {
106+
/* Jenkins 2.413 and newer use an input field for the client key */
107+
form.getInputByName("_.clientKeySecret").setValue("new key");
108+
}
102109
form.getTextAreaByName("_.clientCertificate").setText("new cert");
103110
form.getTextAreaByName("_.serverCaCertificate").setText("new ca cert");
104111
j.submit(form);

0 commit comments

Comments
 (0)