fluent 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d399f7efa85d3a7fe499637593d9f5f64fe48ddf
4
- data.tar.gz: 507dca702929c8f16d19efdb2f4203506736a28b
3
+ metadata.gz: 831ffd392a614908ecb6463d83c08722cc6db46e
4
+ data.tar.gz: b77b255e808fa50a53e782a6c0e516d0694109ae
5
5
  SHA512:
6
- metadata.gz: 6f020da878a64fc26dd6851ccc49967387991ea6d232a3a7d4f52ea181785701873d03066fac9874c70a0e7866dcbef4c0e1f044fe4ea5f7661a3794dd77fad6
7
- data.tar.gz: 1d96a09f70cec3a86d486035377116c254ceb7bbf22afbb2c036583e542edfb0102785598c726622dd82f511653e72793b74c0da725c46dbde4eab7e555544f9
6
+ metadata.gz: c5220df18eb53a74fdafcdcfbb38e89b02e8085cbe321db5a5f6117d842603201ed7f9b75f89d6851c06054d4d8e168319e1d555cb312647d4314026b97d38d9
7
+ data.tar.gz: a628d1f6c4436395a4c04435800892a45b92619723a827d729bcd36cc2412974ac17eb3c53352d2c3ba0664fc01f902b6a7178645fb7dffd1d461944219f95dd
data/HISTORY.md CHANGED
@@ -1,6 +1,21 @@
1
1
  Change Log and History
2
2
  ======================
3
3
 
4
+ Version 0.6.0 / 2013-11-26
5
+ --------------------------
6
+
7
+ This release introduces a few new features:
8
+
9
+ * The ability go handle multiple elements is now in place. This allows you to get a collection of elements, such as "all links on a page" or "all text fields with a class of 'signup'" and so on.
10
+
11
+ * The ability to make direct locator calls for elements that are not declared on a page definition is now in place. This allows you to directly use the same kind of locator feature that watir-webdriver provides.
12
+
13
+ * A data setter module has been added, which will allow you to have data collections specified on a page or activity definition and then use those data collections as the basis for default data that is supplied to actions. That default data can be overridden.
14
+
15
+ * A data builder module has been added, which allows test data to be extracted from YAML files. Data sets can be given "friendly" names, which correspond to key names in the .yml files. The data builder and data setter modules have been designed to work together to make it easier to specify data conditions as part of actions taking place in the context of a page or activity definition.
16
+
17
+ * The generators module has been cleaned up a bit to allow for more streamlined actions on elements. For example, only select lists now allow the "select_" prefix or "_select" suffix. Radio buttons alone can have a "set_" prefix. Text fields and select lists now can respond to "_get" and "_set" suffixes, to allow for more consistency of expression.
18
+
4
19
  Version 0.5.0 / 2013-11-17
5
20
  --------------------------
6
21
 
data/lib/fluent.rb CHANGED
@@ -6,6 +6,9 @@ require 'fluent/platforms'
6
6
  require 'fluent/enclosers'
7
7
  require 'fluent/evaluators'
8
8
  require 'fluent/generators'
9
+ require 'fluent/locators'
10
+ require 'fluent/data_setter'
11
+ require 'fluent/data_builder'
9
12
 
10
13
  require 'watir-webdriver'
11
14
  require 'selenium-webdriver'
@@ -15,6 +18,9 @@ module Fluent
15
18
  include Platforms
16
19
  include Evaluators
17
20
  include Enclosers
21
+ include Locators
22
+ include DataSetter
23
+ include DataBuilder
18
24
 
19
25
  # Browser drivers will be:
20
26
  # [Watir::Browser] or [Selenium::WebDriver::Driver]
@@ -88,13 +94,22 @@ module Fluent
88
94
  end
89
95
 
90
96
  def self.can_be_enabled
91
- @can_be_enabled ||= [:button, :text_field, :checkbox, :select_list, :radio]
97
+ @can_be_enabled ||= [:button, :text_field, :text_area, :checkbox, :select_list, :radio]
98
+ end
99
+
100
+ def self.can_display_text
101
+ @can_display_text ||= [:button, :link, :list_item, :ordered_list, :unordered_list,
102
+ :label, :div, :span, :cell, :table, :h1, :h2, :h3, :h4, :h5, :h6]
92
103
  end
