watir_robot 0.1.0 → 0.1.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/CHANGELOG CHANGED
@@ -1 +1,7 @@
1
+ v0.1.3. Include the new Area module which was coded in a previous version, but omitted from the KeywordLib class.
2
+
3
+ v0.1.2. Fix improper use of custom exceptions and exception strings for negative tests.
4
+
5
+ v0.1.1. Add support for using Regular Expressions in keyword arguments. Convert string versions of regexes passed back from Robot Framework into actual Ruby regexes which Watir-WebDriver will accept.
6
+
1
7
  v0.1.0. Initial gem package for Watir Robot. Includes healthy base of Robot Framework keywords for driving the browser, taking a screenshot and using the mouse natively.
data/Manifest CHANGED
@@ -6,6 +6,7 @@ README.rdoc
6
6
  Rakefile
7
7
  lib/watir_robot.rb
8
8
  lib/watir_robot/exception.rb
9
+ lib/watir_robot/keywords/area.rb
9
10
  lib/watir_robot/keywords/browser.rb
10
11
  lib/watir_robot/keywords/button.rb
11
12
  lib/watir_robot/keywords/checkbox.rb
@@ -22,7 +23,3 @@ lib/watir_robot/keywords/select.rb
22
23
  lib/watir_robot/keywords/table.rb
23
24
  lib/watir_robot/keywords/text_field.rb
24
25
  lib/watir_robot/parser.rb
25
- scripts/example_tests/resource.txt
26
- scripts/example_tests/test.txt
27
- scripts/run_server.rb
28
- watir_robot.gemspec
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ Echoe.new('watir_robot') do |p|
10
10
  p.description = "Watir Robot - Remote keyword library for Robot Framework"
11
11
  p.url = "http://github.com/semperos/watir-robot"
12
12
  p.author = "Daniel Gregoire"
13
- p.ignore_pattern = ["tmp/*", "script/*"]
13
+ p.ignore_pattern = ["tmp/*", "scripts/*", "yardoc/*"]
14
14
  p.runtime_dependencies = ['robot_remote_server >=2.5.5.2', 'watir-webdriver >=0.1.8']
15
15
  p.need_tar_gz = false
16
16
  end
data/lib/watir_robot.rb CHANGED
@@ -3,6 +3,7 @@ require 'watir-webdriver'
3
3
  require 'watir_robot/parser'
4
4
  require 'watir_robot/exception'
5
5
 
6
+ require 'watir_robot/keywords/area'
6
7
  require 'watir_robot/keywords/browser'
7
8
  require 'watir_robot/keywords/element'
8
9
  require 'watir_robot/keywords/button'
@@ -34,7 +35,8 @@ module WatirRobot
34
35
  class KeywordLibrary
35
36
  include WatirRobot::Exception
36
37
  include WatirRobot::Parser
37
-
38
+
39
+ include WatirRobot::Area
38
40
  include WatirRobot::Browser
39
41
  include WatirRobot::Button
40
42
  include WatirRobot::CheckBox
@@ -13,7 +13,16 @@ module WatirRobot
13
13
  # Exception when an HTML element cannot be found on the given page
14
14
  #
15
15
  class ElementDoesNotExist < ObjectDoesNotExist; end
16
-
16
+
17
+ #
18
+ # Exception when an object is found on a given page erroneously
19
+ #
20
+ class ObjectExists < RuntimeError; end
21
+ #
22
+ # Exception when an HTML element is found on a page erroneously
23
+ #
24
+ class ElementExists < ObjectExists; end
25
+
17
26
  #
18
27
  # Exception when an object does not match expected parameters
19
28
  #
@@ -0,0 +1,16 @@
1
+ module WatirRobot
2
+
3
+ module Area
4
+
5
+ ### Actions ###
6
+
7
+ #
8
+ # Click an area element (acts as a link)
9
+ #
10
+ # @param [String] loc attribute/value pairs that match an HTML element
11
+ #
12
+ def click_area(loc)
13
+ @browser.area(parse_location(loc)).click
14
+ end
15
+ end
16
+ end
@@ -44,7 +44,7 @@ module WatirRobot
44
44
  # @param [String] loc attribute/value pairs that match an HTML element
45
45
  #
46
46
  def checkbox_should_not_be_selected(loc)
47
- raise(Exception::CheckboxSelectionError, "The checkbox located at #{loc} is checked off.") if
47
+ raise(Exception::CheckboxSelectionError, "The checkbox located at #{loc} is checked off erroneously.") if
48
48
  @browser.checkbox(parse_location(loc)).set?
49
49
  end
50
50
 
@@ -54,7 +54,7 @@ module WatirRobot
54
54
  # @param [String] loc attribute/value pairs that match an HTML element
55
55
  #
56
56
  def element_should_be_visible(loc)
57
- raise(Exception::ElementVisibilityError, "The element described by #{parse_location(loc)} is not visible") unless
57
+ raise(Exception::ElementVisibilityError, "The element described by #{parse_location(loc)} is not visible.") unless
58
58
  @browser.element(parse_location(loc)).visible?
