Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help to configure custom screenshot location for Pretty face report #45

Open
melvinpradep opened this issue Nov 5, 2015 · 1 comment

Comments

@melvinpradep
Copy link

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 ?

@azohra
Copy link

azohra commented Nov 28, 2015

Hi @melvinpradep , the images are placed inside that folder to ensure:

  1. the report is portable (you could zip it up and send it to a friend)
  2. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants