fluent 0.7.3 → 0.7.4

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: c79d7d2f797b81cc077bf208424734358ae32312
4
- data.tar.gz: 68eaac53b4e08133dcaf1eb46afd5064d065765c
3
+ metadata.gz: fb91a4979f347c6c48c56b72aef4ac74d8c2aba8
4
+ data.tar.gz: aaa194a3259546456b03400b8bd3f11fd7088d4c
5
5
  SHA512:
6
- metadata.gz: 0a46811e408cf068b8147d2106301b2d5dad61d343adf4e425d63201b35e3a6e4f1309222bb858c62266fb8dcfeb053f4c48fc705058505e37e61ed445a85cc1
7
- data.tar.gz: 51d97e5c42f6eed673a7557c7fc33c3b53c03d57e8c6fe90736724ef6b16fa1f87555dc96e0bff28ec8561de68c4455580b780c4ac698553440bd16ba7392c71
6
+ metadata.gz: d9a37468a281061ff9c0564ed3d27b3f128016c1dc23c57e3af337a92ca84df612abd8abe6df6e1fb540e3f0ef77b080aeb8fecc2a82d60514a176ed3f723866
7
+ data.tar.gz: 3bd8e5667cbee8d01a0bd9b0e719e9ee91c4f0dc06c42df46fc8d8ebfa4877cca9d14372c05c052d90ed65d62a59782bca1b0e8d4087f24882da05d29f9c1c6b
data/HISTORY.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Change Log and History
2
2
  ======================
3
3
 
4
+ Version 0.7.4 / 2013-12-19
5
+ --------------------------
6
+
7
+ The changes in this patch release are:
8
+
9
+ * Element definitions can now accept blocks.
10
+
11
+ * It is now possible to run JavaScript against a web element by passing an element reference to the call to `run_script` (or `execute_script`).
12
+
13
+ * RSpec is now a runtime dependency. This allows for RSpec Matchers to automatically be included into page and activity definitions, which makes it easier to incorporate all of RSpec's checking methods.
14
+
15
+
4
16
  Version 0.7.3 / 2013-12-18
5
17
  --------------------------
6
18
 
@@ -15,6 +15,7 @@ require 'fluent/data_config'
15
15
  require 'watir-webdriver'
16
16
  require 'selenium-webdriver'
17
17
  require 'mechanize'
18
+ require 'rspec'
18
19
 
19
20
  module Fluent
20
21
  include Platforms
@@ -24,6 +25,7 @@ module Fluent
24
25
  include DataSetter
25
26
  include DataBuilder
26
27
  include DataConfig
28
+ include RSpec::Matchers
27
29
 
28
30
  # Browser drivers will be:
29
31
  # [Watir::Browser] or [Selenium::WebDriver::Driver]
@@ -127,4 +129,11 @@ module Fluent
127
129
  Fluent::trace("Fluent platform object: #{@platform}")
128
130
  @platform
129
131
  end
132
+
133
+ # This method processes a block with single or multiple parameters.
134
+ #
135
+ # @param [Proc] block the block to process
136
+ def process_block(&block)
137
+ block.arity == 1 ? block.call(self) : self.instance_eval(&block)
138
+ end
130
139
  end
@@ -25,7 +25,8 @@ module Fluent
25
25
  platform.refresh
26
26
  end
27
27
 
28
- def run_script(script)
28
+ def run_script(script, *args)
29
+ args.map! { |obj| obj.kind_of?(Fluent::WebElements::WebElement) ? obj.web_element : obj }
29
30
  platform.run_script(script)
30
31
  end
31
32
 
@@ -48,112 +48,112 @@ module Fluent
48
48
  block.call(frame)
49
49
  end
50
50
 
51
- def link(identifier, locator)
51
+ def link(identifier, locator={index: 0}, &block)
52
52
  define_method(identifier) do
53
- return platform.link_click(locator.clone)
53
+ return platform.link_click(locator.clone) unless block_given?
54
54
  end
55
55
 