59
59
  end
60
60
 
@@ -64,7 +64,7 @@ module WatirRobot
64
64
  # @param [String] loc attribute/value pairs that match an HTML element
65
65
  #
66
66
  def element_should_not_be_visible(loc)
67
- raise(Exception::ElementVisibilityError, "The element described by #{parse_location(loc)} is not visible") if
67
+ raise(Exception::ElementVisibilityError, "The element described by #{parse_location(loc)} is visible erroneously.") if
68
68
  @browser.element(parse_location(loc)).visible?
69
69
  end
70
70
 
@@ -75,7 +75,7 @@ module WatirRobot
75
75
  # @param [String] text the text to compare against
76
76
  #
77
77
  def element_text_should_contain(loc, text)
78
- raise(Exception::ElementMatchError, "The element's text #{@browser.element(parse_location(loc)).text} does not contain the text #{text}") unless
78
+ raise(Exception::ElementMatchError, "The element's text #{@browser.element(parse_location(loc)).text} does not contain the text #{text}.") unless
79
79
  @browser.element(parse_location(loc)).text.include? text
80
80
  end
81
81
 
@@ -85,7 +85,7 @@ module WatirRobot
85
85
  # @param [String] text the text to compare against
86
86
  #
87
87
  def element_text_should_be(loc, text)
88
- raise(Exception::ElementMatchError, "The element's text #{@browser.element(parse_location(loc)).text} does not equal #{text}") unless
88
+ raise(Exception::ElementMatchError, "The element's text #{@browser.element(parse_location(loc)).text} does not equal #{text}.") unless
89
89
  @browser.element(parse_location(loc)).text == text
90
90
  end
91
91
 
@@ -3,7 +3,6 @@ module WatirRobot
3
3
  #
4
4
  # Functionality related to HTML forms as a whole
5
5
  #
6
- # @todo Add keywords here
7
6
  module Form
8
7
 
9
8
  #
@@ -13,7 +12,7 @@ module WatirRobot
13
12
  # @param [String] field_loc attribute/value pairs that match an HTML element
14
13
  #
15
14
  def form_should_contain_button(form_loc, field_loc)
16
- raise(Exception::ElementMatchError, "The button described by #{field_loc} was not located in the form described by #{form_loc}") unless
15
+ raise(Exception::ElementMatchError, "The button described by #{field_loc} was not located in the form described by #{form_loc}.") unless
17
16
  @browser.form(parse_location(form_loc)).button(parse_location(field_loc)).exists?
18
17
  end
19
18
 
@@ -24,7 +23,7 @@ module WatirRobot
24
23
  # @param [String] field_loc attribute/value pairs that match an HTML element
25
24
  #
26
25
  def form_should_not_contain_button(form_loc, field_loc)
27
- raise(Exception::ElementMatchError, "The button described by #{field_loc} was not located in the form described by #{form_loc}") if
26
+ raise(Exception::ElementMatchError, "The button described by #{field_loc} was erroneously located in the form described by #{form_loc}.") if
28
27
  @browser.form(parse_location(form_loc)).button(parse_location(field_loc)).exists?
29
28
  end
30
29
 
@@ -35,7 +34,7 @@ module WatirRobot
35
34
  # @param [String] field_loc attribute/value pairs that match an HTML element
36
35
  #
37
36
  def form_should_contain_checkbox(form_loc, field_loc)
38
- raise(Exception::ElementMatchError, "The checkbox described by #{field_loc} was not located in the form described by #{form_loc}") unless
37
+ raise(Exception::ElementMatchError, "The checkbox described by #{field_loc} was not located in the form described by #{form_loc}.") unless
39
38
  @browser.form(parse_location(form_loc)).checkbox(parse_location(field_loc)).exists?
40
39
  end
41
40
 
@@ -46,7 +45,7 @@ module WatirRobot
46
45
  # @param [String] field_loc attribute/value pairs that match an HTML element
47
46
  #
48
47
  def form_should_not_contain_checkbox(form_loc, field_loc)
49
- raise(Exception::ElementMatchError, "The checkbox described by #{field_loc} was not located in the form described by #{form_loc}") if
48
+ raise(Exception::ElementMatchError, "The checkbox described by #{field_loc} was erroneously located in the form described by #{form_loc}.") if
50
49
  @browser.form(parse_location(form_loc)).checkbox(parse_location(field_loc)).exists?
51
50
  end
52
51
 
@@ -57,7 +56,7 @@ module WatirRobot
57
56
  # @param [String] field_loc attribute/value pairs that match an HTML element
58
57
  #
59
58
  def form_should_contain_filefield(form_loc, field_loc)
60
- raise(Exception::ElementMatchError, "The file-field described by #{field_loc} was not located in the form described by #{form_loc}") unless
59
+ raise(Exception::ElementMatchError, "The file-field described by #{field_loc} was not located in the form described by #{form_loc}.") unless
61
60
  @browser.form(parse_location(form_loc)).file_field(parse_location(field_loc)).exists?
62
61
  end
63
62
 
