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.
Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/watircuke.rb +38 -23
  3. data/watircuke.gemspec +1 -1
  4. metadata +1 -1
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.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
- # "before all"
28
- #browser =
29
-
30
+ #
31
+ # Cucumber
32
+ #
30
33
  Before do
31
34
  @browser = Browser.new
32
35
  end
33
36
 
34
- When /^I press "([^\"]*)"$/ do |b|
35
- @browser.button(:value, b).click
36
- end
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).should be_true
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).should be_false
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 = response.body
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
- # 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
101
+ When /^I select "([^\"]*)" from "([^\"]*)"$/ do |value, id|
102
+ @browser.select_list(:id, id).select(value)
103
+ end
98
104
 
99
- Given /I click the "(.*)" radio button/ do |id|
105
+ When /^I choose "([^\"]*)"$/ do |id|
100
106
  @browser.radio(:id, id).click
101
107
  end
102
108
 
103
- Given /I select "(.*)" from the select list "(.*)"/ do |value, id|
104
- @browser.select_list(:id, id).select(value)
109
+ When /^I check "([^\"]*)"$/ do |id|
110
+ @browser.checkbox(:id, id).click
105
111
  end
106
112
 
107
- Given /From the "(.*)" link I fire the "(.*)" event/ do |text, event|
108
- @browser.link(:text , text).fire_event(event)
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
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{watircuke}
5
- s.version = "0.2.2"
5
+ s.version = "0.2.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Rich Downie", "Marcos Piccinini"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nofxx-watircuke
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rich Downie