page-object 2.2.3 → 2.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +9 -4
- data/lib/page-object/elements/table.rb +17 -0
- data/lib/page-object/page_populator.rb +43 -31
- data/lib/page-object/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: 74ccca073521956e4021906e6706540428334567
|
4
|
+
data.tar.gz: 7eadfca835d4d213bca0e48662b853046ccb0c55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6161215bfc4fe2b236632ee4d02f6dea0cd10b52ac2ca51993cbec00df754ccdba724f3fefdc5d5cd32d7265c095603c7cf056141ff3c5c47671ecf04d065bc0
|
7
|
+
data.tar.gz: '0434932392bb13c1814e3da9685d4d20bd7d750afa468218cb66c6ae915bc8ec0ce3d98403ae0c64adad162b2905a0a0cb0a08713caf9ad0986d79bdaa705cd0'
|
data/ChangeLog
CHANGED
@@ -1,4 +1,9 @@
|
|
1
|
-
Version 2.2.
|
1
|
+
Version 2.2.4 / 2017-9-23
|
2
|
+
* Enhancements
|
3
|
+
* Added the ability to get the values of a table column (Thanks sanvijay)
|
4
|
+
* Added the ability to populate sections with a nested entry from data_magic
|
5
|
+
|
6
|
+
Version 2.2.3 / 2017-8-30
|
2
7
|
* Enhancements
|
3
8
|
* Added the preceding_sibling method to Element
|
4
9
|
* Added the following_sibling method to Element
|
@@ -9,18 +14,18 @@ Version 2.2.3 / 2017-9-30
|
|
9
14
|
* Fixes
|
10
15
|
* Fixed issue that occurred when things were moved around in Watir 6.8
|
11
16
|
|
12
|
-
Version 2.2.2 / 2017-
|
17
|
+
Version 2.2.2 / 2017-8-25
|
13
18
|
* Fixes
|
14
19
|
* Fixed issue when using text for table index with special characters (Thanks Jason Phebus)
|
15
20
|
|
16
|
-
Version 2.2.1 / 2017-
|
21
|
+
Version 2.2.1 / 2017-8-22
|
17
22
|
* Enhancements
|
18
23
|
* Moved some functionality from PageObject to Watir (Thanks Titus Fortner)
|
19
24
|
* Fixes
|
20
25
|
* Fixed bug when selection option by text with populate_page_with (Thanks Jason Phebus)
|
21
26
|
* Fixed issue with wrapping the Selenium driver with Watir (Thanks Titus Fortner)
|
22
27
|
|
23
|
-
Version 2.2 / 2017-
|
28
|
+
Version 2.2 / 2017-7-4
|
24
29
|
* Enhancements
|
25
30
|
* when_visible and when_not_visible now wait for element to be present before checking
|
26
31
|
* populate_page_with can populate select_list using values (Thanks vveliev)
|
@@ -42,6 +42,16 @@ module PageObject
|
|
42
42
|
row_items.size
|
43
43
|
end
|
44
44
|
|
45
|
+
#
|
46
|
+
# Returns the Array of values(String) in a column for the index provided. Index
|
47
|
+
# is zero based. If the index provided is a String then it
|
48
|
+
# will be matched with the text from the header. The text can be a substring of the full header text.
|
49
|
+
#
|
50
|
+
def column_values(what)
|
51
|
+
idx = find_index_of_header(what)
|
52
|
+
idx && row_items.drop(1).collect { |row| row.cell(index: idx).text }
|
53
|
+
end
|
54
|
+
|
45
55
|
protected
|
46
56
|
|
47
57
|
def row_items
|
@@ -55,6 +65,13 @@ module PageObject
|
|
55
65
|
:children
|
56
66
|
end
|
57
67
|
|
68
|
+
def find_index_of_header(what)
|
69
|
+
return what if what.is_a? Integer
|
70
|
+
row_items[0].cells.find_index do |cell|
|
71
|
+
cell.text.include? Regexp.escape(what)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
58
75
|
def find_index(what)
|
59
76
|
return what if what.is_a? Integer
|
60
77
|
row_items.find_index do |row|
|
@@ -31,62 +31,74 @@ module PageObject
|
|
31
31
|
#
|
32
32
|
def populate_page_with(data)
|
33
33
|
data.each do |key, value|
|
34
|
-
|
35
|
-
|
36
|
-
populate_radiobutton(key, value) if is_radiobutton?(key) and is_enabled?(key)
|
37
|
-
populate_select_list(key, value) if is_select_list?(key)
|
38
|
-
populate_text(key, value) if is_text?(key) and is_enabled?(key)
|
34
|
+
populate_section(key, value) if value.is_a?(Hash)
|
35
|
+
populate_value(self, key, value)
|
39
36
|
end
|
40
37
|
end
|
41
38
|
|
42
39
|
private
|
40
|
+
|
41
|
+
def populate_section(section, data)
|
42
|
+
return unless self.respond_to? section
|
43
|
+
data.each do |key, value|
|
44
|
+
populate_value(self.send(section), key, value)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def populate_value(receiver, key, value)
|
49
|
+
populate_checkbox(receiver, key, value) if is_checkbox?(receiver, key) and is_enabled?(receiver, key)
|
50
|
+
populate_radiobuttongroup(receiver, key, value) if is_radiobuttongroup?(receiver, key)
|
51
|
+
populate_radiobutton(receiver, key, value) if is_radiobutton?(receiver, key) and is_enabled?(receiver, key)
|
52
|
+
populate_select_list(receiver, key, value) if is_select_list?(receiver, key)
|
53
|
+
populate_text(receiver, key, value) if is_text?(receiver, key) and is_enabled?(receiver, key)
|
54
|
+
end
|
43
55
|
|
44
|
-
def populate_text(key, value)
|
45
|
-
|
56
|
+
def populate_text(receiver, key, value)
|
57
|
+
receiver.send "#{key}=", value
|
46
58
|
end
|
47
59
|
|
48
|
-
def populate_checkbox(key, value)
|
49
|
-
return
|
50
|
-
|
60
|
+
def populate_checkbox(receiver, key, value)
|
61
|
+
return receiver.send "check_#{key}" if value
|
62
|
+
receiver.send "uncheck_#{key}"
|
51
63
|
end
|
52
64
|
|
53
|
-
def populate_radiobutton(key, value)
|
54
|
-
|
65
|
+
def populate_radiobutton(receiver, key, value)
|
66
|
+
receiver.send "select_#{key}" if value
|
55
67
|
end
|
56
68
|
|
57
|
-
def populate_radiobuttongroup(key, value)
|
58
|
-
|
69
|
+
def populate_radiobuttongroup(receiver, key, value)
|
70
|
+
receiver.send("select_#{key}", value)
|
59
71
|
end
|
60
72
|
|
61
|
-
def populate_select_list(key, value)
|
62
|
-
|
73
|
+
def populate_select_list(receiver, key, value)
|
74
|
+
receiver.send "#{key}=", value
|
63
75
|
end
|
64
76
|
|
65
|
-
def is_text?(key)
|
66
|
-
return false if is_select_list?(key)
|
67
|
-
respond_to?("#{key}=".to_sym)
|
77
|
+
def is_text?(receiver, key)
|
78
|
+
return false if is_select_list?(receiver, key)
|
79
|
+
receiver.respond_to?("#{key}=".to_sym)
|
68
80
|
end
|
69
81
|
|
70
|
-
def is_checkbox?(key)
|
71
|
-
respond_to?("check_#{key}".to_sym)
|
82
|
+
def is_checkbox?(receiver, key)
|
83
|
+
receiver.respond_to?("check_#{key}".to_sym)
|
72
84
|
end
|
73
85
|
|
74
|
-
def is_radiobutton?(key)
|
75
|
-
respond_to?("select_#{key}".to_sym)
|
86
|
+
def is_radiobutton?(receiver, key)
|
87
|
+
receiver.respond_to?("select_#{key}".to_sym)
|
76
88
|
end
|
77
89
|
|
78
|
-
def is_radiobuttongroup?(key)
|
79
|
-
respond_to?("select_#{key}".to_sym) and respond_to?("#{key}_values")
|
90
|
+
def is_radiobuttongroup?(receiver, key)
|
91
|
+
receiver.respond_to?("select_#{key}".to_sym) and receiver.respond_to?("#{key}_values")
|
80
92
|
end
|
81
93
|
|
82
|
-
def is_select_list?(key)
|
83
|
-
respond_to?("#{key}_options".to_sym)
|
94
|
+
def is_select_list?(receiver, key)
|
95
|
+
receiver.respond_to?("#{key}_options".to_sym)
|
84
96
|
end
|
85
97
|
|
86
|
-
def is_enabled?(key)
|
87
|
-
return false if is_radiobuttongroup?(key)
|
88
|
-
return true if (
|
89
|
-
element =
|
98
|
+
def is_enabled?(receiver, key)
|
99
|
+
return false if is_radiobuttongroup?(receiver, key)
|
100
|
+
return true if (receiver.send "#{key}_element").tag_name == "textarea"
|
101
|
+
element = receiver.send("#{key}_element")
|
90
102
|
element.enabled? and element.visible?
|
91
103
|
end
|
92
104
|
end
|
data/lib/page-object/version.rb
CHANGED
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.
|
4
|
+
version: 2.2.4
|
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-
|
12
|
+
date: 2017-09-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: watir
|
@@ -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.6.
|
247
|
+
rubygems_version: 2.6.13
|
248
248
|
signing_key:
|
249
249
|
specification_version: 4
|
250
250
|
summary: Page Object DSL for browser testing
|