93
104
 
94
105
  def self.can_be_enabled?(method)
95
106
  can_be_enabled.include? method.to_sym
96
107
  end
97
108
 
109
+ def self.can_display_text?(method)
110
+ can_display_text.include? method.to_sym
111
+ end
112
+
98
113
  private
99
114
 
100
115
  # This method is crucial in that it sets up the platform instance that
@@ -0,0 +1,38 @@
1
+ require 'fluent/data_reader'
2
+
3
+ module Fluent
4
+ module DataBuilder
5
+ extend DataReader
6
+
7
+ class << self
8
+ attr_accessor :data_source
9
+ end
10
+
11
+ def self.default_data_path
12
+ 'common/data'
13
+ end
14
+
15
+ def data_for(key, specified={})
16
+ if key.is_a?(String) && key.match(%r{/})
17
+ file, record = key.split('/')
18
+ DataBuilder.load("#{file}.yml")
19
+ else
20
+ record = key.to_s
21
+ DataBuilder.load('default.yml') #unless DataBuilder.data_source
22
+ end
23
+
24
+ Fluent::trace("DataBuilder.data_source = #{DataBuilder.data_source}")
25
+
26
+ data = DataBuilder.data_source[record]
27
+ raise ArgumentError, "Undefined key for data: #{key}" unless data
28
+
29
+ data.merge(specified)
30
+ end
31
+
32
+ alias_method :data_from, :data_for
33
+ alias_method :data_about, :data_for
34
+ alias_method :using_data_for, :data_for
35
+ alias_method :using_data_from, :data_for
36
+
37
+ end
38
+ end
@@ -0,0 +1,21 @@
1
+ module Fluent
2
+ module DataReader
3
+
4
+ def data_path=(path)
5
+ @data_path = path
6
+ end
7
+
8
+ def data_path
9
+ return @data_path if @data_path
10
+ return default_data_path if self.respond_to? :default_data_path
11
+ end
12
+
13
+ # The data_source name here must match the name used for the
14
+ # class accessor in the data builder. It is this data_source
15
+ # variable that connects the reader and the builder.
16
+ def load(file)
17
+ @data_source = YAML.load_file "#{data_path}/#{file}"
18
+ end
19
+
20
+ end
21
+ end
@@ -0,0 +1,63 @@
1
+ module Fluent
2
+ module DataSetter
3
+
4
+ # @param data [Hash] the data to use
5
+ def using(data)
6
+ data.each do |key, value|
7
+ use_select_data_with(key, value) if value_selectable_for(key) and object_enabled_for(key)
8
+ use_check_data_with(key, value) if value_checkable_for(key) and object_enabled_for(key)
9
+ use_set_data_with(key, value) if value_settable_for(key) and object_enabled_for(key)
10
+ use_text_data_with(key, value) if text_settable_for(key) and object_enabled_for(key)
11
+ end
12
+ end
13
+
14
+ alias_method :using_data, :using
15
+ alias_method :use_data, :using
16
+ alias_method :using_values, :using
17
+ alias_method :use_values, :using
18
+
19
+ def use_text_data_with(key, value)
20
+ self.send "#{key}_set", value
21
+ end
22
+
23
+ def use_check_data_with(key, value)
24
+ return self.send "#{key}_check" if value
25
+ return self.send "#{key}_uncheck"
26
+ end
27
+
28
+ def use_select_data_with(key, value)
29
+ self.send "#{key}_select" if value
30
+ end
31
+
32
+ def use_set_data_with(key, value)
33
+ self.send "set_#{key}" if value
34
+ end
35
+
36
+ # The _for methods should use a unique signature for referring
37
+ # to a particular element action.
38
+
39
+ def value_checkable_for(key)
40
+ respond_to?("#{key}_check".to_sym)
41
+ end
42
+
43
+ # Only a select list can respond to a suffix of 'select_'
44
+ def value_selectable_for(key)
45
+ respond_to?("#{key}_select".to_sym)
46
+ end
47
+
48
+ # Only a radio can respond to a prefix of 'set_'
49
+ def value_settable_for(key)
50
+ respond_to?("set_#{key}".to_sym)
51
+ end
52
+
53
+ def text_settable_for(key)
54
+ respond_to?("#{key}=".to_sym)
55
+ end
56
+
57
+ def object_enabled_for(key)
58
+ web_element = self.send("#{key}_element")
59
+ web_element.enabled? and web_element.visible?
60
+ end
61
+
62
+ end
63
+ end
@@ -95,10 +95,14 @@ module Fluent
95
95
  return platform.text_field_get(locator.clone)
