testcentricity_web 4.3.1 → 4.4.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/CHANGELOG.md +42 -12
- data/LICENSE.md +1 -1
- data/README.md +1794 -697
- data/lib/devices/devices.yml +144 -216
- data/lib/testcentricity_web/browser_helper.rb +33 -4
- data/lib/testcentricity_web/data_objects/environment.rb +96 -13
- data/lib/testcentricity_web/exception_queue_helper.rb +5 -6
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +53 -49
- data/lib/testcentricity_web/web_core/page_objects_helper.rb +20 -11
- data/lib/testcentricity_web/web_core/page_section.rb +31 -34
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +379 -252
- data/lib/testcentricity_web/web_elements/audio.rb +6 -4
- data/lib/testcentricity_web/web_elements/button.rb +7 -4
- data/lib/testcentricity_web/web_elements/checkbox.rb +149 -147
- data/lib/testcentricity_web/web_elements/file_field.rb +38 -36
- data/lib/testcentricity_web/web_elements/image.rb +75 -70
- data/lib/testcentricity_web/web_elements/label.rb +6 -4
- data/lib/testcentricity_web/web_elements/link.rb +15 -13
- data/lib/testcentricity_web/web_elements/list.rb +171 -169
- data/lib/testcentricity_web/web_elements/media.rb +384 -379
- data/lib/testcentricity_web/web_elements/radio.rb +135 -133
- data/lib/testcentricity_web/web_elements/range.rb +16 -29
- data/lib/testcentricity_web/web_elements/select_list.rb +247 -245
- data/lib/testcentricity_web/web_elements/table.rb +575 -573
- data/lib/testcentricity_web/web_elements/textfield.rb +143 -139
- data/lib/testcentricity_web/web_elements/ui_element.rb +1171 -0
- data/lib/testcentricity_web/web_elements/video.rb +39 -37
- data/lib/testcentricity_web/world_extensions.rb +37 -4
- data/lib/testcentricity_web.rb +4 -23
- metadata +28 -80
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +0 -1148
@@ -1,163 +1,165 @@
|
|
1
1
|
module TestCentricity
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
2
|
+
module Elements
|
3
|
+
class Radio < UIElement
|
4
|
+
attr_accessor :proxy
|
5
|
+
attr_accessor :label
|
6
|
+
attr_accessor :input
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
8
|
+
def initialize(name, parent, locator, context)
|
9
|
+
super
|
10
|
+
@type = :radio
|
11
|
+
radio_spec = {
|
12
|
+
input: nil,
|
13
|
+
proxy: nil,
|
14
|
+
label: nil
|
15
|
+
}
|
16
|
+
define_custom_elements(radio_spec)
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
19
|
+
def define_custom_elements(element_spec)
|
20
|
+
element_spec.each do |element, value|
|
21
|
+
case element
|
22
|
+
when :input
|
23
|
+
@input = value
|
24
|
+
when :proxy
|
25
|
+
@proxy = value
|
26
|
+
when :label
|
27
|
+
@label = value
|
28
|
+
else
|
29
|
+
raise "#{element} is not a recognized radio element"
|
30
|
+
end
|
29
31
|
end
|
30
32
|
end
|
31
|
-
end
|
32
|
-
|
33
|
-
# Does radio button object exists?
|
34
|
-
#
|
35
|
-
# @return [Boolean]
|
36
|
-
# @example
|
37
|
-
# accept_terms_radio.exists?
|
38
|
-
#
|
39
|
-
def exists?
|
40
|
-
obj, = find_object(:all)
|
41
|
-
obj != nil
|
42
|
-
end
|
43
|
-
|
44
|
-
# Is radio button selected?
|
45
|
-
#
|
46
|
-
# @return [Boolean]
|
47
|
-
# @example
|
48
|
-
# accept_terms_radio.selected?
|
49
|
-
#
|
50
|
-
def selected?
|
51
|
-
@base_object, = find_element(:all)
|
52
|
-
object_not_found_exception(@base_object, 'Radio')
|
53
|
-
rad = if @input.nil?
|
54
|
-
@base_object
|
55
|
-
else
|
56
|
-
find_component(@input, 'Radio')
|
57
|
-
end
|
58
|
-
rad.checked?
|
59
|
-
end
|
60
33
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
else
|
71
|
-
@base_object, = find_element(:all)
|
72
|
-
object_not_found_exception(@base_object, 'Radio')
|
73
|
-
proxy = find_component(@proxy, 'radio proxy')
|
74
|
-
proxy.visible?
|
34
|
+
# Does radio button object exists?
|
35
|
+
#
|
36
|
+
# @return [Boolean]
|
37
|
+
# @example
|
38
|
+
# accept_terms_radio.exists?
|
39
|
+
#
|
40
|
+
def exists?
|
41
|
+
obj, = find_object(:all)
|
42
|
+
obj != nil
|
75
43
|
end
|
76
|
-
end
|
77
44
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
if @input.nil?
|
86
|
-
super
|
87
|
-
else
|
45
|
+
# Is radio button selected?
|
46
|
+
#
|
47
|
+
# @return [Boolean]
|
48
|
+
# @example
|
49
|
+
# accept_terms_radio.selected?
|
50
|
+
#
|
51
|
+
def selected?
|
88
52
|
@base_object, = find_element(:all)
|
89
53
|
object_not_found_exception(@base_object, 'Radio')
|
90
|
-
rad =
|
91
|
-
|
54
|
+
rad = if @input.nil?
|
55
|
+
@base_object
|
56
|
+
else
|
57
|
+
find_component(@input, 'Radio')
|
58
|
+
end
|
59
|
+
rad.checked?
|
92
60
|
end
|
93
|
-
end
|
94
61
|
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
if @label.nil?
|
62
|
+
# Is radio button visible?
|
63
|
+
#
|
64
|
+
# @return [Boolean]
|
65
|
+
# @example
|
66
|
+
# accept_terms_radio.visible?
|
67
|
+
#
|
68
|
+
def visible?
|
103
69
|
if @proxy.nil?
|
104
70
|
super
|
105
71
|
else
|
72
|
+
@base_object, = find_element(:all)
|
73
|
+
object_not_found_exception(@base_object, 'Radio')
|
106
74
|
proxy = find_component(@proxy, 'radio proxy')
|
107
|
-
proxy.
|
75
|
+
proxy.visible?
|
108
76
|
end
|
109
|
-
else
|
110
|
-
label = find_component(@label, 'radio label')
|
111
|
-
label.text
|
112
77
|
end
|
113
|
-
end
|
114
78
|
|
115
|
-
|
116
|
-
|
117
|
-
|
79
|
+
# Is radio button disabled (not enabled)?
|
80
|
+
#
|
81
|
+
# @return [Boolean]
|
82
|
+
# @example
|
83
|
+
# accept_terms_radio.disabled?
|
84
|
+
#
|
85
|
+
def disabled?
|
86
|
+
if @input.nil?
|
87
|
+
super
|
88
|
+
else
|
89
|
+
@base_object, = find_element(:all)
|
90
|
+
object_not_found_exception(@base_object, 'Radio')
|
91
|
+
rad = find_component(@input, 'radio')
|
92
|
+
rad.disabled?
|
93
|
+
end
|
94
|
+
end
|
118
95
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
96
|
+
# Return radio button caption
|
97
|
+
#
|
98
|
+
# @return [Boolean]
|
99
|
+
# @example
|
100
|
+
# accept_terms_radio.get_value
|
101
|
+
#
|
102
|
+
def get_value
|
103
|
+
if @label.nil?
|
104
|
+
if @proxy.nil?
|
105
|
+
super
|
106
|
+
else
|
107
|
+
proxy = find_component(@proxy, 'radio proxy')
|
108
|
+
proxy.text
|
109
|
+
end
|
133
110
|
else
|
134
|
-
|
111
|
+
label = find_component(@label, 'radio label')
|
112
|
+
label.text
|
135
113
|
end
|
136
|
-
|
137
|
-
|
138
|
-
|
114
|
+
end
|
115
|
+
|
116
|
+
alias get_caption get_value
|
117
|
+
alias caption get_value
|
118
|
+
alias value get_value
|
119
|
+
|
120
|
+
# Set the select state of a radio button object.
|
121
|
+
#
|
122
|
+
# @param state [Boolean] true = selected / false = unselected
|
123
|
+
# @example
|
124
|
+
# accept_terms_radio.set_selected_state(true)
|
125
|
+
#
|
126
|
+
def set_selected_state(state)
|
127
|
+
@base_object, = find_element(:all)
|
128
|
+
object_not_found_exception(@base_object, 'Radio')
|
129
|
+
proxy = find_component(@proxy, 'radio proxy') unless @proxy.nil?
|
130
|
+
rad = find_component(@input, 'radio') unless @input.nil?
|
131
|
+
if @input.nil?
|
132
|
+
if @proxy.nil?
|
133
|
+
@base_object.click unless state == @base_object.checked?
|
134
|
+
else
|
135
|
+
proxy.click unless state == @base_object.checked?
|
136
|
+
end
|
139
137
|
else
|
140
|
-
proxy.
|
138
|
+
if @proxy.nil?
|
139
|
+
@base_object.click unless state == rad.checked?
|
140
|
+
else
|
141
|
+
proxy.click unless state == rad.checked?
|
142
|
+
end
|
141
143
|
end
|
142
144
|
end
|
143
|
-
end
|
144
145
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
146
|
+
# Set the selected state of a radio button object.
|
147
|
+
#
|
148
|
+
# @example
|
149
|
+
# accept_terms_radio.select
|
150
|
+
#
|
151
|
+
def select
|
152
|
+
set_selected_state(true)
|
153
|
+
end
|
153
154
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
155
|
+
# Unselect a radio button object.
|
156
|
+
#
|
157
|
+
# @example
|
158
|
+
# accept_terms_radio.unselect
|
159
|
+
#
|
160
|
+
def unselect
|
161
|
+
set_selected_state(state = false)
|
162
|
+
end
|
161
163
|
end
|
162
164
|
end
|
163
165
|
end
|
@@ -1,34 +1,21 @@
|
|
1
1
|
module TestCentricity
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
# Set the value property of a range type input object.
|
9
|
-
#
|
10
|
-
# @param value [Integer]
|
11
|
-
# @example
|
12
|
-
# volume_level.value = 11
|
13
|
-
#
|
14
|
-
def value=(value)
|
15
|
-
obj, = find_element
|
16
|
-
object_not_found_exception(obj, nil)
|
17
|
-
page.execute_script('arguments[0].value = arguments[1]', obj, value)
|
18
|
-
obj.send_keys(:right)
|
19
|
-
end
|
2
|
+
module Elements
|
3
|
+
class Range < TextField
|
4
|
+
def initialize(name, parent, locator, context)
|
5
|
+
super
|
6
|
+
@type = :range
|
7
|
+
end
|
20
8
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
result
|
9
|
+
def get_value(visible = true)
|
10
|
+
obj, type = find_element(visible)
|
11
|
+
object_not_found_exception(obj, type)
|
12
|
+
result = obj.value
|
13
|
+
unless result.blank?
|
14
|
+
if result.is_int?
|
15
|
+
result.to_i
|
16
|
+
else
|
17
|
+
result
|
18
|
+
end
|
32
19
|
end
|
33
20
|
end
|
34
21
|
end
|