56
- common_definition_methods(identifier, locator, __method__)
57
- common_definition_methods(identifier, locator, 'a')
56
+ common_definition_methods(identifier, locator, __method__, &block)
57
+ common_definition_methods(identifier, locator, 'a', &block)
58
58
  end
59
59
 
60
- def paragraph(identifier, locator)
60
+ def paragraph(identifier, locator={index: 0}, &block)
61
61
  define_method(identifier) do
62
- return platform.paragraph_text(locator.clone)
62
+ return platform.paragraph_text(locator.clone) unless block_given?
63
63
  end
64
64
 
65
- common_definition_methods(identifier, locator, __method__)
66
- common_definition_methods(identifier, locator, 'p')
65
+ common_definition_methods(identifier, locator, __method__, &block)
66
+ common_definition_methods(identifier, locator, 'p', &block)
67
67
  end
68
68
 
69
- def div(identifier, locator)
69
+ def div(identifier, locator={index: 0}, &block)
70
70
  define_method(identifier) do
71
- return platform.div_text(locator.clone)
71
+ return platform.div_text(locator.clone) unless block_given?
72
72
  end
73
73
 
74
- common_definition_methods(identifier, locator, __method__)
74
+ common_definition_methods(identifier, locator, __method__, &block)
75
75
  end
76
76
 
77
- def span(identifier, locator)
77
+ def span(identifier, locator={index: 0}, &block)
78
78
  define_method(identifier) do
79
- return platform.span_text(locator.clone)
79
+ return platform.span_text(locator.clone) unless block_given?
80
80
  end
81
81
 
82
- common_definition_methods(identifier, locator, __method__)
82
+ common_definition_methods(identifier, locator, __method__, &block)
83
83
  end
84
84
 
85
- def button(identifier, locator)
85
+ def button(identifier, locator={index: 0}, &block)
86
86
  define_method(identifier) do
87
- return platform.button_click(locator.clone)
87
+ return platform.button_click(locator.clone) unless block_given?
88
88
  end
89
89
 
90
- common_definition_methods(identifier, locator, __method__)
90
+ common_definition_methods(identifier, locator, __method__, &block)
91
91
  end
92
92
 
93
- def text_field(identifier, locator)
93
+ def text_field(identifier, locator={index: 0}, &block)
94
94
  define_method(identifier) do
95
- return platform.text_field_get(locator.clone)
95
+ return platform.text_field_get(locator.clone) unless block_given?
96
96
  end
97
97
 
98
98
  alias_method "#{identifier}_get".to_sym, "#{identifier}".to_sym
99
99
 
100
100
  define_method("#{identifier}=") do |value|
101
- return platform.text_field_set(locator.clone, value)
101
+ return platform.text_field_set(locator.clone, value) unless block_given?
102
102
  end
103
103
 
104
104
  alias_method "#{identifier}_set", "#{identifier}=".to_sym
105
105
 
106
- common_definition_methods(identifier, locator, __method__)
107
- common_definition_methods(identifier, locator, 'textfield')
106
+ common_definition_methods(identifier, locator, __method__, &block)
107
+ common_definition_methods(identifier, locator, 'textfield', &block)
108
108
  end
109
109
 
110
- def text_area(identifier, locator)
110
+ def text_area(identifier, locator={index: 0}, &block)
111
111
  define_method(identifier) do
112
- return platform.text_area_get(locator.clone)
112
+ return platform.text_area_get(locator.clone) unless block_given?
113
113
  end
114
114
 
115
115
  alias_method "#{identifier}_get".to_sym, "#{identifier}".to_sym
116
116
 
117
117
  define_method("#{identifier}=") do |value|
118
- return platform.text_area_set(locator.clone, value)
118
+ return platform.text_area_set(locator.clone, value) unless block_given?
119
119
  end
120
120
 
121
121
  alias_method "#{identifier}_set", "#{identifier}=".to_sym
122
122
 
123
- common_definition_methods(identifier, locator, __method__)
124
- common_definition_methods(identifier, locator, 'textarea')
123
+ common_definition_methods(identifier, locator, __method__, &block)
124
+ common_definition_methods(identifier, locator, 'textarea', &block)
125
125
  end