96
96
  end
97
97
 
98
+ alias_method "#{identifier}_get".to_sym, "#{identifier}".to_sym
99
+
98
100
  define_method("#{identifier}=") do |value|
99
101
  return platform.text_field_set(locator.clone, value)
100
102
  end
101
103
 
104
+ alias_method "#{identifier}_set", "#{identifier}=".to_sym
105
+
102
106
  common_definition_methods(identifier, locator, __method__)
103
107
  common_definition_methods(identifier, locator, 'textfield')
104
108
  end
@@ -108,9 +112,13 @@ module Fluent
108
112
  return platform.text_area_get(locator.clone)
109
113
  end
110
114
 
115
+ alias_method "#{identifier}_get".to_sym, "#{identifier}".to_sym
116
+
111
117
  define_method("#{identifier}=") do |value|
112
118
  return platform.text_area_set(locator.clone, value)
113
119
  end
120
+
121
+ alias_method "#{identifier}_set", "#{identifier}=".to_sym
114
122
 
115
123
  common_definition_methods(identifier, locator, __method__)
116
124
  common_definition_methods(identifier, locator, 'textarea')
@@ -124,10 +132,14 @@ module Fluent
124
132
  define_method("check_#{identifier}") do
125
133
  return platform.checkbox_check(locator.clone)
126
134
  end
127
-
135
+
136
+ alias_method "#{identifier}_check".to_sym, "check_#{identifier}".to_sym
137
+
128
138
  define_method("uncheck_#{identifier}") do
129
139
  return platform.checkbox_uncheck(locator.clone)
130
140
  end
141
+
142
+ alias_method "#{identifier}_uncheck".to_sym, "uncheck_#{identifier}".to_sym
131
143
 
132
144
  common_definition_methods(identifier, locator, __method__)
133
145
  end
@@ -137,12 +149,15 @@ module Fluent
137
149
  return platform.select_list_get_selected(locator.clone)
138
150
  end
139
151
 
152
+ alias_method "#{identifier}_get".to_sym, "#{identifier}".to_sym
140
153
  alias_method "#{identifier}_option?".to_sym, "#{identifier}".to_sym
141
154
 
142
- define_method("#{identifier}=") do |value|
155
+ define_method("#{identifier}_set") do |value|
143
156
  return platform.select_list_set(locator.clone, value)
144
157
  end
145
-
158
+
159
+ alias_method "#{identifier}_select", "#{identifier}_set".to_sym
160
+
146
161
  define_method("#{identifier}_options?") do
147
162
  web_object = self.send("#{identifier}_object")
148
163
  (web_object && web_object.options) ? web_object.options.collect(&:text) : []
@@ -156,16 +171,15 @@ module Fluent
156
171
  end
157
172
 
158
173
  def radio(identifier, locator)
159
- define_method("select_#{identifier}") do
174
+ define_method("set_#{identifier}") do
160
175
  return platform.radio_select(locator.clone)
161
176
  end
162
177
 
163
- define_method("#{identifier}_selected?") do
178
+ alias_method "#{identifier}_set".to_sym, "set_#{identifier}".to_sym
179
+
180
+ define_method("#{identifier}_set?") do
164
181
  return platform.radio_check_state(locator.clone)
165
182
  end
166
-
167
- alias_method "#{identifier}_set?".to_sym, "#{identifier}_selected?".to_sym
168
- alias_method "set_#{identifier}".to_sym, "select_#{identifier}".to_sym
169
183
 
