HTML page is shown with broken UI While publishing the extent report HTML file on Jenkins using the 'HTML Publisher Plugin'

praveen.4705 picture praveen.4705 · Jan 20, 2016 · Viewed 10.3k times · Source

HTML page is shown with broken UI While publishing the extent report HTML file using the 'HTML Publisher Plugin', Can any one please guide me how can I print the complete report with proper UI

Screenshot of the report when I open the html report using the HTML publisher plugin

enter image description here

Screenshot of the report when I open the same html report file using the Firefox browser

enter image description here

Answer

Pranam picture Pranam · Aug 10, 2018

I was facing a similar issue when I was trying to view the extent report from Jenkins.

Reason for this issue: The issue is because of the 'Content-Security-Policy' which is introduced in Jenkins from v1.641, It is blocking the inline CSS, JS Ajax resources to loaded

Solution: Change default Content Security Policy. Go to Manage Jenkins -> Script Console and type into console the following commands:

System.clearProperty("hudson.model.DirectoryBrowserSupport.CSP");

System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "sandbox allow-scripts; default-src 'self'; script-src * 'unsafe-eval'; img-src *; style-src * 'unsafe-inline'; font-src *");

restart Jenkins after the above step

This worked for me :)