Skip to content

Commit 6076333

Browse files
authored
Merge pull request #1308 from amuniz/fix-tests-2.385
Fix tests for the upcoming LTS
2 parents 23e440f + a7c5d03 commit 6076333

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/test/java/org/csanchez/jenkins/plugins/kubernetes/KubernetesCloudTest.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.logging.Level;
1515
import java.util.logging.Logger;
1616

17+
import com.gargoylesoftware.htmlunit.ElementNotFoundException;
1718
import com.gargoylesoftware.htmlunit.html.DomElement;
1819
import com.gargoylesoftware.htmlunit.html.DomNodeList;
1920
import com.gargoylesoftware.htmlunit.html.HtmlButton;
@@ -257,11 +258,11 @@ public void defaultWorkspaceVolume() throws Exception {
257258
JenkinsRule.WebClient wc = j.createWebClient();
258259
HtmlPage p = wc.goTo("configureClouds/");
259260
HtmlForm f = p.getFormByName("config");
260-
HtmlButton buttonExtends = HtmlFormUtil.getButtonByCaption(f, "Pod Templates...");
261+
HtmlButton buttonExtends = getButton(f, "Pod Templates");
261262
buttonExtends.click();
262-
HtmlButton buttonAdd = HtmlFormUtil.getButtonByCaption(f, "Add Pod Template");
263+
HtmlButton buttonAdd = getButton(f, "Add Pod Template");
263264
buttonAdd.click();
264-
HtmlButton buttonDetails = HtmlFormUtil.getButtonByCaption(f, "Pod Template details...");
265+
HtmlButton buttonDetails = getButton(f, "Pod Template details");
265266
buttonDetails.click();
266267
DomElement templates = p.getElementByName("templates");
267268
HtmlInput templateName = getInputByName(templates, "_.name");
@@ -273,6 +274,18 @@ public void defaultWorkspaceVolume() throws Exception {
273274
assertEquals(WorkspaceVolume.getDefault(), podTemplate.getWorkspaceVolume());
274275
}
275276

277+
// TODO 2.385+ delete
278+
private HtmlButton getButton(HtmlForm f, String buttonText) {
279+
HtmlButton button;
280+
try {
281+
button = HtmlFormUtil.getButtonByCaption(f, buttonText);
282+
} catch (ElementNotFoundException e) {
283+
// before https://github.com/jenkinsci/jenkins/pull/7173 the 3 dots where added by core
284+
button = HtmlFormUtil.getButtonByCaption(f, buttonText + "...");
285+
}
286+
return button;
287+
}
288+
276289
@Test
277290
public void minRetentionTimeout() {
278291
KubernetesCloud cloud = new KubernetesCloud("kubernetes");

0 commit comments

Comments
 (0)