170
184
  common_definition_methods(identifier, locator, __method__)
171
185
  common_definition_methods(identifier, locator, 'radio_button')
@@ -236,6 +250,26 @@ module Fluent
236
250
  end
237
251
 
238
252
  def image(identifier, locator)
253
+ define_method("#{identifier}_loaded?") do
254
+ return platform.image_action(locator.clone, 'loaded?')
255
+ end
256
+
257
+ define_method("#{identifier}_height") do
258
+ return platform.image_action(locator.clone, 'height')
259
+ end
260
+
261
+ define_method("#{identifier}_width") do
262
+ return platform.image_action(locator.clone, 'width')
263
+ end
264
+
265
+ define_method("#{identifier}_src") do
266
+ return platform.image_get_source(locator.clone)
267
+ end
268
+
269
+ define_method("#{identifier}_alt") do
270
+ return platform.image_get_alt_text(locator.clone)
271
+ end
272
+
239
273
  common_definition_methods(identifier, locator, __method__)
240
274
  common_definition_methods(identifier, locator, 'img')
241
275
  end
@@ -251,18 +285,6 @@ module Fluent
251
285
  end
252
286
  end
253
287
 
254
- #def h1(identifier, locator)
255
-
256
- #end
257
-
258
- #def h2(identifier, locator)
259
-
260
- #end
261
-
262
- #def h3(identifier, locator)
263
-
264
- #end
265
-
266
288
  alias_method :radio_button, :radio
267
289
  alias_method :textarea, :text_area
268
290
  alias_method :textfield, :text_field
@@ -299,6 +321,12 @@ module Fluent
299
321
  alias_method "#{identifier}_#{method}?".to_sym, "#{identifier}_exists?".to_sym
300
322
  alias_method "#{identifier}_#{method}_?".to_sym, "#{identifier}_visible?".to_sym
301
323
 
324
+ if Fluent.can_display_text?(method)
325
+ define_method("#{identifier}_text") do
326
+ platform.send(method, locator.clone).text
327
+ end
328
+ end
329
+
302
330
  if Fluent.can_be_enabled?(method)
303
331
  define_method("#{identifier}_enabled?") do
304
332
  platform.send(method, locator.clone).enabled?
@@ -310,5 +338,34 @@ module Fluent
310
338
  end
311
339
  end
312
340
 
341
+ ELEMENT_LIST = [:text_field, :text_area, :select_list, :checkbox, :radio,
342
+ :link, :button, :table, :cell, :div, :span, :image,
343
+ :list_item, :ordered_list, :unordered_list, :form,
344
+ :h1, :h2, :h3, :h4, :h5, :h6, :paragraph, :label, :hidden]
345
+
346
+ def self.generate_locators(caller)
347
+ ELEMENT_LIST.each do |element|
348
+ caller.send(:define_method, "#{element.to_s}_locate") do |*locator|
349
+ @platform.send "#{element.to_s}", locate_by(locator)
350
+ end
351
+
352
+ caller.send(:define_method, "#{element.to_s}_elements") do |*locator|
353
+ @platform.send("#{element}s", locator[0] ? locator[0] : {})
354
+ end
355
+ end
356
+ end
357
+
358
+ element_set = ELEMENT_LIST.clone
359
+ element_set[element_set.find_index(:checkbox)] = :checkboxe
360
+ element_set.each do |selector|
361
+ define_method("#{selector}s") do |identifier, *locator|
362
+ define_method("#{identifier}_elements") do
363
+ platform_method = "#{selector.to_s}s" unless selector == :checkboxe
364
+ platform_method = "checkboxes" if selector == :checkboxe
365
+ platform.send platform_method, (locator.first ? locator.first.clone : {})
366
+ end
367
+ end
368
+ end
369
+
313
370
  end
314
371
  end
