-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Test results summary: fix JavaScript console error when 'showLink' HTML element is missing #514
Test results summary: fix JavaScript console error when 'showLink' HTML element is missing #514
Conversation
… failures-exist conditional block
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable, thanks!
I assume you manually tested this?
You're welcome - and yep, tested manually locally with a sample JUnit XML report. |
(Triggering build) |
@timja this apparently produced a release (jenkinsci/bom#2059) but it is not in Releases? |
Yeah https://github.com/jenkinsci/junit-plugin/actions/runs/4941356327/jobs/8833887199
Manually created now: https://github.com/jenkinsci/junit-plugin/releases/tag/1202.v79a_986785076next |
The
showLink
HTML anchor element is only rendered server-side when fewer tests are displayed on the page than exist in the job result.So if the job passes (zero failures displayed, zero failures exist), or if there are up to ten failures (up-to-ten failures displayed, up-to-ten failures exist), then the
showLink
HTML element won't be present on the page.The associated
show-failures.js
adjunct code attempts to add anonclick
event handler to ashowLink
-ID'd element on the page after the HTML DOM loads:junit-plugin/src/main/resources/hudson/tasks/test/AbstractTestResultAction/show-failures.js
Lines 29 to 31 in 19a5192
This results in an error appearing in the browser's JavaScript console when the
showLink
element is not present in the HTML.The fix suggested here is to only include the relevant JavaScript adjunct when the link itself is also placed on the page.
Related issues