nofxx-watircuke 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/README +64 -0
- data/Rakefile +48 -0
- data/VERSION +1 -0
- data/features/sample.feature +10 -0
- data/features/step_definitions/assertions.rb +23 -0
- data/features/step_definitions/buttons.rb +3 -0
- data/features/step_definitions/checkboxes.rb +3 -0
- data/features/step_definitions/javascript.rb +3 -0
- data/features/step_definitions/links.rb +3 -0
- data/features/step_definitions/pages.rb +3 -0
- data/features/step_definitions/radio_buttons.rb +3 -0
- data/features/step_definitions/select_lists.rb +3 -0
- data/features/step_definitions/sleep.rb +3 -0
- data/features/step_definitions/spans.rb +3 -0
- data/features/step_definitions/text_fields.rb +4 -0
- data/features/step_definitions/urls.rb +3 -0
- data/features/support/env.rb +39 -0
- data/features/support/paths.rb +22 -0
- data/lib/watircuke.rb +117 -0
- data/lib/webratcuke.rb +181 -0
- data/spec/spec_helper.rb +10 -0
- data/spec/watircuke_spec.rb +7 -0
- data/watircuke.gemspec +59 -0
- metadata +78 -0
data/.gitignore
ADDED
data/README
ADDED
@@ -0,0 +1,64 @@
|
|
1
|
+
= Watircuke
|
2
|
+
|
3
|
+
|
4
|
+
== INSTALL
|
5
|
+
|
6
|
+
Cucumber:
|
7
|
+
http://wiki.github.com/aslakhellesoy/cucumber/install
|
8
|
+
|
9
|
+
Watir ~ Firewatir ~ Safariwatir:
|
10
|
+
http://wtr.rubyforge.org/install.html
|
11
|
+
|
12
|
+
Once installed just run "cucumber features" in Safari, Firefox, Watir (see features/support/env.rb)
|
13
|
+
|
14
|
+
|
15
|
+
== Rails
|
16
|
+
|
17
|
+
Supposing your webrat features are on features/plain, Watir on features/watir and
|
18
|
+
you remove step_definitions/webrat_steps.rb (don't worry, steps will be included),
|
19
|
+
you can run `cucumber` for plain webrat and `cucumber -p watir` for some Watir =D
|
20
|
+
|
21
|
+
cucumber.yml
|
22
|
+
|
23
|
+
default: -r features/support/env.rb -r features/support/webrat.rb -r features/step_definitions features/plain
|
24
|
+
watir: -r features/support/env.rb -r features/support/watir.rb -r features/step_definitions features/watir
|
25
|
+
|
26
|
+
|
27
|
+
support/watir.rb
|
28
|
+
|
29
|
+
require 'watircuke'
|
30
|
+
Before do
|
31
|
+
@environment = "http://localhost:3000/
|
32
|
+
sleep 1
|
33
|
+
end
|
34
|
+
# optional
|
35
|
+
# at_exit do
|
36
|
+
# @browser.close
|
37
|
+
# end
|
38
|
+
|
39
|
+
|
40
|
+
support/webrat.rb
|
41
|
+
|
42
|
+
require 'webrat'
|
43
|
+
Webrat.configure do |config|
|
44
|
+
config.mode = :rails
|
45
|
+
end
|
46
|
+
require 'cucumber/rails/rspec'
|
47
|
+
require 'webrat/core/matchers'
|
48
|
+
require 'webratcuke'
|
49
|
+
|
50
|
+
|
51
|
+
support/env.rb
|
52
|
+
|
53
|
+
ENV["RAILS_ENV"] ||= "cucumber"
|
54
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../config/environment')
|
55
|
+
require 'cucumber/rails/world'
|
56
|
+
require 'cucumber/formatter/unicode' # Comment out this line if you don't want Cucumber Unicode support
|
57
|
+
Cucumber::Rails.use_transactional_fixtures
|
58
|
+
Cucumber::Rails.bypass_rescue # Comment out this line if you want Rails own error handling
|
59
|
+
|
60
|
+
== TODO
|
61
|
+
|
62
|
+
Rewrite the watir steps to resemble webrat's ones.
|
63
|
+
|
64
|
+
**cukewatir maximizes the Gherkin speak and minimizes the Watir code.
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
begin
|
5
|
+
require 'jeweler'
|
6
|
+
Jeweler::Tasks.new do |gem|
|
7
|
+
gem.name = "watircuke"
|
8
|
+
gem.summary = "Watir steps for cucumber"
|
9
|
+
gem.email = "x@nofxx.com"
|
10
|
+
gem.homepage = "http://github.com/nofxx/watircuke"
|
11
|
+
gem.authors = ["Rich Downie", "Marcos Piccinini"]
|
12
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
13
|
+
end
|
14
|
+
|
15
|
+
rescue LoadError
|
16
|
+
puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
|
17
|
+
end
|
18
|
+
|
19
|
+
require 'spec/rake/spectask'
|
20
|
+
Spec::Rake::SpecTask.new(:spec) do |spec|
|
21
|
+
spec.libs << 'lib' << 'spec'
|
22
|
+
spec.spec_files = FileList['spec/**/*_spec.rb']
|
23
|
+
end
|
24
|
+
|
25
|
+
Spec::Rake::SpecTask.new(:rcov) do |spec|
|
26
|
+
spec.libs << 'lib' << 'spec'
|
27
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
28
|
+
spec.rcov = true
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
task :default => :spec
|
33
|
+
|
34
|
+
require 'rake/rdoctask'
|
35
|
+
Rake::RDocTask.new do |rdoc|
|
36
|
+
if File.exist?('VERSION.yml')
|
37
|
+
config = YAML.load(File.read('VERSION.yml'))
|
38
|
+
version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
|
39
|
+
else
|
40
|
+
version = ""
|
41
|
+
end
|
42
|
+
|
43
|
+
rdoc.rdoc_dir = 'rdoc'
|
44
|
+
rdoc.title = "watircuke #{version}"
|
45
|
+
rdoc.rdoc_files.include('README*')
|
46
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
47
|
+
end
|
48
|
+
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.2.2
|
@@ -0,0 +1,10 @@
|
|
1
|
+
Feature: Github
|
2
|
+
|
3
|
+
Scenario: search for cucumber at github
|
4
|
+
Given I am on the watircuke page
|
5
|
+
Then I verify the page contains the text "richdownie"
|
6
|
+
And I fill in the text field "q" with "cucumber"
|
7
|
+
And I click the "Search" button
|
8
|
+
And I select "Code" from the select list "type_value"
|
9
|
+
And I click the "aslakhellesoy / cucumber" link
|
10
|
+
Then I verify the page contains the text "BDD that talks to domain experts first and code second"
|
@@ -0,0 +1,23 @@
|
|
1
|
+
Given /I verify the page contains the text "(.*)"/ do |text|
|
2
|
+
assert(@browser.contains_text(text))
|
3
|
+
end
|
4
|
+
|
5
|
+
Given /I verify the page does not contain the text "(.*)"/ do |text|
|
6
|
+
assert_false(@browser.contains_text(text))
|
7
|
+
end
|
8
|
+
|
9
|
+
Given /I verify the page contains a div class "(.*)"/ do |byclass|
|
10
|
+
assert(@browser.div(:class, byclass).exists?)
|
11
|
+
end
|
12
|
+
|
13
|
+
Given /I verify the page contains a div id "(.*)"/ do |id|
|
14
|
+
assert(@browser.div(:id, id).exists?)
|
15
|
+
end
|
16
|
+
|
17
|
+
Given /I verify the page contains a link class "(.*)"/ do |byclass|
|
18
|
+
assert(@browser.link(:class, byclass).exists?)
|
19
|
+
end
|
20
|
+
|
21
|
+
Given /I verify the page contains the image "(.*)"/ do |image|
|
22
|
+
assert(@browser.image(:src, image).exists?)
|
23
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'test/unit/assertions'
|
2
|
+
include Test::Unit::Assertions
|
3
|
+
require 'spec'
|
4
|
+
|
5
|
+
if ENV['FIREWATIR']
|
6
|
+
require 'firewatir'
|
7
|
+
Browser = FireWatir::Firefox
|
8
|
+
else
|
9
|
+
case RUBY_PLATFORM
|
10
|
+
when /darwin|i686-linux/
|
11
|
+
require 'firewatir'
|
12
|
+
Browser = FireWatir::Firefox
|
13
|
+
# require 'safariwatir'
|
14
|
+
# Browser = Watir::Safari
|
15
|
+
when /win32|mingw/
|
16
|
+
require 'watir'
|
17
|
+
Browser = Watir::IE
|
18
|
+
when /java/
|
19
|
+
require 'celerity'
|
20
|
+
Browser = Celerity::Browser
|
21
|
+
else
|
22
|
+
raise "This platform is not supported (#{PLATFORM})"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
# "before all"
|
28
|
+
browser = Browser.new
|
29
|
+
|
30
|
+
Before do
|
31
|
+
@browser = browser
|
32
|
+
@environment = "http://github.com/"
|
33
|
+
sleep 3
|
34
|
+
end
|
35
|
+
|
36
|
+
# "after all"
|
37
|
+
at_exit do
|
38
|
+
# @browser.close
|
39
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module NavigationHelpers
|
2
|
+
def path_to(page_name)
|
3
|
+
case page_name
|
4
|
+
|
5
|
+
when /the guides page/i
|
6
|
+
@environment + "guides/home"
|
7
|
+
|
8
|
+
when /the watircuke page/i
|
9
|
+
@environment + "richdownie/watircuke/tree/master"
|
10
|
+
|
11
|
+
# Add more page name => path mappings here
|
12
|
+
|
13
|
+
else
|
14
|
+
raise "Can't find mapping from \"#{page_name}\" to a path.\n" +
|
15
|
+
"Now, go and add a mapping in features/support/paths.rb"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
World do
|
21
|
+
extend NavigationHelpers
|
22
|
+
end
|
data/lib/watircuke.rb
ADDED
@@ -0,0 +1,117 @@
|
|
1
|
+
require "cucumber"
|
2
|
+
require 'spec'
|
3
|
+
#require File.join(File.dirname(__FILE__), '..', 'features', 'support', 'env')
|
4
|
+
# Dir[File.join(File.dirname(__FILE__), '..', 'features', 'step_definitions', '*rb')].each { |file| require file }
|
5
|
+
|
6
|
+
if ENV['FIREWATIR']
|
7
|
+
require 'firewatir'
|
8
|
+
Browser = FireWatir::Firefox
|
9
|
+
else
|
10
|
+
case RUBY_PLATFORM
|
11
|
+
when /darwin|i686-linux/
|
12
|
+
require 'firewatir'
|
13
|
+
Browser = FireWatir::Firefox
|
14
|
+
# require 'safariwatir'
|
15
|
+
# Browser = Watir::Safari
|
16
|
+
when /win32|mingw/
|
17
|
+
require 'watir'
|
18
|
+
Browser = Watir::IE
|
19
|
+
when /java/
|
20
|
+
require 'celerity'
|
21
|
+
Browser = Celerity::Browser
|
22
|
+
else
|
23
|
+
raise "This platform is not supported (#{PLATFORM})"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
# "before all"
|
28
|
+
#browser =
|
29
|
+
|
30
|
+
Before do
|
31
|
+
@browser = Browser.new
|
32
|
+
end
|
33
|
+
|
34
|
+
When /^I press "([^\"]*)"$/ do |b|
|
35
|
+
@browser.button(:value, b).click
|
36
|
+
end
|
37
|
+
|
38
|
+
When /^I follow "([^\"]*)"$/ do |l|
|
39
|
+
@browser.link(:text, l).click
|
40
|
+
end
|
41
|
+
|
42
|
+
When /^I (visit|go to) the (.+)$/ do |_, text|
|
43
|
+
@browser.goto(@environment + text)
|
44
|
+
end
|
45
|
+
|
46
|
+
Given /^I am on (.+)$/ do |page_name|
|
47
|
+
@browser.goto(path_to(page_name))
|
48
|
+
end
|
49
|
+
|
50
|
+
#
|
51
|
+
# Should see
|
52
|
+
#
|
53
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
54
|
+
@browser.contains_text(text).should be_true
|
55
|
+
end
|
56
|
+
|
57
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
58
|
+
@browser.contains_text(text).should be_false
|
59
|
+
end
|
60
|
+
|
61
|
+
Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
|
62
|
+
res = response.body
|
63
|
+
(count.to_i - 1).times { res.sub!(/#{text}/, "")}
|
64
|
+
res.should contain(text)
|
65
|
+
res.sub(/#{text}/, "").should_not contain(text)
|
66
|
+
end
|
67
|
+
|
68
|
+
Given /I verify the page contains a div class "(.*)"/ do |byclass|
|
69
|
+
@browser.div(:class, byclass).exists?.should be_true
|
70
|
+
end
|
71
|
+
|
72
|
+
Given /I verify the page contains a div id "(.*)"/ do |id|
|
73
|
+
@browser.div(:id, id).exists?.should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
Given /I verify the page contains a link class "(.*)"/ do |byclass|
|
77
|
+
@browser.link(:class, byclass).exists?.should be_true
|
78
|
+
end
|
79
|
+
|
80
|
+
Given /I verify the page contains the image "(.*)"/ do |image|
|
81
|
+
@browser.image(:src, image).exists?.should be_true
|
82
|
+
end
|
83
|
+
|
84
|
+
#
|
85
|
+
# Forms
|
86
|
+
#
|
87
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
88
|
+
@browser.text_field(:name, field).set(value)
|
89
|
+
end
|
90
|
+
|
91
|
+
# When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
92
|
+
# select(value, :from => field)
|
93
|
+
# end
|
94
|
+
|
95
|
+
# Given /I click the "(.*)" checkbox/ do |id|
|
96
|
+
# @browser.checkbox(:id, id).click
|
97
|
+
# end
|
98
|
+
|
99
|
+
Given /I click the "(.*)" radio button/ do |id|
|
100
|
+
@browser.radio(:id, id).click
|
101
|
+
end
|
102
|
+
|
103
|
+
Given /I select "(.*)" from the select list "(.*)"/ do |value, id|
|
104
|
+
@browser.select_list(:id, id).select(value)
|
105
|
+
end
|
106
|
+
|
107
|
+
Given /From the "(.*)" link I fire the "(.*)" event/ do |text, event|
|
108
|
+
@browser.link(:text , text).fire_event(event)
|
109
|
+
end
|
110
|
+
|
111
|
+
Given /I wait "(.*)" seconds/ do |time|
|
112
|
+
sleep time.to_i
|
113
|
+
end
|
114
|
+
|
115
|
+
Given /I click the "(.*)" span/ do |text|
|
116
|
+
@browser.span(:text, text).click
|
117
|
+
end
|
data/lib/webratcuke.rb
ADDED
@@ -0,0 +1,181 @@
|
|
1
|
+
# require File.expand_path(File.join(File.dirname(__FILE__), "..", "support", "paths"))
|
2
|
+
|
3
|
+
# Commonly used webrat steps
|
4
|
+
# http://github.com/brynary/webrat
|
5
|
+
|
6
|
+
Given /^I am on (.+)$/ do |page_name|
|
7
|
+
visit path_to(page_name)
|
8
|
+
end
|
9
|
+
|
10
|
+
When /^I go to (.+)$/ do |page_name|
|
11
|
+
visit path_to(page_name)
|
12
|
+
end
|
13
|
+
|
14
|
+
When /^I press "([^\"]*)"$/ do |button|
|
15
|
+
click_button(button)
|
16
|
+
end
|
17
|
+
|
18
|
+
When /^I follow "([^\"]*)"$/ do |link|
|
19
|
+
click_link(link)
|
20
|
+
end
|
21
|
+
|
22
|
+
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
23
|
+
fill_in(field, :with => value)
|
24
|
+
end
|
25
|
+
|
26
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, field|
|
27
|
+
select(value, :from => field)
|
28
|
+
end
|
29
|
+
|
30
|
+
# Use this step in conjunction with Rail's datetime_select helper. For example:
|
31
|
+
# When I select "December 25, 2008 10:00" as the date and time
|
32
|
+
When /^I select "([^\"]*)" as the date and time$/ do |time|
|
33
|
+
select_datetime(time)
|
34
|
+
end
|
35
|
+
|
36
|
+
When /^I (press|follow|check|uncheck|choose) "([^\"]*)" for (.*) whose (.*) is "([^\"]*)"$/ do |action, whatyouclick, class_name, var_name, value|
|
37
|
+
id = var_name == "id" ? value : eval("\"#{class_name}\".classify.constantize.find_by_#{var_name}(\"#{value}\").id.to_s")
|
38
|
+
within("tr[id=row_#{class_name}_#{id}]") do
|
39
|
+
case action
|
40
|
+
when "press" then click_button(whatyouclick)
|
41
|
+
when "follow" then click_link(whatyouclick)
|
42
|
+
when "check" then check(whatyouclick)
|
43
|
+
when "uncheck" then uncheck(whatyouclick)
|
44
|
+
when "choose" then uncheck(whatyouclick)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
# Use this step when using multiple datetime_select helpers on a page or
|
51
|
+
# you want to specify which datetime to select. Given the following view:
|
52
|
+
# <%= f.label :preferred %><br />
|
53
|
+
# <%= f.datetime_select :preferred %>
|
54
|
+
# <%= f.label :alternative %><br />
|
55
|
+
# <%= f.datetime_select :alternative %>
|
56
|
+
# The following steps would fill out the form:
|
57
|
+
# When I select "November 23, 2004 11:20" as the "Preferred" date and time
|
58
|
+
# And I select "November 25, 2004 10:30" as the "Alternative" date and time
|
59
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date and time$/ do |datetime, datetime_label|
|
60
|
+
select_datetime(datetime, :from => datetime_label)
|
61
|
+
end
|
62
|
+
|
63
|
+
# Use this step in conjunction with Rail's time_select helper. For example:
|
64
|
+
# When I select "2:20PM" as the time
|
65
|
+
# Note: Rail's default time helper provides 24-hour time-- not 12 hour time. Webrat
|
66
|
+
# will convert the 2:20PM to 14:20 and then select it.
|
67
|
+
When /^I select "([^\"]*)" as the time$/ do |time|
|
68
|
+
select_time(time)
|
69
|
+
end
|
70
|
+
|
71
|
+
# Use this step when using multiple time_select helpers on a page or you want to
|
72
|
+
# specify the name of the time on the form. For example:
|
73
|
+
# When I select "7:30AM" as the "Gym" time
|
74
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" time$/ do |time, time_label|
|
75
|
+
select_time(time, :from => time_label)
|
76
|
+
end
|
77
|
+
|
78
|
+
# Use this step in conjunction with Rail's date_select helper. For example:
|
79
|
+
# When I select "February 20, 1981" as the date
|
80
|
+
When /^I select "([^\"]*)" as the date$/ do |date|
|
81
|
+
select_date(date)
|
82
|
+
end
|
83
|
+
|
84
|
+
# Use this step when using multiple date_select helpers on one page or
|
85
|
+
# you want to specify the name of the date on the form. For example:
|
86
|
+
# When I select "April 26, 1982" as the "Date of Birth" date
|
87
|
+
When /^I select "([^\"]*)" as the "([^\"]*)" date$/ do |date, date_label|
|
88
|
+
select_date(date, :from => date_label)
|
89
|
+
end
|
90
|
+
|
91
|
+
When /^I check "([^\"]*)"$/ do |field|
|
92
|
+
check(field)
|
93
|
+
end
|
94
|
+
|
95
|
+
When /^I uncheck "([^\"]*)"$/ do |field|
|
96
|
+
uncheck(field)
|
97
|
+
end
|
98
|
+
|
99
|
+
When /^I choose "([^\"]*)"$/ do |field|
|
100
|
+
choose(field)
|
101
|
+
end
|
102
|
+
|
103
|
+
When /^I attach the file at "([^\"]*)" to "([^\"]*)"$/ do |path, field|
|
104
|
+
attach_file(field, path)
|
105
|
+
end
|
106
|
+
|
107
|
+
Then /^I should see "([^\"]*)"$/ do |text|
|
108
|
+
response.should contain(text)
|
109
|
+
end
|
110
|
+
|
111
|
+
Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
|
112
|
+
res = response.body
|
113
|
+
(count.to_i - 1).times { res.sub!(/#{text}/, "")}
|
114
|
+
res.should contain(text)
|
115
|
+
res.sub(/#{text}/, "").should_not contain(text)
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
Then /^I should not see "([^\"]*)"$/ do |text|
|
120
|
+
response.should_not contain(text)
|
121
|
+
end
|
122
|
+
|
123
|
+
Then /^the "([^\"]*)" field should contain "([^\"]*)"$/ do |field, value|
|
124
|
+
field_labeled(field).value.should =~ /#{value}/
|
125
|
+
end
|
126
|
+
|
127
|
+
Then /^the "([^\"]*)" field should not contain "([^\"]*)"$/ do |field, value|
|
128
|
+
field_labeled(field).value.should_not =~ /#{value}/
|
129
|
+
end
|
130
|
+
|
131
|
+
Then /^the "([^\"]*)" checkbox should be checked$/ do |label|
|
132
|
+
field_labeled(label).should be_checked
|
133
|
+
end
|
134
|
+
|
135
|
+
Then /^I should be on (.+)$/ do |page_name|
|
136
|
+
URI.parse(current_url).path.should == path_to(page_name)
|
137
|
+
end
|
138
|
+
|
139
|
+
# Steps that are generally useful and help encourage use of semantic
|
140
|
+
# IDs and Class Names in your markup. In the steps below, a match following
|
141
|
+
# "the" will verify the presences of an element with a given ID while a match following
|
142
|
+
# "a" or "an" will verify the presence an element of a given class.
|
143
|
+
Then /^I debug$/ do
|
144
|
+
debugger
|
145
|
+
end
|
146
|
+
|
147
|
+
Then /^save_and_open_page$/ do
|
148
|
+
save_and_open_page
|
149
|
+
end
|
150
|
+
|
151
|
+
Then /^I wait for ([0-9]+) seconds$/ do |delay|
|
152
|
+
sleep delay.to_i
|
153
|
+
end
|
154
|
+
|
155
|
+
Then /^I should see a (\S+) in the (\S+)$/ do |element, containing_element|
|
156
|
+
response.should have_tag("##{containing_element} .#{element}")
|
157
|
+
end
|
158
|
+
|
159
|
+
Then /^I should see the (\S+) in the (\S+)$/ do |element, containing_element|
|
160
|
+
response.should have_tag("##{containing_element} ##{element}")
|
161
|
+
end
|
162
|
+
|
163
|
+
Then /^I should see (\d+) (\S+) in the (\S+)$/ do |count, element, containing_element|
|
164
|
+
response.should have_tag("##{containing_element} .#{element.singularize}",:count => count.to_i)
|
165
|
+
end
|
166
|
+
|
167
|
+
Then /^I should see (\d+) to (\d+) (\S+) in the (\S+)$/ do |min, max, element, containing_element|
|
168
|
+
response.should have_tag("##{containing_element} .#{element.singularize}",min.to_i..max.to_i)
|
169
|
+
end
|
170
|
+
|
171
|
+
Then /^the (\S+) in the (\S+) should contain (a|an|the) (\S+)$/ do |middle_element, outer_element, a, inner_element|
|
172
|
+
response.should have_tag("##{outer_element} .#{middle_element} .#{inner_element}")
|
173
|
+
end
|
174
|
+
|
175
|
+
Then /^I should see the (\S+)$/ do |element_id|
|
176
|
+
response.should have_tag("##{element_id}")
|
177
|
+
end
|
178
|
+
|
179
|
+
Then /^I should see (a|an) (\S+)$/ do |a, element_class|
|
180
|
+
response.should have_tag(".#{element_class}")
|
181
|
+
end
|
data/spec/spec_helper.rb
ADDED
data/watircuke.gemspec
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{watircuke}
|
5
|
+
s.version = "0.2.2"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Rich Downie", "Marcos Piccinini"]
|
9
|
+
s.date = %q{2009-06-16}
|
10
|
+
s.email = %q{x@nofxx.com}
|
11
|
+
s.extra_rdoc_files = [
|
12
|
+
"README"
|
13
|
+
]
|
14
|
+
s.files = [
|
15
|
+
".gitignore",
|
16
|
+
"README",
|
17
|
+
"Rakefile",
|
18
|
+
"VERSION",
|
19
|
+
"features/sample.feature",
|
20
|
+
"features/step_definitions/assertions.rb",
|
21
|
+
"features/step_definitions/buttons.rb",
|
22
|
+
"features/step_definitions/checkboxes.rb",
|
23
|
+
"features/step_definitions/javascript.rb",
|
24
|
+
"features/step_definitions/links.rb",
|
25
|
+
"features/step_definitions/pages.rb",
|
26
|
+
"features/step_definitions/radio_buttons.rb",
|
27
|
+
"features/step_definitions/select_lists.rb",
|
28
|
+
"features/step_definitions/sleep.rb",
|
29
|
+
"features/step_definitions/spans.rb",
|
30
|
+
"features/step_definitions/text_fields.rb",
|
31
|
+
"features/step_definitions/urls.rb",
|
32
|
+
"features/support/env.rb",
|
33
|
+
"features/support/paths.rb",
|
34
|
+
"lib/watircuke.rb",
|
35
|
+
"lib/webratcuke.rb",
|
36
|
+
"spec/spec_helper.rb",
|
37
|
+
"spec/watircuke_spec.rb",
|
38
|
+
"watircuke.gemspec"
|
39
|
+
]
|
40
|
+
s.homepage = %q{http://github.com/nofxx/watircuke}
|
41
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
42
|
+
s.require_paths = ["lib"]
|
43
|
+
s.rubygems_version = %q{1.3.4}
|
44
|
+
s.summary = %q{Watir steps for cucumber}
|
45
|
+
s.test_files = [
|
46
|
+
"spec/watircuke_spec.rb",
|
47
|
+
"spec/spec_helper.rb"
|
48
|
+
]
|
49
|
+
|
50
|
+
if s.respond_to? :specification_version then
|
51
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
52
|
+
s.specification_version = 3
|
53
|
+
|
54
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
55
|
+
else
|
56
|
+
end
|
57
|
+
else
|
58
|
+
end
|
59
|
+
end
|
metadata
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nofxx-watircuke
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.2.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rich Downie
|
8
|
+
- Marcos Piccinini
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
|
13
|
+
date: 2009-06-16 00:00:00 -07:00
|
14
|
+
default_executable:
|
15
|
+
dependencies: []
|
16
|
+
|
17
|
+
description:
|
18
|
+
email: x@nofxx.com
|
19
|
+
executables: []
|
20
|
+
|
21
|
+
extensions: []
|
22
|
+
|
23
|
+
extra_rdoc_files:
|
24
|
+
- README
|
25
|
+
files:
|
26
|
+
- .gitignore
|
27
|
+
- README
|
28
|
+
- Rakefile
|
29
|
+
- VERSION
|
30
|
+
- features/sample.feature
|
31
|
+
- features/step_definitions/assertions.rb
|
32
|
+
- features/step_definitions/buttons.rb
|
33
|
+
- features/step_definitions/checkboxes.rb
|
34
|
+
- features/step_definitions/javascript.rb
|
35
|
+
- features/step_definitions/links.rb
|
36
|
+
- features/step_definitions/pages.rb
|
37
|
+
- features/step_definitions/radio_buttons.rb
|
38
|
+
- features/step_definitions/select_lists.rb
|
39
|
+
- features/step_definitions/sleep.rb
|
40
|
+
- features/step_definitions/spans.rb
|
41
|
+
- features/step_definitions/text_fields.rb
|
42
|
+
- features/step_definitions/urls.rb
|
43
|
+
- features/support/env.rb
|
44
|
+
- features/support/paths.rb
|
45
|
+
- lib/watircuke.rb
|
46
|
+
- lib/webratcuke.rb
|
47
|
+
- spec/spec_helper.rb
|
48
|
+
- spec/watircuke_spec.rb
|
49
|
+
- watircuke.gemspec
|
50
|
+
has_rdoc: false
|
51
|
+
homepage: http://github.com/nofxx/watircuke
|
52
|
+
post_install_message:
|
53
|
+
rdoc_options:
|
54
|
+
- --charset=UTF-8
|
55
|
+
require_paths:
|
56
|
+
- lib
|
57
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: "0"
|
62
|
+
version:
|
63
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - ">="
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: "0"
|
68
|
+
version:
|
69
|
+
requirements: []
|
70
|
+
|
71
|
+
rubyforge_project:
|
72
|
+
rubygems_version: 1.2.0
|
73
|
+
signing_key:
|
74
|
+
specification_version: 3
|
75
|
+
summary: Watir steps for cucumber
|
76
|
+
test_files:
|
77
|
+
- spec/watircuke_spec.rb
|
78
|
+
- spec/spec_helper.rb
|