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?
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)
Enjoy results :-)
More details about content security policy: http://content-security-policy.com
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With