Skip to content

Commit

Permalink
Fix failing unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
janfaracik committed Oct 22, 2021
1 parent acd5c19 commit e77882d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions test/src/test/java/hudson/model/ParametersTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public void parameterTypes() throws Exception {

HtmlTextInput stringParameterInput = DomNodeUtil.selectSingleNode(element, ".//input[@name='value']");
assertEquals("defaultValue", stringParameterInput.getAttribute("value"));
assertEquals("string", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'setting-name')]")).getTextContent());
assertEquals("string", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'jenkins-form-label')]")).getTextContent());
stringParameterInput.setAttribute("value", "newValue");

element = DomNodeUtil.selectSingleNode(form, "//div[input/@value='boolean']");
Expand All @@ -85,12 +85,12 @@ public void parameterTypes() throws Exception {
element = (HtmlElement) ((HtmlElement) DomNodeUtil.selectSingleNode(form, ".//div[input/@value='choice']")).getParentNode();
assertNotNull(element);
assertEquals("choice description", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getNextSibling().getNextSibling(), "div[@class='setting-description']")).getTextContent());
assertEquals("choice", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'setting-name')]")).getTextContent());
assertEquals("choice", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'jenkins-form-label')]")).getTextContent());

element = (HtmlElement) ((HtmlElement) DomNodeUtil.selectSingleNode(form, ".//div[input/@value='run']")).getParentNode();
assertNotNull(element);
assertEquals("run description", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getNextSibling().getNextSibling(), "div[@class='setting-description']")).getTextContent());
assertEquals("run", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'setting-name')]")).getTextContent());
assertEquals("run", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'jenkins-form-label')]")).getTextContent());

j.submit(form);
Queue.Item q = j.jenkins.getQueue().getItem(project);
Expand Down Expand Up @@ -120,7 +120,7 @@ public void choiceWithLTGT() throws Exception {
HtmlElement element = (HtmlElement) ((HtmlElement) DomNodeUtil.selectSingleNode(form, ".//div[input/@value='choice']")).getParentNode();
assertNotNull(element);
assertEquals("choice description", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getNextSibling().getNextSibling(), "div[@class='setting-description']")).getTextContent());
assertEquals("choice", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'setting-name')]")).getTextContent());
assertEquals("choice", ((HtmlElement) DomNodeUtil.selectSingleNode(element.getParentNode(), "div[contains(@class, 'jenkins-form-label')]")).getTextContent());
HtmlOption opt = DomNodeUtil.selectSingleNode(element.getParentNode(), "div/div/select/option[@value='Choice <2>']");
assertNotNull(opt);
assertEquals("Choice <2>", opt.asText());
Expand Down
2 changes: 1 addition & 1 deletion test/src/test/java/lib/form/HeteroListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void xssPrevented_usingToolInstallation_withJustDisplayName() throws Exce

// check the displayName
Object resultDN = page.executeJavaScript(
"var settingFields = document.querySelectorAll('.setting-name');" +
"var settingFields = document.querySelectorAll('.jenkins-form-label');" +
"var children = Array.from(settingFields).filter(b => b.textContent.indexOf('XSS:') !== -1)[0].children;" +
"Array.from(children).filter(c => c.tagName === 'IMG')"
).getJavaScriptResult();
Expand Down

0 comments on commit e77882d

Please sign in to comment.