Skip to content

Commit

Permalink
Fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
timja committed Dec 2, 2021
1 parent 7e5f10c commit ebd5bc4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions test/src/test/java/lib/form/HeteroListTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public void xssPrevented_usingToolInstallation_withJustDisplayName() throws Exce

// check the description
Object resultDesc = page.executeJavaScript(
"var settingFields = document.querySelectorAll('.setting-description');" +
"var settingFields = document.querySelectorAll('.jenkins-form-description');" +
"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 Expand Up @@ -200,10 +200,10 @@ public void xssPrevented_usingToolInstallation_repeatableDelete() throws Excepti
// we could also re-use the same method as used in xssUsingToolInstallationRepeatableAdd
page.executeJavaScript("Array.from(document.querySelectorAll('button')).filter(b => b.textContent.indexOf('Add XSS') !== -1)[0].click()");

Object result = page.executeJavaScript("Array.from(document.querySelectorAll('button')).filter(b => b.textContent.indexOf('Delete XSS') !== -1)[0].innerHTML").getJavaScriptResult();
Object result = page.executeJavaScript("Array.from(document.querySelectorAll('button')).filter(b => b.title.includes('Delete XSS'))[0].innerHTML").getJavaScriptResult();
assertThat(result, instanceOf(String.class));
String resultString = (String) result;
assertThat(resultString, not(containsString("<")));
assertThat(resultString, not(containsString("<img")));
}

public static class TestItemDescribable implements Describable<TestItemDescribable> {
Expand Down

0 comments on commit ebd5bc4

Please sign in to comment.