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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 07b1aa2d9ab91e3a68f304324dd9dc0cdcbebed7
4
- data.tar.gz: 13159dd12b104dc829e8c6450abd1c2424e008ef
3
+ metadata.gz: 37647af3548c32ece7a0c1097ea2f76cdadb9257
4
+ data.tar.gz: bb6472c8b228dec715c2bab1b3d5ce8186eea420
5
5
  SHA512:
6
- metadata.gz: a3b15a9735cd27e4469fdb91e9e2b45915be6c3d25be77245c1ec029f299d68052d441a474276a4ecef78674c5bf285f9fca238f8d51d0f9d0b697fa6e24c7b6
7
- data.tar.gz: d0a87ab50beee65b9354a637cb6f66a7e0e350750548dac3ada72be78dac3b557921fb980714f4d8e9c62108c22b9d35f3529aa85c805c13073fcdd5ea97a826
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
- (0..(size - 1)).each do |index|
39
- yield at(index)
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
- evaled_locator = eval_locator(@item_locator)
70
-
71
- query_args = evaled_locator + [{:exact => true}]
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
@@ -1,3 +1,3 @@
1
1
  module AePageObjects
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
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.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-06-08 00:00:00.000000000 Z
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.3
83
+ rubygems_version: 2.4.5.1
84
84
  signing_key:
85
85
  specification_version: 4
86
86
  summary: Capybara Page Objects pattern