nofxx-watircuke 0.2.2 → 0.2.3
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/VERSION +1 -1
- data/lib/watircuke.rb +38 -23
- data/watircuke.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/lib/watircuke.rb
CHANGED
@@ -3,6 +3,9 @@ require 'spec'
|
|
3
3
|
#require File.join(File.dirname(__FILE__), '..', 'features', 'support', 'env')
|
4
4
|
# Dir[File.join(File.dirname(__FILE__), '..', 'features', 'step_definitions', '*rb')].each { |file| require file }
|
5
5
|
|
6
|
+
#
|
7
|
+
# Environment
|
8
|
+
#
|
6
9
|
if ENV['FIREWATIR']
|
7
10
|
require 'firewatir'
|
8
11
|
Browser = FireWatir::Firefox
|
@@ -24,17 +27,16 @@ else
|
|
24
27
|
end
|
25
28
|
end
|
26
29
|
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
30
|
+
#
|
31
|
+
# Cucumber
|
32
|
+
#
|
30
33
|
Before do
|
31
34
|
@browser = Browser.new
|
32
35
|
end
|
33
36
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
37
|
+
#
|
38
|
+
# Browsing
|
39
|
+
#
|
38
40
|
When /^I follow "([^\"]*)"$/ do |l|
|
39
41
|
@browser.link(:text, l).click
|
40
42
|
end
|
@@ -47,19 +49,23 @@ Given /^I am on (.+)$/ do |page_name|
|
|
47
49
|
@browser.goto(path_to(page_name))
|
48
50
|
end
|
49
51
|
|
52
|
+
# Then /^I should be on (.+)$/ do |page_name|
|
53
|
+
# URI.parse(current_url).path.should == path_to(page_name)
|
54
|
+
# end
|
55
|
+
|
50
56
|
#
|
51
57
|
# Should see
|
52
58
|
#
|
53
59
|
Then /^I should see "([^\"]*)"$/ do |text|
|
54
|
-
@browser.contains_text(text)
|
60
|
+
@browser.should contains_text(text)
|
55
61
|
end
|
56
62
|
|
57
63
|
Then /^I should not see "([^\"]*)"$/ do |text|
|
58
|
-
@browser.contains_text(text)
|
64
|
+
@browser.should_not contains_text(text)
|
59
65
|
end
|
60
66
|
|
61
67
|
Then /^I should see "([^\"]*)" (\d+) times*$/ do |text, count|
|
62
|
-
res =
|
68
|
+
res = @browser.body
|
63
69
|
(count.to_i - 1).times { res.sub!(/#{text}/, "")}
|
64
70
|
res.should contain(text)
|
65
71
|
res.sub(/#{text}/, "").should_not contain(text)
|
@@ -84,34 +90,43 @@ end
|
|
84
90
|
#
|
85
91
|
# Forms
|
86
92
|
#
|
93
|
+
When /^I press "([^\"]*)"$/ do |b|
|
94
|
+
@browser.button(:value, b).click
|
95
|
+
end
|
96
|
+
|
87
97
|
When /^I fill in "([^\"]*)" with "([^\"]*)"$/ do |field, value|
|
88
98
|
@browser.text_field(:name, field).set(value)
|
89
99
|
end
|
90
100
|
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
# Given /I click the "(.*)" checkbox/ do |id|
|
96
|
-
# @browser.checkbox(:id, id).click
|
97
|
-
# end
|
101
|
+
When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, id|
|
102
|
+
@browser.select_list(:id, id).select(value)
|
103
|
+
end
|
98
104
|
|
99
|
-
|
105
|
+
When /^I choose "([^\"]*)"$/ do |id|
|
100
106
|
@browser.radio(:id, id).click
|
101
107
|
end
|
102
108
|
|
103
|
-
|
104
|
-
@browser.
|
109
|
+
When /^I check "([^\"]*)"$/ do |id|
|
110
|
+
@browser.checkbox(:id, id).click
|
105
111
|
end
|
106
112
|
|
107
|
-
|
108
|
-
|
109
|
-
end
|
113
|
+
# When /^I uncheck "([^\"]*)"$/ do |field|
|
114
|
+
# uncheck(field)
|
115
|
+
# end
|
116
|
+
# Given /I click the "(.*)" checkbox/ do |id|
|
117
|
+
# end
|
110
118
|
|
111
119
|
Given /I wait "(.*)" seconds/ do |time|
|
112
120
|
sleep time.to_i
|
113
121
|
end
|
114
122
|
|
123
|
+
#
|
124
|
+
# Javascript
|
125
|
+
#
|
126
|
+
Given /From the "(.*)" link I fire the "(.*)" event/ do |text, event|
|
127
|
+
@browser.link(:text , text).fire_event(event)
|
128
|
+
end
|
129
|
+
|
115
130
|
Given /I click the "(.*)" span/ do |text|
|
116
131
|
@browser.span(:text, text).click
|
117
132
|
end
|
data/watircuke.gemspec
CHANGED