ae_page_objects 2.0.0 → 2.0.1
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/lib/ae_page_objects/elements/collection.rb +29 -7
- data/lib/ae_page_objects/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 37647af3548c32ece7a0c1097ea2f76cdadb9257
|
4
|
+
data.tar.gz: bb6472c8b228dec715c2bab1b3d5ce8186eea420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6324e07193b89af313304a1fa1847e308f0231551dea1748c579bb9461a0ab25799ed9f7c0f5b8dabc213773b1cd55a24f51d7d6a551d00a2a6cc3a4597c87ee
|
7
|
+
data.tar.gz: 919e40103c069c3f2c7938afcdec2a15926b0a3ec5dc1fddd9bf7a57fd77391e9b73554fdece836ae93dc7780251cb0b7dbed2c6df0b01ff560423f1fe2d9edd
|
@@ -35,13 +35,13 @@ module AePageObjects
|
|
35
35
|
end
|
36
36
|
|
37
37
|
def each
|
38
|
-
|
39
|
-
yield
|
38
|
+
size.times do |index|
|
39
|
+
yield item_at(index)
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
def size
|
44
|
-
node.all(:xpath, item_xpath).size
|
44
|
+
node.all(:xpath, item_xpath, options).size
|
45
45
|
end
|
46
46
|
|
47
47
|
def last
|
@@ -56,6 +56,11 @@ module AePageObjects
|
|
56
56
|
@item_locator = options.delete(:item_locator) || default_item_locator
|
57
57
|
end
|
58
58
|
|
59
|
+
def options
|
60
|
+
evaled_locator = eval_locator(@item_locator)
|
61
|
+
evaled_locator.last.is_a?(::Hash) ? evaled_locator.last.dup : {}
|
62
|
+
end
|
63
|
+
|
59
64
|
def item_at(index)
|
60
65
|
element(is: item_class_at(index), name: index, locator: item_locator_at(index))
|
61
66
|
end
|
@@ -66,9 +71,26 @@ module AePageObjects
|
|
66
71
|
|
67
72
|
def item_xpath
|
68
73
|
@item_xpath ||= begin
|
69
|
-
|
70
|
-
|
71
|
-
query_args
|
74
|
+
query_args = eval_locator(@item_locator).dup
|
75
|
+
|
76
|
+
if query_args.first.to_sym == :xpath
|
77
|
+
#
|
78
|
+
# Use the { exact: true } setting for XPath selectors that use "XPath.is". For example, given the XPath
|
79
|
+
# XPath::HTML.descendant(:div)[XPath.text.is('Example Text')]
|
80
|
+
# the resulting path will be
|
81
|
+
# .//div[./text() = 'Example Text']
|
82
|
+
# instead of
|
83
|
+
# .//div[contains(./text(), 'Example Text')]
|
84
|
+
# See https://github.com/jnicklas/capybara#exactness for more information.
|
85
|
+
#
|
86
|
+
default_options = {:exact => true}
|
87
|
+
if query_args.last.is_a?(::Hash)
|
88
|
+
query_args[-1] = default_options.merge(query_args.last)
|
89
|
+
else
|
90
|
+
query_args.push(default_options)
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
72
94
|
query = Capybara::Query.new(*query_args)
|
73
95
|
|
74
96
|
result = query.xpath
|
@@ -84,7 +106,7 @@ module AePageObjects
|
|
84
106
|
end
|
85
107
|
|
86
108
|
def item_locator_at(index)
|
87
|
-
[:xpath, "#{item_xpath}[#{index + 1}]"]
|
109
|
+
[:xpath, "#{item_xpath}[#{index + 1}]", options]
|
88
110
|
end
|
89
111
|
|
90
112
|
def default_item_locator
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ae_page_objects
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Donnie Tognazzini
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: capybara
|
@@ -80,7 +80,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
80
|
version: '0'
|
81
81
|
requirements: []
|
82
82
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.4.
|
83
|
+
rubygems_version: 2.4.5.1
|
84
84
|
signing_key:
|
85
85
|
specification_version: 4
|
86
86
|
summary: Capybara Page Objects pattern
|