@@ -0,0 +1,15 @@
1
+ require 'fluent/generators'
2
+
3
+ module Fluent
4
+ module Locators
5
+
6
+ def self.included(caller)
7
+ ::Fluent::Generators.generate_locators(caller)
8
+ end
9
+
10
+ def locate_by(locator)
11
+ locator[0] ? locator[0] : {index: 0}
12
+ end
13
+
14
+ end
15
+ end
@@ -90,6 +90,10 @@ module Fluent
90
90
  reference_web_element('link(locator)', WebElements::Link, locator)
91
91
  end
92
92
 
93
+ def links(locator)
94
+ reference_web_elements('links(locator)', WebElements::Link, locator)
95
+ end
96
+
93
97
  def link_click(locator)
94
98
  access_web_element('link(locator).click', locator)
95
99
  end
@@ -98,6 +102,10 @@ module Fluent
98
102
  reference_web_element('button(locator)', WebElements::Button, locator)
99
103
  end
100
104
 
105
+ def buttons(locator)
106
+ reference_web_elements('buttons(locator)', WebElements::Button, locator)
107
+ end
108
+
101
109
  def button_click(locator)
102
110
  access_web_element('button(locator).click', locator)
103
111
  end
@@ -106,6 +114,10 @@ module Fluent
106
114
  reference_web_element('text_field(locator)', WebElements::TextField, locator)
107
115
  end
108
116
 
117
+ def text_fields(locator)
118
+ reference_web_elements('text_fields(locator)', WebElements::TextField, locator)
119
+ end
120
+
109
121
  def text_field_set(locator, value)
110
122
  access_web_element('text_field(locator).set(value)', locator, value)
111
123
  end
@@ -118,6 +130,10 @@ module Fluent
118
130
  reference_web_element('textarea(locator)', WebElements::TextArea, locator)
119
131
  end
120
132
 
133
+ def text_areas(locator)
134
+ reference_web_elements('textareas(locator)', WebElements::TextArea, locator)
135
+ end
136
+
121
137
  def text_area_set(locator, value)
122
138
  access_web_element('textarea(locator).set(value)', locator, value)
123
139
  end
@@ -130,6 +146,12 @@ module Fluent
130
146
  reference_web_element('checkbox(locator)', WebElements::CheckBox, locator)
131
147
  end
132
148
 
149
+ def checkboxes(locator)
150
+ reference_web_elements('checkboxes(locator)', WebElements::CheckBox, locator)
151
+ end
152
+
153
+ alias_method :checkboxs, :checkboxes
154
+
133
155
  def checkbox_check_state(locator)
134
156
  access_web_element('checkbox(locator).set?', locator)
135
157
  end
@@ -145,6 +167,10 @@ module Fluent
145
167
  def select_list(locator)
146
168
  reference_web_element('select_list(locator)', WebElements::SelectList, locator)
147
169
  end
170
+
171
+ def select_lists(locator)
172
+ reference_web_elements('select_lists(locator)', WebElements::SelectList, locator)
173
+ end
148
174
 
149
175
  def select_list_get_selected(locator)
150
176
  access_web_element('select_list(locator).selected_options[0].text', locator)
@@ -161,6 +187,10 @@ module Fluent
161
187
  def radio(locator)
162
188
  reference_web_element('radio(locator)', WebElements::Radio, locator)
163
189
  end
190
+
191
+ def radios(locator)
192
+ reference_web_elements('radios(locator)', WebElements::Radio, locator)
193
+ end
164
194
 
165
195
  def radio_select(locator)
166
196
  access_web_element('radio(locator).set', locator)
@@ -173,6 +203,10 @@ module Fluent
173
203
  def paragraph(locator)
174
204
  reference_web_element('p(locator)', WebElements::Paragraph, locator)
175
205
  end
206
+
207
+ def paragraphs(locator)
208
+ reference_web_elements('ps(locator)', WebElements::Paragraph, locator)
209
+ end
176
210
 
177
211
  def paragraph_text(locator)
178
212
  access_web_element('p(locator).text', locator)
@@ -182,6 +216,10 @@ module Fluent
182
216
  reference_web_element('div(locator)', WebElements::Div, locator)
183
217
  end
184
218
 
