Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

missing pie chart and other elements when display serenity report from jenkins

Need your help!

I've been working on integrating my automation test to Jenkins. I use Serenity BDD and JBehave. My Serenity report displayed OK when I run my test manually. But, when I integrate the test to Jenkins and try to display the report through Publish HTML Report Plugin, it can't display the pie chart and missing other elements as well.

Any idea how to solve this?

like image 561
Sekar Karindra Avatar asked Jan 12 '16 10:01

Sekar Karindra


1 Answers

Actually you don't need to downgrade Jenkins. This issue happens because of new content security policy headers that is supported by modern browsers. Correct resolution could be the following (code examples and paths for CentOS 7):

  • Configure content policy headers via Jenkins system property:

    sudo vim /etc/sysconfig/jenkins
    set java options as following:
    JENKINS_JAVA_OPTIONS="-Djava.awt.headless=true -Dhudson.model.DirectoryBrowserSupport.CSP=\"sandbox allow-forms allow-scripts; default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline';\""
    # save and exit
    sudo /etc/init.d/jenkins restart
    
  • Install Jenkins CORS Filter Plugin: https://wiki.jenkins-ci.org/display/JENKINS/Cors+Filter+Plugin

  • Setup CORS (Manage Jenkins -> Configure System -> CORS Filter) enter image description here

  • Enjoy results :-)

More details about content security policy: http://content-security-policy.com

like image 145
Alex Rewa Avatar answered Sep 27 '22 21:09

Alex Rewa