Hi Jarmo, thanks for replying

I'll clarify a bit what I would like in my rspec report.

I don't want to make a screenshot after *every *spec, just during some of 
the specs which test Flot graphs (a Javascript library for displaying 
graphs).
These Flot graphs are pretty hard to interact with using Watir-Webdriver 
thus I want to add a screenshot to the report (or a link to the screenshot) 
so our testers can quickly check if nothing weird is going on.

So my (simplified) spec looks like this: 
describe "do something once logged in" do

  it "should screenshot the flot graph" do
    screenshot.save 'flot.png'
  end
end

Then the generated report should look like this:

<https://lh6.googleusercontent.com/-vsIEoAadNmE/U1DTkUF0yoI/AAAAAAAAACU/VzUQ0FuRcSM/s1600/rspec.png>












Hopefully this clears up my question.

Is this possible with just watir-rspec or is some form of monkey patching 
required?

Regards,
Arjen

On Tuesday, April 15, 2014 12:07:04 PM UTC+2, Arjen Ruiterkamp wrote:
>
> Hello,
>
> For some acceptance tests I want to include screenshots, which are made 
> during my specs, to the report (thus not just for failing specs).
> The watir-rspec readme states:
>
> You can use Watir::RSpec.file_path to have links automatically in the html 
> report to the files created during tests.
>
> uploaded_file_path = 
> Watir::RSpec.file_path("uploaded.txt")File.open(uploaded_file_path, "w") 
> {|file| file.write "Generated File Input"}file_field(:name => 
> "upload-file").set uploaded_file_path
>
> Where do I put this code? When I put it in my spec_helper.rb, I get this 
> error: undefined method `file_field' for main:Object (NoMethodError)
> Anyone has some ideas what I'm doing wrong?
>

-- 
-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

watir-general@googlegroups.com
http://groups.google.com/group/watir-general
watir-general+unsubscr...@googlegroups.com

--- 
You received this message because you are subscribed to the Google Groups 
"Watir General" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to watir-general+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to