219
+ def divs(locator)
220
+ reference_web_elements('divs(locator)', WebElements::Div, locator)
221
+ end
222
+
185
223
  def div_text(locator)
186
224
  access_web_element('div(locator).text', locator)
187
225
  end
@@ -189,7 +227,11 @@ module Fluent
189
227
  def span(locator)
190
228
  reference_web_element('span(locator)', WebElements::Span, locator)
191
229
  end
192
-
230
+
231
+ def spans(locator)
232
+ reference_web_elements('spans(locator)', WebElements::Span, locator)
233
+ end
234
+
193
235
  def span_text(locator)
194
236
  access_web_element('span(locator).text', locator)
195
237
  end
@@ -197,6 +239,10 @@ module Fluent
197
239
  def ordered_list(locator)
198
240
  reference_web_element('ol(locator)', WebElements::OrderedList, locator)
199
241
  end
242
+
243
+ def ordered_lists(locator)
244
+ reference_web_elements('ols(locator)', WebElements::OrderedList, locator)
245
+ end
200
246
 
201
247
  def ordered_list_text(locator)
202
248
  access_web_element('ol(locator).text', locator)
@@ -205,7 +251,11 @@ module Fluent
205
251
  def unordered_list(locator)
206
252
  reference_web_element('ul(locator)', WebElements::UnorderedList, locator)
207
253
  end
208
-
254
+
255
+ def unordered_lists(locator)
256
+ reference_web_elements('uls(locator)', WebElements::UnorderedList, locator)
257
+ end
258
+
209
259
  def unordered_list_text(locator)
210
260
  access_web_element('ul(locator).text', locator)
211
261
  end
@@ -214,6 +264,10 @@ module Fluent
214
264
  reference_web_element('li(locator)', WebElements::ListItem, locator)
215
265
  end
216
266
 
267
+ def list_items(locator)
268
+ reference_web_elements('lis(locator)', WebElements::ListItem, locator)
269
+ end
270
+
217
271
  def list_item_text(locator)
218
272
  access_web_element('li(locator).text', locator)
219
273
  end
@@ -221,7 +275,11 @@ module Fluent
221
275
  def table(locator)
222
276
  reference_web_element('table(locator)', WebElements::Table, locator)
223
277
  end
224
-
278
+
279
+ def tables(locator)
280
+ reference_web_elements('tables(locator)', WebElements::Table, locator)
281
+ end
282
+
225
283
  def table_text(locator)
226
284
  access_web_element('table(locator).text', locator)
227
285
  end
@@ -229,7 +287,11 @@ module Fluent
229
287
  def cell(locator)
230
288
  reference_web_element('td(locator)', WebElements::Cell, locator)
231
289
  end
232
-
290
+
291
+ def cells(locator)
292
+ reference_web_elements('tds(locator)', WebElements::Cell, locator)
293
+ end
294
+
233
295
  def cell_text(locator)
234
296
  access_web_element('td(locator).text', locator)
235
297
  end
@@ -238,6 +300,10 @@ module Fluent
238
300
  reference_web_element('label(locator)', WebElements::Label, locator)
239
301
  end
240
302
 
303
+ def labels(locator)
304
+ reference_web_elements('labels(locator)', WebElements::Label, locator)
305
+ end
306
+
241
307
  def label_text(locator)
242
308
  access_web_element('label(locator).text', locator)
243
309
  end
@@ -246,6 +312,10 @@ module Fluent
246
312
  reference_web_element('hidden(locator)', WebElements::Hidden, locator)
247
313
  end
248
314
 
315
+ def hiddens(locator)
316
+ reference_web_elements('hiddens(locator)', WebElements::Hidden, locator)
317
+ end
318
+
249
319
  def hidden_value(locator)
250
320
  access_web_element('hidden(locator).value', locator)
251
321
  end
@@ -253,6 +323,10 @@ module Fluent
253
323
  def h1(locator)
254
324
  reference_web_element('h1(locator)', WebElements::Heading, locator)
255
325
  end
326
+
327
+ def h1s(locator)
328
+ reference_web_elements('h1s(locator)', WebElements::Heading, locator)
329
+ end
256
330
 
