Cross-posted from the Cukes Google Group:
I have experimented with a number of methods of saving screenshots, but settled on the method that is built into watir-webdriver. No matter which method I have used, I am not able to successfully embed a link to this image in the Cucumber HTML report.
In c:\ruby\cucumber\project_name\features\support\hooks.rb, I'm using:
After do |scenario|
if scenario.failed?
@browser.driver.save_screenshot("screenshot.png")
embed("screenshot.png", "image/png")
end
end
A link with text "Screenshot" IS added to the report, but the URL is
the project directory path ("c:\ruby\cucumber\project_name")
rather
than a direct link to the file ("c:\ruby\cucumber\project_name\screenshot.png")
. I have tried a number of different image formats
and direct paths using Dir.pwd with the same results each time.
What am I missing?
Thanks
Windows XP Ruby 1.8.7 watir-webdriver (0.2.4) cucumber (0.10.3)