page-object 2.2.2 → 2.2.3

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: ec336cbd489a527cd92bb76d7a5550cae76b8f5e
4
- data.tar.gz: 46cf833d65c1e5b914d637c199e776e7b1779de9
3
+ metadata.gz: 869bfee3bb2a4b6e040dbdd45149231a865c3b95
4
+ data.tar.gz: d24b805051142ebb5be29b6093071d5f6373341c
5
5
  SHA512:
6
- metadata.gz: 8d87477f85fa75995b164492352c2fc7aa0a32c5d444c162d121dcc0595f14272d128fa78d154add976ad858351c94b31405ed2e2a47e2c5312369870254c519
7
- data.tar.gz: e8ca44ef832280d0e200180fd1096bf467211d415961b413e874db3a06abaafbf885749264b0103852e7faf8e7c70686f6cbc5c5939db03f81c9e00a02436bcb
6
+ metadata.gz: 1831c81fe896bca1747c266502d57bcd9659a8da13bd28ee6731eb79506e588e0cd7634ee7851274bedf362a7618036a947094a2e0c5acee8abbaff18e3f167c
7
+ data.tar.gz: 99b52bce53230897b097ea66a0748fb3d8f26d3991605980792718b969265223b38e5235512d03ab54c511b26b68ee73e89b8a99d9d7a2b5df21b8612f9aedd3
data/ChangeLog CHANGED
@@ -1,3 +1,14 @@
1
+ Version 2.2.3 / 2017-9-30
2
+ * Enhancements
3
+ * Added the preceding_sibling method to Element
4
+ * Added the following_sibling method to Element
5
+ * Added the siblings method to Element
6
+ * Added the children method to Element
7
+ * Added the preceding_siblings method to Element
8
+ * Added the following_siblings method to Element
9
+ * Fixes
10
+ * Fixed issue that occurred when things were moved around in Watir 6.8
11
+
1
12
  Version 2.2.2 / 2017-9-25
2
13
  * Fixes
3
14
  * Fixed issue when using text for table index with special characters (Thanks Jason Phebus)
@@ -1,5 +1,4 @@
1
1
  require 'page-object/nested_elements'
2
- require 'watir/extensions/select_text'
3
2
 
4
3
  module PageObject
5
4
  module Elements
@@ -70,9 +69,59 @@ module PageObject
70
69
  #
71
70
  def parent(opt = {})
72
71
  parent = element.parent(opt)
73
- type = element.type if parent.tag_name.to_sym == :input
74
- cls = ::PageObject::Elements.element_class_for(parent.tag_name, type)
75
- cls.new(parent.to_subtype)
72
+ pageobject_wrapper(parent)
73
+ end
74
+
75
+ #
76
+ # Return the element that exists at the same level of the DOM
77
+ # immediately prior to this element
78
+ #
79
+ def preceding_sibling(opt = {})
80
+ sibling = element.preceding_sibling(opt)
81
+ pageobject_wrapper(sibling)
82
+ end
83
+
84
+ #
85
+ # Return the element that exists at the same level of the DOM
86
+ # immediately after this element
87
+ #
88
+ def following_sibling(opt={})
89
+ sibling = element.following_sibling(opt)
90
+ pageobject_wrapper(sibling)
91
+ end
92
+
93
+ #
94
+ # Return all elements that are direct children of this element's parent
95
+ #
96
+ def siblings(opt={})
97
+ siblings = element.siblings(opt)
98
+ siblings.collect {|sibling| pageobject_wrapper(sibling)}
99
+ end
100
+
101
+ #
102
+ # Return all elements that are children of this element
103
+ #
104
+ def children(opt={})
105
+ children = element.children(opt)
106
+ children.collect {|child| pageobject_wrapper(child)}
107
+ end
108
+
109
+ #
110
+ # Return all elements that exist at the same level of the DOM
111
+ # immediately prior to this element
112
+ #
113
+ def preceding_siblings(opt={})
114
+ siblings = element.preceding_siblings(opt)
115
+ siblings.collect {|sibling| pageobject_wrapper(sibling)}
116
+ end
117
+
118
+ #
119
+ # Return all elements that exist at the same level of the DOM
120
+ # immediately after this element
121
+ #
122
+ def following_siblings(opt={})
123
+ siblings = element.following_siblings(opt)
124
+ siblings.collect {|sibling| pageobject_wrapper(sibling)}
76
125
  end
77
126
 
78
127
  #
@@ -142,6 +191,14 @@ module PageObject
142
191
  element.respond_to?(m) || super
143
192
  end
144
193
 
194
+ protected
195
+
196
+ def pageobject_wrapper(watir_object)
197
+ type = element.type if watir_object.tag_name.to_sym == :input
198
+ cls = ::PageObject::Elements.element_class_for(watir_object.tag_name, type)
199
+ cls.new(watir_object.to_subtype)
200
+ end
201
+
145
202
  private
146
203
 
147
204
  def timed_loop(timeout)
@@ -34,9 +34,7 @@ module PageObject
34
34
  # Return Array of ListItem objects that are children of the OrderedList
35
35
  #
36
36
  def list_items
37
- @list_items ||= children(tag_name: 'li').map do |obj|
38
- Object::PageObject::Elements::ListItem.new(obj)
39
- end
37
+ @list_items ||= children(tag_name: 'li')
40
38
  end
41
39
  end
42
40
 
@@ -33,9 +33,7 @@ module PageObject
33
33
  # Return Array of ListItem objects that are children of the UnorderedList
34
34
  #
35
35
  def list_items
36
- @list_items ||= children(tag_name: 'li').map do |obj|
37
- Object::PageObject::Elements::ListItem.new(obj)
38
- end
36
+ @list_items ||= children(tag_name: 'li')
39
37
  end
40
38
  end
41
39
 
@@ -59,9 +59,7 @@ module PageObject
59
59
  end
60
60
 
61
61
  def populate_select_list(key, value)
62
- select_element = self.send("#{key}_element")
63
- return select_element.select(value) if select_element.include?(value)
64
- select_element.select_value(value)
62
+ self.send "#{key}=", value
65
63
  end
66
64
 
67
65
  def is_text?(key)
@@ -1,4 +1,4 @@
1
1
  module PageObject
2
2
  # @private
3
- VERSION = "2.2.2"
3
+ VERSION = "2.2.3"
4
4
  end
@@ -17,7 +17,7 @@ Gem::Specification.new do |s|
17
17
  s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(pkg|spec|features|coverage)/}) }
18
18
  s.require_paths = ["lib"]
19
19
 
20
- s.add_dependency 'watir', '~> 6.7'
20
+ s.add_dependency 'watir', '~> 6.8'
21
21
  s.add_dependency 'selenium-webdriver', '~> 3.0'
22
22
  s.add_dependency 'page_navigation', '>= 0.10'
23
23
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: page-object
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2
4
+ version: 2.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Morgan
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-25 00:00:00.000000000 Z
12
+ date: 2017-08-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: watir
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: '6.7'
20
+ version: '6.8'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: '6.7'
27
+ version: '6.8'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: selenium-webdriver
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -244,7 +244,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
244
244
  version: '0'
245
245
  requirements: []
246
246
  rubyforge_project:
247
- rubygems_version: 2.5.2
247
+ rubygems_version: 2.6.11
248
248
  signing_key:
249
249
  specification_version: 4
250
250
  summary: Page Object DSL for browser testing