@@ -68,7 +67,7 @@ module WatirRobot
68
67
  # @param [String] field_loc attribute/value pairs that match an HTML element
69
68
  #
70
69
  def form_should_not_contain_filefield(form_loc, field_loc)
71
- raise(Exception::ElementMatchError, "The file-field described by #{field_loc} was not located in the form described by #{form_loc}") if
70
+ raise(Exception::ElementMatchError, "The file-field described by #{field_loc} was erroneously located in the form described by #{form_loc}.") if
72
71
  @browser.form(parse_location(form_loc)).file_field(parse_location(field_loc)).exists?
73
72
  end
74
73
 
@@ -79,7 +78,7 @@ module WatirRobot
79
78
  # @param [String] field_loc attribute/value pairs that match an HTML element
80
79
  #
81
80
  def form_should_contain_radio_button(form_loc, field_loc)
82
- raise(Exception::ElementMatchError, "The radio button described by #{field_loc} was not located in the form described by #{form_loc}") unless
81
+ raise(Exception::ElementMatchError, "The radio button described by #{field_loc} was not located in the form described by #{form_loc}.") unless
83
82
  @browser.form(parse_location(form_loc)).radio(parse_location(field_loc)).exists?
84
83
  end
85
84
 
@@ -90,7 +89,7 @@ module WatirRobot
90
89
  # @param [String] field_loc attribute/value pairs that match an HTML element
91
90
  #
92
91
  def form_should_not_contain_radio_button(form_loc, field_loc)
93
- raise(Exception::ElementMatchError, "The radio button described by #{field_loc} was not located in the form described by #{form_loc}") if
92
+ raise(Exception::ElementMatchError, "The radio button described by #{field_loc} was erroneously located in the form described by #{form_loc}.") if
94
93
  @browser.form(parse_location(form_loc)).radio(parse_location(field_loc)).exists?
95
94
  end
96
95
 
@@ -101,7 +100,7 @@ module WatirRobot
101
100
  # @param [String] field_loc attribute/value pairs that match an HTML element
102
101
  #
103
102
  def form_should_contain_select_list(form_loc, field_loc)
104
- raise(Exception::ElementMatchError, "The select list described by #{field_loc} was not located in the form described by #{form_loc}") unless
103
+ raise(Exception::ElementMatchError, "The select list described by #{field_loc} was not located in the form described by #{form_loc}.") unless
105
104
  @browser.form(parse_location(form_loc)).select(parse_location(field_loc)).exists?
106
105
  end
107
106
 
@@ -112,7 +111,7 @@ module WatirRobot
112
111
  # @param [String] field_loc attribute/value pairs that match an HTML element
113
112
  #
114
113
  def form_should_not_contain_select_list(form_loc, field_loc)
115
- raise(Exception::ElementMatchError, "The select list described by #{field_loc} was not located in the form described by #{form_loc}") if
114
+ raise(Exception::ElementMatchError, "The select list described by #{field_loc} was erroneously located in the form described by #{form_loc}.") if
116
115
  @browser.form(parse_location(form_loc)).select(parse_location(field_loc)).exists?
117
116
  end
118
117
 
@@ -123,7 +122,7 @@ module WatirRobot
123
122
  # @param [String] field_loc attribute/value pairs that match an HTML element
124
123
  #
125
124
  def form_should_contain_textfield(form_loc, field_loc)
126
- raise(Exception::ElementMatchError, "The textfield described by #{field_loc} was not located in the form described by #{form_loc}") unless
125
+ raise(Exception::ElementMatchError, "The textfield described by #{field_loc} was not located in the form described by #{form_loc}.") unless
127
126
  @browser.form(parse_location(form_loc)).text_field(parse_location(field_loc)).exists?
128
127
  end
129
128
 
@@ -134,7 +133,7 @@ module WatirRobot
134
133
  # @param [String] field_loc attribute/value pairs that match an HTML element
135
134
  #
136
135
  def form_should_not_contain_textfield(form_loc, field_loc)
137
- raise(Exception::ElementMatchError, "The textfield described by #{field_loc} was not located in the form described by #{form_loc}") if
136
+ raise(Exception::ElementMatchError, "The textfield described by #{field_loc} was erroneously located in the form described by #{form_loc}.") if
138
137
  @browser.form(parse_location(form_loc)).text_field(parse_location(field_loc)).exists?
139
138
  end
140
139
 
@@ -90,10 +90,30 @@ module WatirRobot
90
90
  # @param [String] text the text to compare against
91
91
  #
92
92
  def page_should_not_contain(text)
93
- raise(Exception::PageMatchError, "The expected text #{text} was not contained in the page: #{@browser.text}") if
93
+ raise(Exception::PageMatchError, "The expected text #{text} was contained in the page erroneously: #{@browser.text}") if
94
94
  @browser.text.include? text
95
95
  end
