显示詹金斯的宁静报告时缺少饼图和其他元素

显示詹金斯的宁静报告时缺少饼图和其他元素

本文介绍了显示詹金斯的宁静报告时缺少饼图和其他元素的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

需要您的帮助!

我一直在努力将自动化测试集成到Jenkins.我使用Serenity BDD和JBehave.当我手动运行测试时,我的宁静"报告显示为确定".但是,当我将测试集成到Jenkins并尝试通过发布HTML报表插件"显示报表时,它也无法显示饼图并且也缺少其他元素.

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?

推荐答案

实际上,您不需要降级Jenkins.发生此问题的原因是现代浏览器支持新的内容安全策略标头.正确的分辨率可能如下(CentOS 7的代码示例和路径):

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):

  • 通过Jenkins系统属性配置内容策略标头:

  • 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

  • 安装Jenkins CORS过滤器插件: https://wiki.jenkins-ci.org/display/JENKINS/Cors+Filter+Plugin

    设置CORS(管理Jenkins->配置系统-> CORS过滤器)

    Setup CORS (Manage Jenkins -> Configure System -> CORS Filter)

    享受结果:-)

    有关内容安全策略的更多详细信息: http://content-security-policy.com

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

    这篇关于显示詹金斯的宁静报告时缺少饼图和其他元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

  • 07-30 09:01