问题
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
Screenshot of the report when I open the same html report file using the Firefox browser
回答1:
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 :)
回答2:
Found the solution for the issue, 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
To overcome this issue we need to use 'java -Dhudson.model.DirectoryBrowserSupport.CSP="" -jar jenkins.war' command to start Jenkins server from command prompt
Reference : https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy#ConfiguringContentSecurityPolicy-HTMLPublisherPlugin
回答3:
Please use below command for removing broken UI for extent Report.
- Open your terminal.
- Cd /etc/default
- Open file
- sudo vim jenkins
- Add below command in file.
- JAVA_ARGS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="
- Restart the jenkins server.
- sudo service jenkins restart.
来源:https://stackoverflow.com/questions/34892106/html-page-is-shown-with-broken-ui-while-publishing-the-extent-report-html-file-u