[wtr-general] Re: Embed screenshot in Watir-rspec report (not just for failed tests)

2014-05-06 Thread Arjen Ruiterkamp
Hi Jarmo,

You give some good points to think about. I agree that there should be no 
reason to look at the reports when they don't fail.
On the level on integration testing, we're mostly interested in the layout 
of the Flot graph (scaling/stacking of bars etc.) and I'm not sure if unit 
testing the data given to the Flot graph will cover this 'requirement'.
Maybe I can extract the location of a bar in the Flot graph using 
Javascript and then interact with that using Watir-webdriver.
This will require some more research on my part and is probably more 
related to Flot than Watir ;)

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.


[wtr-general] Re: Embed screenshot in Watir-rspec report (not just for failed tests)

2014-04-18 Thread Arjen Ruiterkamp
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/ACU/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.


[wtr-general] Embed screenshot in Watir-rspec report (not just for failed tests)

2014-04-15 Thread Arjen Ruiterkamp
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.


[wtr-general] Re: Watir-rspec still requires browser variables when executing browser methods?

2014-03-20 Thread Arjen Ruiterkamp
Ok, the problem apparently was with the tests being in the 
/spec/acceptancefolder. The Rspec configuration isn't loaded for custom folders 
by default..

Basically I had to change all the config.include lines in spec_helper.rbfrom:
config.include Watir::RSpec::Helper, :type = :request
to
config.include Watir::RSpec::Helper, :type = :acceptance 

and in google_spec.rb change:
describe Google do
to
describe Google, :type = :acceptance do

On Wednesday, March 19, 2014 2:18:35 PM UTC+1, Arjen Ruiterkamp wrote:

 Hello,

 I am fairly new to Ruby and trying to setup some acceptance tests using 
 the watir-rspec gem.

 Now https://github.com/watir/watir-rspec states:

- No need to use the @browser or $browser variables when executing 
browser methods.

 However, this doesn't seem to work for me.

 What I've done so far:
 rails new hello_world

 Then added to the gemfile:
 group :test do
   gem rspec-rails
   gem watir-rspec
   gem watir-rails
 end

 Execute:
 bundle install
 rails generate rspec:install
 watir-rspec install

 This all seems to work fine so far

 Now I created a file in the spec folder: /spec/acceptance/google_spec.rband 
 added the watir-rspec example:

 require spec_helper
 describe Google do
   before { goto http://google.com; }

   it has search box do
 text_field(:name = q).should be_present
   end

   it allows to search do
 text_field(:name = q).set watir
 button(:id = gbqfb).click
 results = div(:id = ires)
 results.should be_present.within(2)
 results.lis(:class = g).map(:text).should be_any { |text| text =~ 
 /watir/ }
 results.should be_present.during(1)
   endend

 Now when I run rspec I get the following output:

 Results will be saved to tmp/spec-results/index.html
 FF

 Failures:

   1) Google has search box
  Failure/Error: before { goto http://google.com; }
  NoMethodError:
undefined method `goto' for 
 #RSpec::Core::ExampleGroup::Nested_1:0x5715a50
  # ./spec/acceptance/google_spec.rb:6:in `block (2 levels) in top 
 (required)'

   2) Google allows to search
  Failure/Error: before { goto http://google.com; }
  NoMethodError:
undefined method `goto' for 
 #RSpec::Core::ExampleGroup::Nested_1:0x57c86d0
  # ./spec/acceptance/google_spec.rb:6:in `block (2 levels) in top 
 (required)'

 Finished in 0.051 seconds
 2 examples, 2 failures

 Failed examples:

 rspec ./spec/acceptance/google_spec.rb:8 # Google has search box
 rspec ./spec/acceptance/google_spec.rb:12 # Google allows to search

 Obviously this can be solved by adding the browser variables but it should 
 be possible without.. right?

 Relevant gem versions:
 Using rspec-core (2.14.8)
 Using rspec-expectations (2.14.5)
 Using rspec-mocks (2.14.6)
 Using rspec (2.14.1)
 Using rspec-rails (2.14.1)
 Using watir-classic (4.0.1)
 Using watir-webdriver (0.6.8)
 Using watir (5.0.0)
 Using watir-rails (1.0.3)
 Using watir-rspec (1.1.2)

 Regards,
 Arjen


-- 
-- 
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.


[wtr-general] Watir-rspec still requires browser variables when executing browser methods?

2014-03-19 Thread Arjen Ruiterkamp
Hello,

I am fairly new to Ruby and trying to setup some acceptance tests using the 
watir-rspec gem.

Now https://github.com/watir/watir-rspec states:

   - No need to use the @browser or $browser variables when executing 
   browser methods.

However, this doesn't seem to work for me.

What I've done so far:
rails new hello_world

Then added to the gemfile:
group :test do
  gem rspec-rails
  gem watir-rspec
  gem watir-rails
end

Execute:
bundle install
rails generate rspec:install
watir-rspec install

This all seems to work fine so far

Now I created a file in the spec folder: /spec/acceptance/google_spec.rband 
added the watir-rspec example:

require spec_helper
describe Google do
  before { goto http://google.com; }

  it has search box do
text_field(:name = q).should be_present
  end

  it allows to search do
text_field(:name = q).set watir
button(:id = gbqfb).click
results = div(:id = ires)
results.should be_present.within(2)
results.lis(:class = g).map(:text).should be_any { |text| text =~ 
/watir/ }
results.should be_present.during(1)
  endend

Now when I run rspec I get the following output:

Results will be saved to tmp/spec-results/index.html
FF

Failures:

  1) Google has search box
 Failure/Error: before { goto http://google.com; }
 NoMethodError:
   undefined method `goto' for 
#RSpec::Core::ExampleGroup::Nested_1:0x5715a50
 # ./spec/acceptance/google_spec.rb:6:in `block (2 levels) in top 
(required)'

  2) Google allows to search
 Failure/Error: before { goto http://google.com; }
 NoMethodError:
   undefined method `goto' for 
#RSpec::Core::ExampleGroup::Nested_1:0x57c86d0
 # ./spec/acceptance/google_spec.rb:6:in `block (2 levels) in top 
(required)'

Finished in 0.051 seconds
2 examples, 2 failures

Failed examples:

rspec ./spec/acceptance/google_spec.rb:8 # Google has search box
rspec ./spec/acceptance/google_spec.rb:12 # Google allows to search

Obviously this can be solved by adding the browser variables but it should 
be possible without.. right?

Relevant gem versions:
Using rspec-core (2.14.8)
Using rspec-expectations (2.14.5)
Using rspec-mocks (2.14.6)
Using rspec (2.14.1)
Using rspec-rails (2.14.1)
Using watir-classic (4.0.1)
Using watir-webdriver (0.6.8)
Using watir (5.0.0)
Using watir-rails (1.0.3)
Using watir-rspec (1.1.2)

Regards,
Arjen

-- 
-- 
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.