Help to configure custom screenshot location for Pretty face report
I see the Screenshot location in HTML report always looks for src = \images - instead i want to change this to custom location within my project, can someone help me to achieve this ?
Hi @melvinpradep , the images are placed inside that folder to ensure:
- the report is portable (you could zip it up and send it to a friend)
- only the content for that explicit test run is stored/shared/loaded
When you take a screenshot and call the embed command, 2 images are made. One image is stored in whatever location you give to save_screenshot, and the other is stored in the /images dir of the report. I usually delete the un-embeded screenshot file and ONLY keep the images which live in the report folder.
The report would become brittle if you moved the images outside the report directory, I do not recommend it. However, if you want to experiment start with the following code block in html.rb
def embed_image(src, label)
@report.current_scenario.image << src.split(separator).last
@report.current_scenario.image_label << label
@report.current_scenario.image_id << "img_#{@img_id}"
@img_id += 1
filename = "#{File.dirname(@path)}#{separator}images"
FileUtils.cp src, filename
end