testcentricity_web 4.3.1 → 4.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +42 -12
  3. data/LICENSE.md +1 -1
  4. data/README.md +1794 -697
  5. data/lib/devices/devices.yml +144 -216
  6. data/lib/testcentricity_web/browser_helper.rb +33 -4
  7. data/lib/testcentricity_web/data_objects/environment.rb +96 -13
  8. data/lib/testcentricity_web/exception_queue_helper.rb +5 -6
  9. data/lib/testcentricity_web/version.rb +1 -1
  10. data/lib/testcentricity_web/web_core/page_object.rb +53 -49
  11. data/lib/testcentricity_web/web_core/page_objects_helper.rb +20 -11
  12. data/lib/testcentricity_web/web_core/page_section.rb +31 -34
  13. data/lib/testcentricity_web/web_core/webdriver_helper.rb +379 -252
  14. data/lib/testcentricity_web/web_elements/audio.rb +6 -4
  15. data/lib/testcentricity_web/web_elements/button.rb +7 -4
  16. data/lib/testcentricity_web/web_elements/checkbox.rb +149 -147
  17. data/lib/testcentricity_web/web_elements/file_field.rb +38 -36
  18. data/lib/testcentricity_web/web_elements/image.rb +75 -70
  19. data/lib/testcentricity_web/web_elements/label.rb +6 -4
  20. data/lib/testcentricity_web/web_elements/link.rb +15 -13
  21. data/lib/testcentricity_web/web_elements/list.rb +171 -169
  22. data/lib/testcentricity_web/web_elements/media.rb +384 -379
  23. data/lib/testcentricity_web/web_elements/radio.rb +135 -133
  24. data/lib/testcentricity_web/web_elements/range.rb +16 -29
  25. data/lib/testcentricity_web/web_elements/select_list.rb +247 -245
  26. data/lib/testcentricity_web/web_elements/table.rb +575 -573
  27. data/lib/testcentricity_web/web_elements/textfield.rb +143 -139
  28. data/lib/testcentricity_web/web_elements/ui_element.rb +1171 -0
  29. data/lib/testcentricity_web/web_elements/video.rb +39 -37
  30. data/lib/testcentricity_web/world_extensions.rb +37 -4
  31. data/lib/testcentricity_web.rb +4 -23
  32. metadata +28 -80
  33. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +0 -1148
@@ -1,163 +1,165 @@
1
1
  module TestCentricity
2
- class Radio < UIElement
3
- attr_accessor :proxy
4
- attr_accessor :label
5
- attr_accessor :input
2
+ module Elements
3
+ class Radio < UIElement
4
+ attr_accessor :proxy
5
+ attr_accessor :label
6
+ attr_accessor :input
6
7
 
7
- def initialize(name, parent, locator, context)
8
- super
9
- @type = :radio
10
- radio_spec = {
11
- input: nil,
12
- proxy: nil,
13
- label: nil
14
- }
15
- define_custom_elements(radio_spec)
16
- end
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
- def define_custom_elements(element_spec)
19
- element_spec.each do |element, value|
20
- case element
21
- when :input
22
- @input = value
23
- when :proxy
24
- @proxy = value
25
- when :label
26
- @label = value
27
- else
28
- raise "#{element} is not a recognized radio element"
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
- # Is radio button visible?
62
- #
63
- # @return [Boolean]
64
- # @example
65
- # accept_terms_radio.visible?
66
- #
67
- def visible?
68
- if @proxy.nil?
69
- super
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
- # Is radio button disabled (not enabled)?
79
- #
80
- # @return [Boolean]
81
- # @example
82
- # accept_terms_radio.disabled?
83
- #
84
- def disabled?
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 = find_component(@input, 'radio')
91
- rad.disabled?
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
- # Return radio button caption
96
- #
97
- # @return [Boolean]
98
- # @example
99
- # accept_terms_radio.get_value
100
- #
101
- def get_value
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.text
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
- alias get_caption get_value
116
- alias caption get_value
117
- alias value get_value
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
- # Set the select state of a radio button object.
120
- #
121
- # @param state [Boolean] true = selected / false = unselected
122
- # @example
123
- # accept_terms_radio.set_selected_state(true)
124
- #
125
- def set_selected_state(state)
126
- @base_object, = find_element(:all)
127
- object_not_found_exception(@base_object, 'Radio')
128
- proxy = find_component(@proxy, 'radio proxy') unless @proxy.nil?
129
- rad = find_component(@input, 'radio') unless @input.nil?
130
- if @input.nil?
131
- if @proxy.nil?
132
- @base_object.click unless state == @base_object.checked?
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
- proxy.click unless state == @base_object.checked?
111
+ label = find_component(@label, 'radio label')
112
+ label.text
135
113
  end
136
- else
137
- if @proxy.nil?
138
- @base_object.click unless state == rad.checked?
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.click unless state == rad.checked?
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
- # Set the selected state of a radio button object.
146
- #
147
- # @example
148
- # accept_terms_radio.select
149
- #
150
- def select
151
- set_selected_state(true)
152
- end
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
- # Unselect a radio button object.
155
- #
156
- # @example
157
- # accept_terms_radio.unselect
158
- #
159
- def unselect
160
- set_selected_state(state = false)
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
- class Range < TextField
3
- def initialize(name, parent, locator, context)
4
- super
5
- @type = :range
6
- end
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
- def get_value(visible = true)
22
- obj, type = find_element(visible)
23
- object_not_found_exception(obj, type)
24
- result = obj.value
25
- unless result.blank?
26
- if result.is_int?
27
- result.to_i
28
- elsif result.is_float?
29
- result.to_f
30
- else
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