Getting blank page using HTML publisher in Jenkins

455 Views Asked by At

I am using Jenkins to run Cypress tests and using using Mochawesome to generate reports.

I am able to generate json and html results files. From the reports folder I am able to link to my test results html file and view them in the browser.

But clicking on the "Mochawesome Report" in the Jenkins job leads to a blank page, except for having a link back to job 1 and a zip link. Here is where it links to:

http://localhost:8080/job/Job%201/Mochawesome_20Report/

This file points to jobs/Job 1/htmlreports/Mochaweseom_20Report which has these generated files in it: mochawesome_06272023_160251.json mochawesome_06272023_160251.html

But as I mentioned the link goes to the blank page: enter image description here enter image description here

Is there supposed to be a link to the HTML report on the blank page or should it just show the report?

Should index.html be added to the folder where you set it here? enter image description here

I am not clear on what populates that link or how it happens, and have not found any documentation to clarify it. I appreciate your help. I have the report available but just have no clue how to correctly link to it from Jenkins.

Also I tried setting this with no luck: System.setProperty("hudson.model.DirectoryBrowserSupport.CSP"," ")

1

There are 1 best solutions below

0
Uzoma On

You mentioned

This file points to jobs/Job 1/htmlreports/Mochaweseom_20Report which has these generated files in it: mochawesome_06272023_160251.json mochawesome_06272023_160251.html

But then in your Publish HTML report config you pointed to index.html, this is most likely why this isn't working.

Try to edit the HTML Publisher config and replace index.html with the appropriate name of your generated html file (mochawesome_06272023_160251.html). If this is done correctly you should ideally see a tab for the file when you open the report in Jenkins:

HTML reports tab