126
126
 
127
- def checkbox(identifier, locator)
127
+ def checkbox(identifier, locator={index: 0}, &block)
128
128
  define_method("#{identifier}_checked?") do
129
- return platform.checkbox_check_state(locator.clone)
129
+ return platform.checkbox_check_state(locator.clone) unless block_given?
130
130
  end
131
131
 
132
132
  define_method("check_#{identifier}") do
133
- return platform.checkbox_check(locator.clone)
133
+ return platform.checkbox_check(locator.clone) unless block_given?
134
134
  end
135
135
 
136
136
  alias_method "#{identifier}_check".to_sym, "check_#{identifier}".to_sym
137
137
 
138
138
  define_method("uncheck_#{identifier}") do
139
- return platform.checkbox_uncheck(locator.clone)
139
+ return platform.checkbox_uncheck(locator.clone) unless block_given?
140
140
  end
141
141
 
142
142
  alias_method "#{identifier}_uncheck".to_sym, "uncheck_#{identifier}".to_sym
143
143
 
144
- common_definition_methods(identifier, locator, __method__)
144
+ common_definition_methods(identifier, locator, __method__, &block)
145
145
  end
146
146
 
147
- def select_list(identifier, locator)
147
+ def select_list(identifier, locator={index: 0}, &block)
148
148
  define_method(identifier) do
149
- return platform.select_list_get_selected(locator.clone)
149
+ return platform.select_list_get_selected(locator.clone) unless block_given?
150
150
  end
151
151
 
152
152
  alias_method "#{identifier}_get".to_sym, "#{identifier}".to_sym
153
153
  alias_method "#{identifier}_option?".to_sym, "#{identifier}".to_sym
154
154
 
155
155
  define_method("#{identifier}_set") do |value|
156
- return platform.select_list_set(locator.clone, value)
156
+ return platform.select_list_set(locator.clone, value) unless block_given?
157
157
  end
158
158
 
159
159
  alias_method "#{identifier}_select", "#{identifier}_set".to_sym
@@ -164,124 +164,124 @@ module Fluent
164
164
  end
165
165
 
166
166
  define_method("#{identifier}_value?") do
167
- return platform.select_list_get_value(locator.clone)
167
+ return platform.select_list_get_value(locator.clone) unless block_given?
168
168
  end
169
169
 
170
- common_definition_methods(identifier, locator, __method__)
170
+ common_definition_methods(identifier, locator, __method__, &block)
171
171
  end
172
172
 
173
- def radio(identifier, locator)
173
+ def radio(identifier, locator={index: 0}, &block)
174
174
  define_method("set_#{identifier}") do
175
- return platform.radio_select(locator.clone)
175
+ return platform.radio_select(locator.clone) unless block_given?
176
176
  end
177
177
 
178
178
  alias_method "#{identifier}_set".to_sym, "set_#{identifier}".to_sym
179
179
 
180
180
  define_method("#{identifier}_set?") do
181
- return platform.radio_check_state(locator.clone)
181
+ return platform.radio_check_state(locator.clone) unless block_given?
182
182
  end
183
183
 
184
- common_definition_methods(identifier, locator, __method__)
185
- common_definition_methods(identifier, locator, 'radio_button')
184
+ common_definition_methods(identifier, locator, __method__, &block)
185
+ common_definition_methods(identifier, locator, 'radio_button', &block)
186
186
  end
187
187
 
188
- def ordered_list(identifier, locator)
188
+ def ordered_list(identifier, locator={index: 0}, &block)
189
189
  define_method(identifier) do
190
- return platform.ordered_list_text(locator.clone)
190
+ return platform.ordered_list_text(locator.clone) unless block_given?
191
191
  end
192
192
 
193
- common_definition_methods(identifier, locator, __method__)
194
- common_definition_methods(identifier, locator, 'ol')
193
+ common_definition_methods(identifier, locator, __method__, &block)
194
+ common_definition_methods(identifier, locator, 'ol', &block)
195
195
  end
196
196
 
