How to add Image source in json file of extent spark report config file

86 views Asked by At

I have spark-config.json file as below:

{
  "theme": "STANDARD",
  "encoding": "utf-8",
  "protocol": "HTTPS",
  "timelineEnabled": true,
  "offlineMode": true,
  "thumbnailForBase64": false,
  "documentTitle": "Test Automation Report",
  "reportName": "TA Report",
  "timeStampFormat": "MMM dd, yyyy HH:mm:ss a",
  "js": "document.getElementsByClassName('logo')[0].style.display = 'none';",
  "css": ""
}

In above file under js section, I need to add code as below:

<![CDATA[<img src='.//src/test/resources/Logo/CompanyLogo.png'/>]]>                 

but this is not working

Expected : I want to see Image on Header section of Extent report instead of Extent Logo

Actual : Its only removing Extent logo but I want to add a new logo. So how can I do it ?

document.getElementsByClassName('logo')[0].style.display = 'none';
1

There are 1 answers

0
Greg Burghardt On

The "js" property just needs to specify the src attribute of the image tag:

{
    ...
    "js": "document.querySelector('.logo').setAttribute('src', './src/test/resources/Logo/CompanyLogo.png');",
    "css": ""
}