257
331
  def h1_text(locator)
258
332
  access_web_element('h1(locator).text', locator)
@@ -262,6 +336,10 @@ module Fluent
262
336
  reference_web_element('h2(locator)', WebElements::Heading, locator)
263
337
  end
264
338
 
339
+ def h2s(locator)
340
+ reference_web_elements('h2s(locator)', WebElements::Heading, locator)
341
+ end
342
+
265
343
  def h2_text(locator)
266
344
  access_web_element('h2(locator).text', locator)
267
345
  end
@@ -270,6 +348,10 @@ module Fluent
270
348
  reference_web_element('h3(locator)', WebElements::Heading, locator)
271
349
  end
272
350
 
351
+ def h3s(locator)
352
+ reference_web_elements('h3s(locator)', WebElements::Heading, locator)
353
+ end
354
+
273
355
  def h3_text(locator)
274
356
  access_web_element('h3(locator).text', locator)
275
357
  end
@@ -278,6 +360,10 @@ module Fluent
278
360
  reference_web_element('h4(locator)', WebElements::Heading, locator)
279
361
  end
280
362
 
363
+ def h4s(locator)
364
+ reference_web_elements('h4s(locator)', WebElements::Heading, locator)
365
+ end
366
+
281
367
  def h4_text(locator)
282
368
  access_web_element('h4(locator).text', locator)
283
369
  end
@@ -286,6 +372,10 @@ module Fluent
286
372
  reference_web_element('h5(locator)', WebElements::Heading, locator)
287
373
  end
288
374
 
375
+ def h5s(locator)
376
+ reference_web_elements('h5s(locator)', WebElements::Heading, locator)
377
+ end
378
+
289
379
  def h5_text(locator)
290
380
  access_web_element('h5(locator).text', locator)
291
381
  end
@@ -294,6 +384,10 @@ module Fluent
294
384
  reference_web_element('h6(locator)', WebElements::Heading, locator)
295
385
  end
296
386
 
387
+ def h6s(locator)
388
+ reference_web_elements('h6s(locator)', WebElements::Heading, locator)
389
+ end
390
+
297
391
  def h6_text(locator)
298
392
  access_web_element('h6(locator).text', locator)
299
393
  end
@@ -302,10 +396,30 @@ module Fluent
302
396
  reference_web_element('form(locator)', WebElements::Form, locator)
303
397
  end
304
398
 
399
+ def forms(locator)
400
+ reference_web_elements('forms(locator)', WebElements::Form, locator)
401
+ end
402
+
305
403
  def image(locator)
306
404
  reference_web_element('image(locator)', WebElements::Image, locator)
307
405
  end
308
406
 
407
+ def images(locator)
408
+ reference_web_elements('images(locator)', WebElements::Image, locator)
409
+ end
410
+
411
+ def image_action(locator, action)
412
+ access_web_element("image(locator).#{action}", locator)
413
+ end
414
+
415
+ def image_get_source(locator)
416
+ access_web_element("image(locator).attribute_value('src')", locator)
417
+ end
418
+
419
+ def image_get_alt_text(locator)
420
+ access_web_element("image(locator).attribute_value('alt')", locator)
421
+ end
422
+
309
423
  alias_method :radio_button, :radio
310
424
  alias_method :textarea, :text_area
311
425
  alias_method :textfield, :text_field
@@ -329,6 +443,14 @@ module Fluent
329
443
  element_object = driver.instance_eval("#{enclosed_by(encloser)}#{action}")
330
444
  object.new(element_object, :platform => :watir_webdriver)
331
445
  end
446
+
447
+ def reference_web_elements(action, object, locator)
448
+ encloser = locator.delete(:frame)
449
+ element_objects = driver.instance_eval("#{enclosed_by(encloser)}#{action}")
450
+ element_objects.map do |element|
451
+ object.new(element, :platform => :watir_webdriver)
452
+ end
453
+ end
332
454
 
333
455
  # This method is called by any platform methods that require accessing
334
456
  # a web object with the intent of manipulating it or getting information
@@ -7,10 +7,17 @@ module Fluent
7
7
  web_element.set?
