watirsome 0.2.1 → 0.2.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/lib/watirsome.rb +3 -3
- data/lib/watirsome/accessors.rb +17 -20
- data/lib/watirsome/version.rb +1 -1
- data/support/doctest.html +2 -2
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e39235eeb56b45caf40f4bc865c68b057693b8b
|
4
|
+
data.tar.gz: 3f927cee87c1102d922343cde661d0489c395aa2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8da3589cb73b360546f9671ce16be55d7ee5ae0aaf21830d35936cacb85bbf92d02f9dc88d6a176ac535e920f3e92c5df1a1df4f714ffe2df2a6e9f1447cebee
|
7
|
+
data.tar.gz: 0ffe8c1fad560e53cc457533c72ae9bb684d8a9fea599f105367fa16226b15e03ec19a0a1269150a18207f39374c8a43370832774a3e2a64e9336ec05ade30e9
|
data/CHANGELOG.md
CHANGED
data/lib/watirsome.rb
CHANGED
@@ -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: '
|
63
|
-
# div :invisible, class: '
|
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
|
#
|
data/lib/watirsome/accessors.rb
CHANGED
@@ -154,28 +154,25 @@ module Watirsome
|
|
154
154
|
#
|
155
155
|
# @param [Symbol, String] method
|
156
156
|
# @param [Array] args
|
157
|
-
# @return
|
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
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
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 [
|
193
|
-
# @param [
|
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,
|
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,
|
203
|
-
custom_args.
|
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
|
data/lib/watirsome/version.rb
CHANGED
data/support/doctest.html
CHANGED
@@ -13,8 +13,8 @@
|
|
13
13
|
<input type="radio" name="sex" value="Female">
|
14
14
|
</div>
|
15
15
|
<div>
|
16
|
-
<div class="
|
17
|
-
<div class="
|
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.
|
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-
|
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:
|