197
- def unordered_list(identifier, locator)
197
+ def unordered_list(identifier, locator={index: 0}, &block)
198
198
  define_method(identifier) do
199
- return platform.unordered_list_text(locator.clone)
199
+ return platform.unordered_list_text(locator.clone) unless block_given?
200
200
  end
201
201
 
202
- common_definition_methods(identifier, locator, __method__)
203
- common_definition_methods(identifier, locator, 'ul')
202
+ common_definition_methods(identifier, locator, __method__, &block)
203
+ common_definition_methods(identifier, locator, 'ul', &block)
204
204
  end
205
205
 
206
- def list_item(identifier, locator)
206
+ def list_item(identifier, locator={index: 0}, &block)
207
207
  define_method(identifier) do
208
- return platform.list_item_text(locator.clone)
208
+ return platform.list_item_text(locator.clone) unless block_given?
209
209
  end
210
210
 
211
- common_definition_methods(identifier, locator, __method__)
212
- common_definition_methods(identifier, locator, 'li')
211
+ common_definition_methods(identifier, locator, __method__, &block)
212
+ common_definition_methods(identifier, locator, 'li', &block)
213
213
  end
214
214
 
215
- def table(identifier, locator)
215
+ def table(identifier, locator={index: 0}, &block)
216
216
  define_method(identifier) do
217
- return platform.table_text(locator.clone)
217
+ return platform.table_text(locator.clone) unless block_given?
218
218
  end
219
219
 
220
- common_definition_methods(identifier, locator, __method__)
220
+ common_definition_methods(identifier, locator, __method__, &block)
221
221
  end
222
222
 
223
- def cell(identifier, locator)
223
+ def cell(identifier, locator={index: 0}, &block)
224
224
  define_method(identifier) do
225
- return platform.cell_text(locator.clone)
225
+ return platform.cell_text(locator.clone) unless block_given?
226
226
  end
227
227
 
228
- common_definition_methods(identifier, locator, __method__)
229
- common_definition_methods(identifier, locator, 'td')
228
+ common_definition_methods(identifier, locator, __method__, &block)
229
+ common_definition_methods(identifier, locator, 'td', &block)
230
230
  end
231
231
 
232
- def label(identifier, locator)
232
+ def label(identifier, locator={index: 0}, &block)
233
233
  define_method(identifier) do
234
- return platform.label_text(locator.clone)
234
+ return platform.label_text(locator.clone) unless block_given?
235
235
  end
236
236
 
237
- common_definition_methods(identifier, locator, __method__)
237
+ common_definition_methods(identifier, locator, __method__, &block)
238
238
  end
239
239
 
240
- def hidden(identifier, locator)
240
+ def hidden(identifier, locator={index: 0}, &block)
241
241
  define_method(identifier) do
242
- return platform.hidden_value(locator.clone)
242
+ return platform.hidden_value(locator.clone) unless block_given?
243
243
  end
244
-
245
- common_definition_methods(identifier, locator, __method__)
244
+
245
+ common_definition_methods(identifier, locator, __method__, &block)
246
246
  end
247
247
 
248
- def form(identifier, locator)
249
- common_definition_methods(identifier, locator, __method__)
248
+ def form(identifier, locator={index: 0}, &block)
249
+ common_definition_methods(identifier, locator, __method__, &block)
250
250
  end
251
251
 
252
- def image(identifier, locator)
252
+ def image(identifier, locator={index: 0}, &block)
253
253
  define_method("#{identifier}_loaded?") do
254
- return platform.image_action(locator.clone, 'loaded?')
254
+ return platform.image_action(locator.clone, 'loaded?') unless block_given?
255
255
  end
256
256
 
257
257
  define_method("#{identifier}_height") do
258
- return platform.image_action(locator.clone, 'height')
258
+ return platform.image_action(locator.clone, 'height') unless block_given?
259
259
  end
260
260
 
261
261
  define_method("#{identifier}_width") do
262
- return platform.image_action(locator.clone, 'width')
262
+ return platform.image_action(locator.clone, 'width') unless block_given?
263
263
  end
