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

淺唱寂寞╮ 提交于 2019-12-11 10:09:47

问题


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.

  1. Open your terminal.
  2. Cd /etc/default
  3. Open file
  4. sudo vim jenkins
  5. Add below command in file.
  6. JAVA_ARGS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP="
  7. Restart the jenkins server.
  8. sudo service jenkins restart.


来源:https://stackoverflow.com/questions/34892106/html-page-is-shown-with-broken-ui-while-publishing-the-extent-report-html-file-u

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!