Skip to content

Commit

Permalink
Merge pull request #1308 from amuniz/fix-tests-2.385
Browse files Browse the repository at this point in the history
Fix tests for the upcoming LTS
  • Loading branch information
jglick authored Feb 10, 2023
2 parents 23e440f + a7c5d03 commit 6076333
Showing 1 changed file with 16 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;

import com.gargoylesoftware.htmlunit.ElementNotFoundException;
import com.gargoylesoftware.htmlunit.html.DomElement;
import com.gargoylesoftware.htmlunit.html.DomNodeList;
import com.gargoylesoftware.htmlunit.html.HtmlButton;
Expand Down Expand Up @@ -257,11 +258,11 @@ public void defaultWorkspaceVolume() throws Exception {
JenkinsRule.WebClient wc = j.createWebClient();
HtmlPage p = wc.goTo("configureClouds/");
HtmlForm f = p.getFormByName("config");
HtmlButton buttonExtends = HtmlFormUtil.getButtonByCaption(f, "Pod Templates...");
HtmlButton buttonExtends = getButton(f, "Pod Templates");
buttonExtends.click();
HtmlButton buttonAdd = HtmlFormUtil.getButtonByCaption(f, "Add Pod Template");
HtmlButton buttonAdd = getButton(f, "Add Pod Template");
buttonAdd.click();
HtmlButton buttonDetails = HtmlFormUtil.getButtonByCaption(f, "Pod Template details...");
HtmlButton buttonDetails = getButton(f, "Pod Template details");
buttonDetails.click();
DomElement templates = p.getElementByName("templates");
HtmlInput templateName = getInputByName(templates, "_.name");
Expand All @@ -273,6 +274,18 @@ public void defaultWorkspaceVolume() throws Exception {
assertEquals(WorkspaceVolume.getDefault(), podTemplate.getWorkspaceVolume());
}

// TODO 2.385+ delete
private HtmlButton getButton(HtmlForm f, String buttonText) {
HtmlButton button;
try {
button = HtmlFormUtil.getButtonByCaption(f, buttonText);
} catch (ElementNotFoundException e) {
// before https://github.com/jenkinsci/jenkins/pull/7173 the 3 dots where added by core
button = HtmlFormUtil.getButtonByCaption(f, buttonText + "...");
}
return button;
}

@Test
public void minRetentionTimeout() {
KubernetesCloud cloud = new KubernetesCloud("kubernetes");
Expand Down

0 comments on commit 6076333

Please sign in to comment.