8
8
  end
9
9
 
10
+ alias_method :set?, :checked?
11
+
10
12
  def check
11
13
  web_element.set
12
14
  end
13
15
 
16
+ def set(state=true)
17
+ web_element.set if state
18
+ web_element.clear unless state
19
+ end
20
+
14
21
  def uncheck
15
22
  web_element.clear
16
23
  end
@@ -0,0 +1,21 @@
1
+ module Fluent
2
+ module Platforms
3
+ module WatirWebDriver
4
+ module Image
5
+
6
+ def width
7
+ web_element.width
8
+ end
9
+
10
+ def height
11
+ web_element.height
12
+ end
13
+
14
+ def loaded?
15
+ web_element.loaded?
16
+ end
17
+
18
+ end
19
+ end
20
+ end
21
+ end
@@ -7,6 +7,8 @@ module Fluent
7
7
  web_element.set?
8
8
  end
9
9
 
10
+ alias_method :set?, :selected?
11
+
10
12
  def select
11
13
  web_element.set
12
14
  end
@@ -1,3 +1,3 @@
1
1
  module Fluent
2
- VERSION = '0.5.0'
2
+ VERSION = '0.6.0'
3
3
  end
@@ -9,6 +9,10 @@ module Fluent
9
9
 
10
10
  def include_platform_specifics_for(platform)
11
11
  super
12
+ if platform[:platform] == :watir_webdriver
13
+ require 'fluent/platform_watir/platform_web_elements/image'
14
+ self.class.send :include, Fluent::Platforms::WatirWebDriver::Image
15
+ end
12
16
  end
13
17
 
14
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Nyman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-11-17 00:00:00.000000000 Z
11
+ date: 2013-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -66,48 +66,6 @@ dependencies:
66
66
  - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.7.1
69
- - !ruby/object:Gem::Dependency
70
- name: sinatra
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - '='
74
- - !ruby/object:Gem::Version
75
- version: 1.4.4
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - '='
81
- - !ruby/object:Gem::Version
82
- version: 1.4.4
83
- - !ruby/object:Gem::Dependency
84
- name: sinatra-reloader
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - '='
88
- - !ruby/object:Gem::Version
89
- version: '1.0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - '='
95
- - !ruby/object:Gem::Version
96
- version: '1.0'
97
- - !ruby/object:Gem::Dependency
98
- name: thin
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - '='
102
- - !ruby/object:Gem::Version
103
- version: 1.6.1
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - '='
109
- - !ruby/object:Gem::Version
110
- version: 1.6.1
111
69
  - !ruby/object:Gem::Dependency
112
70
  name: watir-webdriver
113
71
  requirement: !ruby/object:Gem::Requirement
@@ -157,11 +115,15 @@ executables: []
157
115
  extensions: []
158
116
  extra_rdoc_files: []
159
117
  files:
118
+ - lib/fluent/data_builder.rb
119
+ - lib/fluent/data_reader.rb
120
+ - lib/fluent/data_setter.rb
160
121
  - lib/fluent/enclosers.rb
161
122
  - lib/fluent/errors.rb
162
123
  - lib/fluent/evaluators.rb
163
124
  - lib/fluent/factory.rb
164
125
  - lib/fluent/generators.rb
126
+ - lib/fluent/locators.rb
165
127
  - lib/fluent/logger.rb
166
128
  - lib/fluent/platforms.rb
167
129
  - lib/fluent/platform_mechanize/platform_object.rb
@@ -170,6 +132,7 @@ files:
170
132
  - lib/fluent/platform_selenium.rb
171
133
  - lib/fluent/platform_watir/platform_object.rb
172
134
  - lib/fluent/platform_watir/platform_web_elements/checkbox.rb
135
+ - lib/fluent/platform_watir/platform_web_elements/image.rb
173
136
  - lib/fluent/platform_watir/platform_web_elements/ordered_list.rb
174
137
  - lib/fluent/platform_watir/platform_web_elements/radio.rb
175
138
  - lib/fluent/platform_watir/platform_web_elements/select_list.rb