264
264
 
265
265
  define_method("#{identifier}_src") do
266
- return platform.image_get_source(locator.clone)
266
+ return platform.image_get_source(locator.clone) unless block_given?
267
267
  end
268
268
 
269
269
  define_method("#{identifier}_alt") do
270
- return platform.image_get_alt_text(locator.clone)
270
+ return platform.image_get_alt_text(locator.clone) unless block_given?
271
271
  end
272
272
 
273
- common_definition_methods(identifier, locator, __method__)
274
- common_definition_methods(identifier, locator, 'img')
273
+ common_definition_methods(identifier, locator, __method__, &block)
274
+ common_definition_methods(identifier, locator, 'img', &block)
275
275
  end
276
276
 
277
277
  [:h1, :h2, :h3, :h4, :h5, :h6].each do |method|
278
- define_method(method) do |identifier, locator|
278
+ define_method(method) do |identifier, locator={index: 0}, &block|
279
279
  define_method(identifier) do
280
280
  platform_method = "#{method.to_s}_text"
281
- return platform.send(platform_method, locator.clone)
281
+ return platform.send(platform_method, locator.clone) unless block_given?
282
282
  end
283
283
 
284
- common_definition_methods(identifier, locator, method)
284
+ common_definition_methods(identifier, locator, method, &block)
285
285
  end
286
286
  end
287
287
 
@@ -296,16 +296,19 @@ module Fluent
296
296
  alias_method :td, :cell
297
297
  alias_method :img, :image
298
298
 
299
- def common_definition_methods(identifier, locator, method)
299
+ def common_definition_methods(identifier, locator, method, &block)
300
300
  define_method("#{identifier}_object") do
301
+ return process_block(&block) if block_given?
301
302
  platform.send(method, locator.clone)
302
303
  end
303
304
 
304
305
  define_method("#{identifier}_exists?") do
306
+ return process_block(&block).exists? if block_given?
305
307
  platform.send(method, locator.clone).exists?
306
308
  end
307
309
 
308
310
  define_method("#{identifier}_visible?") do
311
+ return process_block(&block).visible? if block_given?
309
312
  platform.send(method, locator.clone).visible?
310
313
  end
311
314
 
@@ -329,6 +332,7 @@ module Fluent
329
332
 
330
333
  if Fluent.can_be_enabled?(method)
331
334
  define_method("#{identifier}_enabled?") do
335
+ return process_block(&block).enabled? if block_given?
332
336
  platform.send(method, locator.clone).enabled?
333
337
  end
334
338
 
@@ -358,8 +362,9 @@ module Fluent
358
362
  element_set = ELEMENT_LIST.clone
359
363
  element_set[element_set.find_index(:checkbox)] = :checkboxe
360
364
  element_set.each do |selector|
361
- define_method("#{selector}s") do |identifier, *locator|
365
+ define_method("#{selector}s") do |identifier, *locator, &block|
362
366
  define_method("#{identifier}_elements") do
367
+ return process_block(&block) unless block.nil?
363
368
  platform_method = "#{selector.to_s}s" unless selector == :checkboxe
364
369
  platform_method = "checkboxes" if selector == :checkboxe
365
370
  platform.send platform_method, (locator.first ? locator.first.clone : {})
@@ -1,3 +1,3 @@
1
1
  module Fluent
2
- VERSION = '0.7.3'
2
+ VERSION = '0.7.4'
3
3
  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.7.3
4
+ version: 0.7.4
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-12-18 00:00:00.000000000 Z
11
+ date: 2013-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,33 +39,33 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: rspec
42
+ name: require_all
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
- version: '2.0'
47
+ version: '0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
- version: '2.0'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
- name: require_all
56
+ name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
61
+ version: '2.0'
62
+ type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: '2.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: watir-webdriver
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -86,14 +86,14 @@ dependencies:
86
86
  requirements:
87
87
  - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 2.38.0
89
+ version: 2.39.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
94
  - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 2.38.0
96
+ version: 2.39.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: mechanize
99
99
  requirement: !ruby/object:Gem::Requirement