watirsome 0.2.1 → 0.2.2

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: 5fa8e7d26089505c8a179c6f73902bd3dd7db057
4
- data.tar.gz: 90136197a30af82840ff96b2732dfc7b067ec4bb
3
+ metadata.gz: 1e39235eeb56b45caf40f4bc865c68b057693b8b
4
+ data.tar.gz: 3f927cee87c1102d922343cde661d0489c395aa2
5
5
  SHA512:
6
- metadata.gz: ad061961a128224953286fef6302d4da1d537312fcc528c93466c300696a23652673508380c1b451e07db4adb448e9def4b1fbcd514de0d17cf723351b7be607
7
- data.tar.gz: c77dd3c4fdae2a45e30a6a8f285c8b13c06f7c4689e543367726f022c9436720fc3b2ff3a383f3f144bf07da59cd682e76cbaf6e9f0453a5a0d59c23606068ce
6
+ metadata.gz: 8da3589cb73b360546f9671ce16be55d7ee5ae0aaf21830d35936cacb85bbf92d02f9dc88d6a176ac535e920f3e92c5df1a1df4f714ffe2df2a6e9f1447cebee
7
+ data.tar.gz: 0ffe8c1fad560e53cc457533c72ae9bb684d8a9fea599f105367fa16226b15e03ec19a0a1269150a18207f39374c8a43370832774a3e2a64e9336ec05ade30e9
@@ -1,3 +1,11 @@
1
+ ### v0.2.2
2
+
3
+ * Nothing new, just improvements in codebase
4
+
5
+ ### v0.2.1
6
+
7
+ * Delegate `:visible` selector to Watir 6 which supports it natively
8
+
1
9
  ### v0.2.0
2
10
 
3
11
  * Update watirsome for Watir 6
@@ -55,12 +55,12 @@
55
55
  # page.agree = true
56
56
  # page.agree #=> true
57
57
  #
58
- # @example Locators
58
+ # @example Custom Locators
59
59
  # class Page
60
60
  # include Watirsome
61
61
  #
62
- # div :visible, class: 'visible', visible: true
63
- # div :invisible, class: 'visible', visible: false
62
+ # div :visible, class: 'visibility', visible: true
63
+ # div :invisible, class: 'visibility', visible: false
64
64
  # select_list :country, selected: 'USA'
65
65
  # end
66
66
  #
@@ -154,28 +154,25 @@ module Watirsome
154
154
  #
155
155
  # @param [Symbol, String] method
156
156
  # @param [Array] args
157
- # @return Two arrays: Watir locators and custom locators
157
+ # @return [Array<Hash>] two hashes: watir locators and custom locators
158
158
  # @api private
159
159
  #
160
160
  def extract_custom_args(method, *args)
161
161
  identifier = args.shift
162
- watir_args = []
163
- custom_args = []
162
+ watir_args = {}
163
+ custom_args = {}
164
+
164
165
  identifier.each_with_index do |hashes, index|
165
- watir_arg = {}
166
- custom_arg = {}
167
- if hashes && !hashes.is_a?(Proc)
168
- hashes.each do |k, v|
169
- element_methods = Watir.element_class_for(method).instance_methods
170
- if element_methods.include?(:"#{k}?") && !SKIP_CUSTOM_SELECTORS.include?(k)
171
- custom_arg[k] = identifier[index][k]
172
- else
173
- watir_arg[k] = v
174
- end
166
+ next if hashes.nil? || hashes.is_a?(Proc)
167
+
168
+ hashes.each do |k, v|
169
+ element_methods = Watir.element_class_for(method).instance_methods
170
+ if element_methods.include?(:"#{k}?") && !SKIP_CUSTOM_SELECTORS.include?(k)
171
+ custom_args[k] = identifier[index][k]
172
+ else
173
+ watir_args[k] = v
175
174
  end
176
175
  end
177
- watir_args << watir_arg unless watir_arg.empty?
178
- custom_args << custom_arg unless custom_arg.empty?
179
176
  end
180
177
 
181
178
  [watir_args, custom_args]
@@ -189,18 +186,18 @@ module Watirsome
189
186
  # Calls Watir browser instance to find element.
190
187
  #
191
188
  # @param [Symbol] method Watir method
192
- # @param [Array] watir_args Watir locators
193
- # @param [Array] custom_args Custom locators
189
+ # @param [Hash] watir_args Watir locators
190
+ # @param [Hash] custom_args Custom locators
194
191
  # @api private
195
192
  #
196
193
  def grab_elements(method, watir_args, custom_args)
197
194
  if custom_args.empty?
198
- @browser.__send__(method, *watir_args)
195
+ @browser.__send__(method, watir_args)
199
196
  else
200
197
  plural = Watirsome.plural?(method)
201
198
  method = Watirsome.pluralize(method) unless plural
202
- elements = @browser.__send__(method, *watir_args)
203
- custom_args.first.each do |k, v|
199
+ elements = @browser.__send__(method, watir_args)
200
+ custom_args.each do |k, v|
204
201
  elements.to_a.select! do |e|
205
202
  if e.public_method(:"#{k}?").arity.zero?
206
203
  e.__send__(:"#{k}?") == v
@@ -1,3 +1,3 @@
1
1
  module Watirsome
2
- VERSION = '0.2.1'.freeze
2
+ VERSION = '0.2.2'.freeze
3
3
  end # Watirsome
@@ -13,8 +13,8 @@
13
13
  <input type="radio" name="sex" value="Female">
14
14
  </div>
15
15
  <div>
16
- <div class="visible">Visible</div>
17
- <div class="visible" style="display: none">Invisible</div>
16
+ <div class="visibility">Visible</div>
17
+ <div class="visibility" style="display: none">Invisible</div>
18
18
  </div>
19
19
  </body>
20
20
  </html>
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watirsome
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alex Rodionov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-01-14 00:00:00.000000000 Z
11
+ date: 2017-01-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: watir
@@ -112,4 +112,3 @@ signing_key:
112
112
  specification_version: 4
113
113
  summary: Awesome page objects with Watir
114
114
  test_files: []
115
- has_rdoc: