Index.html file - is not displaying with CSS and basic html displayed when the file is created during the jenkins build
Yoganand1995 opened this issue · comments
Describe the bug
I Have used this report generation plugin in the rest assured bdd cucumber project and hosted the src code on the git hub and building the project through the jenkins. In the target folder the index.html file is created. but when i try to open the file- it displays as the basic html file without CSS
To Reproduce
Steps to reproduce the behavior:
- Run the project on the jenkins
Expected behavior
The Index.html file should be integrated with CSS changes , when run through intellij and html file opened through intellij the report looks absolutely fine
This is probably due to the Jenkins content policy. Please check this issue: #98
Thanks a Lot for the helps , the issue got resolved
Details and Resolution
CSS is stripped out because of the Content Security Policy in Jenkins. (https://wiki.jenkins-ci.org/display/JENKINS/Configuring+Content+Security+Policy)
The default rule is set to:
sandbox; default-src 'none'; img-src 'self'; style-src 'self';
This rule set results in the following:
No JavaScript allowed at all
No plugins (object/embed) allowed
No inline CSS, or CSS from other sites allowed
No images from other sites allowed
No frames allowed
No web fonts allowed
No XHR/AJAX allowed, etc.
To relax this rule, go to
Manage Jenkins->
Manage Nodes->
Click settings(gear icon)->
click Script console on left and type in the following command:
System.setProperty("hudson.model.DirectoryBrowserSupport.CSP", "")
and Press Run. If you see the output as 'Result:' below "Result" header then the protection disabled. Re-Run your build and you can see that the new HTML files archived will have the CSS enabled.
Thanks a lot for also posting the full solution here 👍
Thanks for the solution. Very helpful 👍