Html report should display properly in Jenkins
shubhamsc opened this issue · comments
Actual Behaviour
Html report is not displaying properly in Jenkins. The pie-chart and screenshot images are missing. The symbol for copying file path and sorting by name and execution time also missing.
Expected Behaviour
The report should display Properly.
Steps to Reproduce
- Create a java-maven project
- Build the project in Jenkins
- open HTML report from Jenkins workspace
Gauge version: 1.0.4
Commit Hash: 3a9a647
Plugins
html-report (4.0.6)
java (0.7.1)
The report which is generated by building the project in Jenkins, If we open in localhost then everything seems good. the only when the report is opening from Jenkins, screenshots do not appear. If we try to open the image in new tab we can see that image as well.
@shubhamsc : Also if there is an error, the screenshot also missing when the HTML report open from the Jenkins.
@zabil: I think if you guys can develop a jenkins reporting plugin for gauge, it would be very much helpful for the CI/CD pipeline. Because, we would like to have the trending test execution report and test execution summary when we click on a build number.
I think if you guys can develop a jenkins reporting plugin for gauge
You can use the XML report plugin and configure jenkins junit's plugin to do this.
@osandadeshan The current issue is related to new version of Jenkins.
They've introduced new Content security policy which adds the below header to the response headers & the browsers simply decline to execute anything like stylesheets / Javascript.
X-Content-Security-Policy: sandbox; default-src 'none'; img-src 'self'; style-src 'self';
You need to follow these steps for solution :
- Open the Jenkin home page.
- Go to Manage Jenkins.
- Now go to Script Console.
- In that console paste below line and click on Run.
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
- open html-report it will show as expected.
Note : After following the above steps if still it is not loading report properly then clear the browser cache and cookie and refresh the page.
For more information refer https://www.jenkins.io/doc/book/security/configuring-content-security-policy/
@shubhamsc
Thanks for the solution. It worked well!
Thanks a lot for this solution. Not sure how come its not being everywhere on the internet.. Thanks for the detailed solution and explanation behind it