96
-
96
+
97
+ #
98
+ # Verify area tag exists on page
99
+ #
100
+ # @param [String] loc attribute/value pairs that match an HTML element
101
+ #
102
+ def page_should_contain_area(loc)
103
+ raise(Exception::ElementDoesNotExist, "The area described by #{loc} is not contained within the page:\n#{@browser.html}") unless
104
+ @browser.area(parse_location(loc)).exists?
105
+ end
106
+
107
+ #
108
+ # Verify area tag exists on page
109
+ #
110
+ # @param [String] loc attribute/value pairs that match an HTML element
111
+ #
112
+ def page_should_not_contain_area(loc)
113
+ raise(Exception::ElementExists, "The area described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
114
+ @browser.area(parse_location(loc)).exists?
115
+ end
116
+
97
117
  #
98
118
  # Verify button exists on page
99
119
  #
@@ -110,7 +130,7 @@ module WatirRobot
110
130
  # @param [String] loc attribute/value pairs that match an HTML element
111
131
  #
112
132
  def page_should_not_contain_button(loc)
113
- raise(Exception::ElementDoesNotExist, "The button described by #{loc} is not contained within the page:\n#{@browser.html}") if
133
+ raise(Exception::ElementExists, "The button described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
114
134
  @browser.button(parse_location(loc)).exists?
115
135
  end
116
136
 
@@ -130,7 +150,7 @@ module WatirRobot
130
150
  # @param [String] loc attribute/value pairs that match an HTML element
131
151
  #
132
152
  def page_should_not_contain_checkbox(loc)
133
- raise(Exception::ElementDoesNotExist, "The checkbox described by #{loc} is not contained within the page:\n#{@browser.html}") if
153
+ raise(Exception::ElementExists, "The checkbox described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
134
154
  @browser.checkbox(parse_location(loc)).exists?
135
155
  end
136
156
 
@@ -150,7 +170,7 @@ module WatirRobot
150
170
  # @param [String] loc attribute/value pairs that match an HTML element
151
171
  #
152
172
  def page_should_not_contain_element(loc)
153
- raise(Exception::ElementDoesNotExist, "The element described by #{loc} is not contained within the page:\n#{@browser.html}") if
173
+ raise(Exception::ElementExists, "The element described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
154
174
  @browser.element(parse_location(loc)).exists?
155
175
  end
156
176
 
@@ -170,7 +190,7 @@ module WatirRobot
170
190
  # @param [String] loc attribute/value pairs that match an HTML element
171
191
  #
172
192
  def page_should_not_contain_image(loc)
173
- raise(Exception::ElementDoesNotExist, "The image described by #{loc} is not contained within the page:\n#{@browser.html}") if
193
+ raise(Exception::ElementExists, "The image described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
174
194
  @browser.image(parse_location(loc)).exists?
175
195
  end
176
196
 
@@ -190,7 +210,7 @@ module WatirRobot
190
210
  # @param [String] loc attribute/value pairs that match an HTML element
191
211
  #
192
212
  def page_should_not_contain_link(loc)
193
- raise(Exception::ElementDoesNotExist, "The link described by #{loc} is not contained within the page:\n#{@browser.html}") if
213
+ raise(Exception::ElementExists, "The link described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
194
214
  @browser.link(parse_location(loc)).exists?
195
215
  end
196
216
 
@@ -227,13 +247,13 @@ module WatirRobot
227
247
  ordered = ordered.downcase unless ordered == nil
228
248
  if ordered.nil?
229
249
  # Not specified; match either
230
- raise(Exception::ElementDoesNotExist, "The list described by #{loc} is not contained within the page:\n#{@browser.html}") if
250
+ raise(Exception::ElementExists, "The list described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
231
251
  (@browser.ol(parse_location(loc)).exists? || @browser.ul(parse_location(loc)).exists?)
232
252
  elsif ordered == 'true'
233
- raise(Exception::ElementDoesNotExist, "The ordered list described by #{loc} is not contained within the page:\n#{@browser.html}") if
253
+ raise(Exception::ElementExists, "The ordered list described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
234
254
  @browser.ol(parse_location(loc)).exists?
235
255
  elsif ordered == 'false'
236
- raise(Exception::ElementDoesNotExist, "The unordered list described by #{loc} is not contained within the page:\n#{@browser.html}") if
256
+ raise(Exception::ElementExists, "The unordered list described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
237
257
  @browser.ul(parse_location(loc)).exists?
238
258
  else
239
259
  raise(ArgumentError, "If you specify ordered vs. unordered lists, the only valid values are 'true' or 'false' (case-insensitive)")
@@ -256,7 +276,7 @@ module WatirRobot
256
276
  # @param [String] loc attribute/value pairs that match an HTML element
257
277
  #
258
278
  def page_should_not_contain_radio_button(loc)
259
- raise(Exception::ElementDoesNotExist, "The radio button described by #{loc} is not contained within the page:\n#{@browser.html}") if
279
+ raise(Exception::ElementExists, "The radio button described by #{loc} is erroneously contained within the page:\n#{@browser.html}") if
260
280
  @browser.radio(parse_location(loc)).exists?
261
281
  end
262
282
 
@@ -276,7 +296,7 @@ module WatirRobot
276
296
  # @param [String] loc attribute/value pairs that match an HTML element
277
297
  #
278
298
  def page_should_not_contain_select_list(loc)
279
- raise(Exception::ElementDoesNotExist, "The select list described by #{loc} is not contained within the page:\n#{@browser.html}") if
299
+ raise(Exception::ElementExists, "The select list described by #{loc} is not contained within the page erroneously:\n#{@browser.html}") if
280
300
  @browser.select(parse_location(loc)).exists?
281
301
  end
282
302
 
@@ -296,7 +316,7 @@ module WatirRobot
296
316
  # @param [String] loc attribute/value pairs that match an HTML element
297
317
  #
298
318
  def page_should_not_contain_textfield(loc)
299
- raise(Exception::ElementDoesNotExist, "The text field described by #{loc} is not contained within the page:\n#{@browser.html}") if
319
+ raise(Exception::ElementExists, "The text field described by #{loc} is not contained within the page erroneously:\n#{@browser.html}") if
300
320
  @browser.text_field(parse_location(loc)).exists?
301
321
  end
302
322
 
@@ -35,7 +35,7 @@ module WatirRobot
35
35
  # @param [String] loc attribute/value pairs that match an HTML element
36
36
  #
37
37
  def radio_button_should_not_be_selected(loc)
38
- raise(Exception::RadioSelectionError, "The radio button located at #{loc} is selected.") if
38
+ raise(Exception::RadioSelectionError, "The radio button located at #{loc} is selected erroneously.") if
39
39
  @browser.radio(parse_location(loc)).set?
40
40
  end
41
41
 
@@ -62,7 +62,7 @@ module WatirRobot
62
62
  # @param [String] item_loc attribute/value pairs that match an item in a select list
63
63
  #
64
64
  def item_should_be_selected(list_loc, item_loc)
65
- raise(Exception::SelectListSelectionError, "The item described by #{item_loc} in the select list described by #{list_loc} is not selected") unless
65
+ raise(Exception::SelectListSelectionError, "The item described by #{item_loc} in the select list described by #{list_loc} is not selected.") unless
66
66
  @browser.select(parse_location(list_loc)).option(parse_location(item_loc)).selected?
67
67
  end
68
68
 
@@ -73,7 +73,7 @@ module WatirRobot
73
73
  # @param [String] item_loc attribute/value pairs that match an item in a select list
74
74
  #
75
75
  def item_should_not_be_selected(list_loc, item_loc)
76
- raise(Exception::SelectListSelectionError, "The item described by #{item_loc} in the select list described by #{list_loc} is selected") if
76
+ raise(Exception::SelectListSelectionError, "The item described by #{item_loc} in the select list described by #{list_loc} is selected erroneously.") if
77
77
  @browser.select(parse_location(list_loc)).option(parse_location(item_loc)).selected?
78
78
  end
79
79
 
@@ -3,7 +3,7 @@ module WatirRobot
3
3
  #
4
4
  # This module contains the functions necessary to convert arguments obtained
5
5
  # from Robot Framework tests and make them meaningful to the underlying
6
- # Watir-WebDriver code.
6
+ # Watir-WebDriver code. These are NOT Robot Framework keywords.
7
7
  #
8
8
  module Parser
9
9
 
@@ -104,7 +104,7 @@ module WatirRobot
104
104
  }
105
105
 
106
106
  #
107
- # Parses the "location" string provided as argument for locating HTML elements.
107
+ # (Non-Keyword) Parses the "location" string provided as argument for locating HTML elements.
108
108
  #
109
109
  # Watir-WebDriver expects a hash of parameters by which to search for HTML
110
110
  # elements. This function take arguments from Robot Framework tests in the
@@ -127,7 +127,12 @@ module WatirRobot
127
127
  attrs = {}
128
128
  attr_list.each do |a|
129
129
  attr_kv = a.split('=')
130
- attrs[self.trim_sides(attr_kv[0])] = self.trim_sides(attr_kv[1])
130
+ # Need to turn strings in format "/regex-here/" into actual regexes
131
+ if attr_kv[1].start_with?('/')
132
+ attr_kv[1] = Regexp.new(Regexp.quote(attr_kv[1].gsub('/', '')))
133
+ end
134
+ attr_kv[1] = self.trim_sides(attr_kv[1]) unless attr_kv[1].is_a? Regexp
135
+ attrs[self.trim_sides(attr_kv[0])] = attr_kv[1]
131
136
  end
132
137
  # Watir expects symbols for keys
133
138
  attrs = Hash[attrs.map { |k, v| [k.to_sym, v] }]
@@ -139,7 +144,7 @@ module WatirRobot
139
144
  end
140
145
 
141
146
  #
142
- # Parses a key-code argument, provided as an actual character or in ASCII code
147
+ # (Non-keyword) Parses a key-code argument, provided as an actual character or in ASCII code
143
148
  #
144
149
  # @param [String] key the key for which to find the java.awt.KeyEvent key-code constant
145
150
  # @return [String] the constant for the key event
@@ -154,7 +159,7 @@ module WatirRobot
154
159
  end
155
160
 
156
161
  #
157
- # Small utility for trimming whitespace from both sides of a string
162
+ # (Non-keyword) Small utility for trimming whitespace from both sides of a string
158
163
  #
159
164
  # @param [String] s string to trim both sides of
160
165
  # @return [Strgin] the same string without whitespace on the left or right sides
data/watir_robot.gemspec CHANGED
@@ -2,15 +2,15 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{watir_robot}
5
- s.version = "0.1.0"
5
+ s.version = "0.1.3"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Daniel Gregoire"]
9
- s.date = %q{2010-12-27}
9
+ s.date = %q{2011-01-27}
10
10
  s.description = %q{Watir Robot - Remote keyword library for Robot Framework}
11
11
  s.email = %q{}
12
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "lib/watir_robot.rb", "lib/watir_robot/exception.rb", "lib/watir_robot/keywords/browser.rb", "lib/watir_robot/keywords/button.rb", "lib/watir_robot/keywords/checkbox.rb", "lib/watir_robot/keywords/element.rb", "lib/watir_robot/keywords/file_field.rb", "lib/watir_robot/keywords/form.rb", "lib/watir_robot/keywords/image.rb", "lib/watir_robot/keywords/link.rb", "lib/watir_robot/keywords/list.rb", "lib/watir_robot/keywords/native.rb", "lib/watir_robot/keywords/page.rb", "lib/watir_robot/keywords/radio.rb", "lib/watir_robot/keywords/select.rb", "lib/watir_robot/keywords/table.rb", "lib/watir_robot/keywords/text_field.rb", "lib/watir_robot/parser.rb"]
13
- s.files = ["CHANGELOG", "KEYWORDS.rdoc", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "lib/watir_robot.rb", "lib/watir_robot/exception.rb", "lib/watir_robot/keywords/browser.rb", "lib/watir_robot/keywords/button.rb", "lib/watir_robot/keywords/checkbox.rb", "lib/watir_robot/keywords/element.rb", "lib/watir_robot/keywords/file_field.rb", "lib/watir_robot/keywords/form.rb", "lib/watir_robot/keywords/image.rb", "lib/watir_robot/keywords/link.rb", "lib/watir_robot/keywords/list.rb", "lib/watir_robot/keywords/native.rb", "lib/watir_robot/keywords/page.rb", "lib/watir_robot/keywords/radio.rb", "lib/watir_robot/keywords/select.rb", "lib/watir_robot/keywords/table.rb", "lib/watir_robot/keywords/text_field.rb", "lib/watir_robot/parser.rb", "scripts/example_tests/resource.txt", "scripts/example_tests/test.txt", "scripts/run_server.rb", "watir_robot.gemspec"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.rdoc", "lib/watir_robot.rb", "lib/watir_robot/exception.rb", "lib/watir_robot/keywords/area.rb", "lib/watir_robot/keywords/browser.rb", "lib/watir_robot/keywords/button.rb", "lib/watir_robot/keywords/checkbox.rb", "lib/watir_robot/keywords/element.rb", "lib/watir_robot/keywords/file_field.rb", "lib/watir_robot/keywords/form.rb", "lib/watir_robot/keywords/image.rb", "lib/watir_robot/keywords/link.rb", "lib/watir_robot/keywords/list.rb", "lib/watir_robot/keywords/native.rb", "lib/watir_robot/keywords/page.rb", "lib/watir_robot/keywords/radio.rb", "lib/watir_robot/keywords/select.rb", "lib/watir_robot/keywords/table.rb", "lib/watir_robot/keywords/text_field.rb", "lib/watir_robot/parser.rb"]
13
+ s.files = ["CHANGELOG", "KEYWORDS.rdoc", "LICENSE", "Manifest", "README.rdoc", "Rakefile", "lib/watir_robot.rb", "lib/watir_robot/exception.rb", "lib/watir_robot/keywords/area.rb", "lib/watir_robot/keywords/browser.rb", "lib/watir_robot/keywords/button.rb", "lib/watir_robot/keywords/checkbox.rb", "lib/watir_robot/keywords/element.rb", "lib/watir_robot/keywords/file_field.rb", "lib/watir_robot/keywords/form.rb", "lib/watir_robot/keywords/image.rb", "lib/watir_robot/keywords/link.rb", "lib/watir_robot/keywords/list.rb", "lib/watir_robot/keywords/native.rb", "lib/watir_robot/keywords/page.rb", "lib/watir_robot/keywords/radio.rb", "lib/watir_robot/keywords/select.rb", "lib/watir_robot/keywords/table.rb", "lib/watir_robot/keywords/text_field.rb", "lib/watir_robot/parser.rb", "watir_robot.gemspec"]
14
14
  s.homepage = %q{http://github.com/semperos/watir-robot}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Watir_robot", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watir_robot
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 29
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 3
10
+ version: 0.1.3
11
11
  platform: ruby
12
12
  authors:
13
13
  - Daniel Gregoire
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-27 00:00:00 -05:00
18
+ date: 2011-01-27 00:00:00 -05:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -63,6 +63,7 @@ extra_rdoc_files:
63
63
  - README.rdoc
64
64
  - lib/watir_robot.rb
65
65
  - lib/watir_robot/exception.rb
66
+ - lib/watir_robot/keywords/area.rb
66
67
  - lib/watir_robot/keywords/browser.rb
67
68
  - lib/watir_robot/keywords/button.rb
68
69
  - lib/watir_robot/keywords/checkbox.rb
@@ -88,6 +89,7 @@ files:
88
89
  - Rakefile
89
90
  - lib/watir_robot.rb
90
91
  - lib/watir_robot/exception.rb
92
+ - lib/watir_robot/keywords/area.rb
91
93
  - lib/watir_robot/keywords/browser.rb
92
94
  - lib/watir_robot/keywords/button.rb
93
95
  - lib/watir_robot/keywords/checkbox.rb
@@ -104,9 +106,6 @@ files:
104
106
  - lib/watir_robot/keywords/table.rb
105
107
  - lib/watir_robot/keywords/text_field.rb
106
108
  - lib/watir_robot/parser.rb
107
- - scripts/example_tests/resource.txt
108
- - scripts/example_tests/test.txt
109
- - scripts/run_server.rb
110
109
  - watir_robot.gemspec
111
110
  has_rdoc: true
112
111
  homepage: http://github.com/semperos/watir-robot
@@ -1,14 +0,0 @@
1
- *** Settings ***
2
- Library Remote http://localhost:8270
3
-
4
- *** Variables ***
5
- ${BROWSER} firefox
6
- ${URL} http://bit.ly/watir-example
7
-
8
- *** Keywords ***
9
- Open and Maximize
10
- [Arguments] ${url} ${browser}=firefox
11
- [Documentation] Open a browser to a specific URL and then maximize it to full-screen.
12
- Start Browser ${URL} ${BROWSER}
13
- Maximize Browser Window
14
-
@@ -1,171 +0,0 @@
1
- *** Settings ***
2
- Suite Setup Open and Maximize ${URL} ${BROWSER}
3
- Suite Teardown Close Browser
4
- Library Remote http://localhost:8270
5
- Resource resource.txt
6
-
7
- *** Test Cases ***
8
- Test Browser
9
- [Setup] Go To ${URL}
10
- Url Should Contain google.com
11
- ${current_url}= Get Url
12
- Go To http://psd.tutsplus.com
13
- Url Should Be http://psd.tutsplus.com/
14
- Go Back
15
- Go Forward
16
- Refresh
17
- Click Image alt=Photoshop to HTML
18
- Switch To Next Window
19
- Title Should Be Photoshop to HTML | Rockable Press
20
- Switch To Previous Window
21
- Title Should Contain Psdtuts+
22
- Switch to Window url=http://rockablepress.com/books/photoshop-to-html/
23
- Url Should Contain rockablepress.com
24
- Switch to Window url=http://psd.tutsplus.com/
25
- Close Window 2
26
- ${windows}= Get Window Count
27
- ${current_url}= Get Url
28
- Click Link href=http://rockablepress.com/books/photoshop-to-html/
29
- ${windows}= Get Window Count
30
- Switch to Next Window
31
- Title Should Be Photoshop to HTML | Rockable Press
32
- ${windows}= Get Window Count
33
- Close Window url=http://rockablepress.com/books/photoshop-to-html/
34
- Title Should Contain Psdtuts+
35
-
36
- Test Button
37
- [Setup] Go To ${URL}
38
- Click Button value=Submit
39
-
40
- Test CheckBox
41
- [Setup] Go To ${URL}
42
- Select Checkbox value=Ruby
43
- Checkbox Should Be Selected value=Ruby
44
- Unselect Checkbox value=Ruby
45
- Checkbox Should Not Be Selected value=Ruby
46
-
47
- Test Element
48
- [Setup] Go To ${URL}
49
- Click Element name=submit
50
- Element Should Be Visible class=errorheader
51
- Element Should Not Be Visible name=backupCache
52
- Element Text Should Be class=errorheader Looks like you have a question or two that still needs to be filled out.
53
- Element Text Should Contain class=errorheader question or two
54
- Focus name=entry.0.single
55
- Sleep 2 seconds
56
- ${attr}= Get Element Attribute id=ss-form method
57
- ${text}= Get Element Text class=errorheader
58
-
59
- Test FileField
60
- Go To http://scribd.com/upload/supload
61
- Choose File name=upload_doc C:/foobar.txt
62
- ${file}= Get Filefield Path name=upload_doc
63
-
64
- Test Form
65
- [Setup] Go To ${URL}
66
- Form Should Contain Button id=ss-form value=Submit
67
- Form Should Not Contain Button id=ss-form value=foobar
68
- Form Should Contain Checkbox id=ss-form value=Ruby
69
- Form Should Not Contain Checkbox id=ss-form value=foobar
70
- Go To http://scribd.com/upload/supload
71
- Form Should Contain Filefield name=upload_doc id=file
72
- Form Should Not Contain Filefield name=upload_doc id=foobar
73
- Go Back
74
- Form Should Contain Radio Button id=ss-form value=Watir
75
- Form Should Not Contain Radio Button id=ss-form value=foobar
76
- Form Should Contain Select List id=ss-form id=entry_6
77
- Form Should Not Contain Select List id=ss-form id=foobar
78
- Form Should Contain Textfield id=ss-form id=entry_0
79
- Form Should Not Contain Textfield id=ss-form id=foobar
80
-
81
- Test Image
82
- [Setup] Go To ${URL}
83
- Go To http://psd.tutsplus.com/
84
- Click Image alt=Photoshop to HTML
85
- Switch To Window title=Photoshop to HTML | Rockable Press
86
- Url Should Be http://rockablepress.com/books/photoshop-to-html/
87
- ${count}= Get Window Count
88
- Switch To Other Window
89
- Close Other Window
90
-
91
- Test Link
92
- [Setup] Go To ${URL}
93
- Click Link text=Terms of Service
94
- Url Should Be http://www.google.com/accounts/TOS
95
- Go Back
96
-
97
- Test List
98
- [Setup] Go To ${URL}
99
- ${items}= Get List Items class=ss-choices
100
-
101
- Test Native
102
- [Setup] Go To ${URL}
103
- Capture Screenshot
104
-
105
- Test Page
106
- [Setup] Go To ${URL}
107
- Title Should Be Watir Example
108
- ${source}= Get Page Source
109
- Log Page Source
110
- ${text}= Get Page Text
111
- ${status}= Get Page Status
112
- ${title}= Get Title
113
- ${all_links}= Get All Elements By Xpath //a
114
- Log Executing JavaScript has been tested. It is simple wrapper around WebDriver's execute_script function, so if there's a problem, it's at the WebDriver level.
115
- Page Should Contain What testing tool do you like?
116
- Page Should Not Contain Supercalafragilisticexbialadocious
117
- Page Should Contain Button value=Submit
118
- Page Should Not Contain Button value=Foobar
119
- Page Should Contain Checkbox value=Ruby
120
- Page Should Not Contain Checkbox value=Clojure
121
- Page Should Contain Element id=ss-form
122
- Page Should Not Contain Element id=foobar
123
- Go To http://www.google.com/
124
- Page Should Contain Image src=/images/nav_logo29.png
125
- Page Should Not Contain Image src=foobar
126
- Go Back
127
- Page Should Contain Link href=http://docs.google.com
128
- Page Should Not Contain Link href=foobar
129
- Page Should Contain List class=ss-choices false
130
- Page Should Not Contain List class=foobar
131
- Page Should Contain Radio Button value=Watir
132
- Page Should Not Contain Radio Button value=foobar
133
- Page Should Contain Textfield name=entry.0.single
134
- Page Should Not Contain Textfield name=foobar
135
- Title Should Be Watir Example
136
- Title Should Contain Watir
137
-
138
- Test Radio
139
- [Setup] Go To ${URL}
140
- Select Radio Button value=Watir
141
- Radio Button Should Be Selected value=Watir
142
- Radio Button Should Not Be Selected value=Selenium
143
-
144
- Test Select
145
- [Setup] Go To ${URL}
146
- Go to http://drupal.org/project/issues/search/drupal
147
- Select Item From List id=edit-status text=active
148
- Item Should Be Selected id=edit-status text=active
149
- Item Should Not Be Selected id=edit-status text=needs work
150
- Select Item From List id=edit-status text=needs review
151
- Item Should Be Selected id=edit-status text=needs review
152
- Clear Items From List id=edit-status
153
- Item should not be selected id=edit-status text=active
154
- Item should not be selected id=edit-status text=needs review
155
-
156
- Test Table
157
- [Setup] Go To ${URL}
158
- Go To http://www.facebook.com
159
- ${cell_1}= Get Table Cell ${EMPTY} 1 1
160
- Table Cell Should Contain ${EMPTY} 1 1 Email
161
- Table Column Should Contain ${EMPTY} 1 logged in
162
- Table Row Should Contain ${EMPTY} 3 your password?
163
- Table Should Contain ${EMPTY} Password
164
-
165
- Test TextField
166
- [Setup] Go To ${URL}
167
- Focus TextField name=entry.0.single
168
- Input Text name=entry.0.single Foobar
169
- Textfield Should Contain name=entry.0.single Foo
170
- Textfield Should Be name=entry.0.single Foobar
171
-
@@ -1,13 +0,0 @@
1
- #!/usr/bin/env jruby
2
-
3
- if __FILE__ == $0
4
- require 'rubygems'
5
- require 'robot_remote_server'
6
- require 'watir_robot'
7
- RobotRemoteServer.new(WatirRobot::KeywordLibrary.new,
8
- host = 'localhost',
9
- port = 8270,
10
- yardoc_file = File.expand_path("#{File.dirname(__FILE__)}/../yardoc"),
11
- yardoc_options = [[:docstring, ''], [:file, 'File'], [:source, 'Source Code']])
12
- end
13
-