Skip to content

Commit

Permalink
Adapt DockerServerCredentialsTest for 2.413 UI improvement
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
MarkEWaite committed Jul 8, 2023
1 parent 3dc5357 commit d2808e3
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import org.htmlunit.html.HtmlForm;
import hudson.security.ACL;
import hudson.util.Secret;
import hudson.util.VersionNumber;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.JenkinsRule;
Expand Down Expand Up @@ -98,7 +99,13 @@ public void configRoundTripUpdateCertificates() throws Exception {
button.click();
}

form.getTextAreaByName("_.clientKeySecret").setText("new key");
if (j.jenkins.getVersion().isOlderThan(new VersionNumber("2.413"))) {
/* Jenkins 2.412 and earlier use a text area for the client key */
form.getTextAreaByName("_.clientKeySecret").setText("new key");
} else {
/* Jenkins 2.413 and newer use an input field for the client key */
form.getInputByName("_.clientKeySecret").setValue("new key");
}
form.getTextAreaByName("_.clientCertificate").setText("new cert");
form.getTextAreaByName("_.serverCaCertificate").setText("new ca cert");
j.submit(form);
Expand Down

0 comments on commit d2808e3

Please sign in to comment.