testcentricity_web 4.0.2 → 4.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +59 -2
- data/LICENSE.md +1 -1
- data/README.md +211 -391
- data/lib/testcentricity_web/appium_server.rb +1 -1
- data/lib/testcentricity_web/data_objects/environment.rb +27 -9
- data/lib/testcentricity_web/exception_queue_helper.rb +5 -5
- data/lib/testcentricity_web/version.rb +1 -1
- data/lib/testcentricity_web/web_core/page_object.rb +18 -20
- data/lib/testcentricity_web/web_core/page_section.rb +19 -21
- data/lib/testcentricity_web/web_core/webdriver_helper.rb +348 -372
- data/lib/testcentricity_web/web_elements/checkbox.rb +33 -32
- data/lib/testcentricity_web/web_elements/radio.rb +33 -32
- data/lib/testcentricity_web/web_elements/select_list.rb +0 -14
- data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +17 -1
- data/lib/testcentricity_web.rb +0 -1
- data/testcentricity_web.gemspec +7 -8
- metadata +21 -16
@@ -1,16 +1,29 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class CheckBox < UIElement
|
3
3
|
attr_accessor :proxy
|
4
|
+
attr_accessor :label
|
4
5
|
|
5
|
-
def initialize(name, parent, locator, context
|
6
|
-
|
7
|
-
@
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
def initialize(name, parent, locator, context)
|
7
|
+
super
|
8
|
+
@type = :checkbox
|
9
|
+
check_spec = {
|
10
|
+
proxy: nil,
|
11
|
+
label: nil
|
12
|
+
}
|
13
|
+
define_custom_elements(check_spec)
|
14
|
+
end
|
15
|
+
|
16
|
+
def define_custom_elements(element_spec)
|
17
|
+
element_spec.each do |element, value|
|
18
|
+
case element
|
19
|
+
when :proxy
|
20
|
+
@proxy = value
|
21
|
+
when :label
|
22
|
+
@label = value
|
23
|
+
else
|
24
|
+
raise "#{element} is not a recognized checkbox element"
|
25
|
+
end
|
26
|
+
end
|
14
27
|
end
|
15
28
|
|
16
29
|
# Does checkbox object exists?
|
@@ -54,7 +67,7 @@ module TestCentricity
|
|
54
67
|
# remember_me_checkbox.visible?
|
55
68
|
#
|
56
69
|
def visible?
|
57
|
-
@proxy.nil? ? super : @proxy.visible?
|
70
|
+
@proxy.nil? ? super : page.find(:css, @proxy).visible?
|
58
71
|
end
|
59
72
|
|
60
73
|
# Is checkbox disabled (not enabled)?
|
@@ -77,9 +90,17 @@ module TestCentricity
|
|
77
90
|
# remember_me_checkbox.get_value
|
78
91
|
#
|
79
92
|
def get_value
|
80
|
-
@
|
93
|
+
if @label.nil?
|
94
|
+
@proxy.nil? ? super : page.find(:css, @proxy).text
|
95
|
+
else
|
96
|
+
page.find(:css, @label).text
|
97
|
+
end
|
81
98
|
end
|
82
99
|
|
100
|
+
alias get_caption get_value
|
101
|
+
alias caption get_value
|
102
|
+
alias value get_value
|
103
|
+
|
83
104
|
# Set the check state of a checkbox object.
|
84
105
|
#
|
85
106
|
# @param state [Boolean] true = checked / false = unchecked
|
@@ -98,7 +119,7 @@ module TestCentricity
|
|
98
119
|
obj.set(state)
|
99
120
|
end
|
100
121
|
else
|
101
|
-
@proxy.click unless state == obj.checked?
|
122
|
+
page.find(:css, @proxy).click unless state == obj.checked?
|
102
123
|
end
|
103
124
|
end
|
104
125
|
|
@@ -126,25 +147,5 @@ module TestCentricity
|
|
126
147
|
ExceptionQueue.enqueue_assert_equal(state, actual, "Expected checkbox #{object_ref_message}") :
|
127
148
|
assert_equal(state, actual, "Expected checkbox #{object_ref_message} to be #{state} but found #{actual} instead")
|
128
149
|
end
|
129
|
-
|
130
|
-
# Highlight a checkbox with a 3 pixel wide, red dashed border for the specified wait time.
|
131
|
-
# If wait time is zero, then the highlight will remain until the page is refreshed
|
132
|
-
#
|
133
|
-
# @param duration [Integer or Float] wait time in seconds
|
134
|
-
# @example
|
135
|
-
# remember_me_checkbox.highlight(3)
|
136
|
-
#
|
137
|
-
def highlight(duration = 1)
|
138
|
-
@proxy.nil? ? super : @proxy.highlight(duration)
|
139
|
-
end
|
140
|
-
|
141
|
-
# Restore a highlighted checkbox's original style
|
142
|
-
#
|
143
|
-
# @example
|
144
|
-
# remember_me_checkbox.unhighlight
|
145
|
-
#
|
146
|
-
def unhighlight
|
147
|
-
@proxy.nil? ? super : @proxy.unhighlight
|
148
|
-
end
|
149
150
|
end
|
150
151
|
end
|
@@ -1,16 +1,29 @@
|
|
1
1
|
module TestCentricity
|
2
2
|
class Radio < UIElement
|
3
3
|
attr_accessor :proxy
|
4
|
+
attr_accessor :label
|
4
5
|
|
5
|
-
def initialize(name, parent, locator, context
|
6
|
-
|
7
|
-
@
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
6
|
+
def initialize(name, parent, locator, context)
|
7
|
+
super
|
8
|
+
@type = :radio
|
9
|
+
radio_spec = {
|
10
|
+
proxy: nil,
|
11
|
+
label: nil
|
12
|
+
}
|
13
|
+
define_custom_elements(radio_spec)
|
14
|
+
end
|
15
|
+
|
16
|
+
def define_custom_elements(element_spec)
|
17
|
+
element_spec.each do |element, value|
|
18
|
+
case element
|
19
|
+
when :proxy
|
20
|
+
@proxy = value
|
21
|
+
when :label
|
22
|
+
@label = value
|
23
|
+
else
|
24
|
+
raise "#{element} is not a recognized radio element"
|
25
|
+
end
|
26
|
+
end
|
14
27
|
end
|
15
28
|
|
16
29
|
# Does radio button object exists?
|
@@ -43,7 +56,7 @@ module TestCentricity
|
|
43
56
|
# accept_terms_radio.visible?
|
44
57
|
#
|
45
58
|
def visible?
|
46
|
-
@proxy.nil? ? super : @proxy.visible?
|
59
|
+
@proxy.nil? ? super : page.find(:css, @proxy).visible?
|
47
60
|
end
|
48
61
|
|
49
62
|
# Is radio button disabled (not enabled)?
|
@@ -66,9 +79,17 @@ module TestCentricity
|
|
66
79
|
# accept_terms_radio.get_value
|
67
80
|
#
|
68
81
|
def get_value
|
69
|
-
@
|
82
|
+
if @label.nil?
|
83
|
+
@proxy.nil? ? super : page.find(:css, @proxy).text
|
84
|
+
else
|
85
|
+
page.find(:css, @label).text
|
86
|
+
end
|
70
87
|
end
|
71
88
|
|
89
|
+
alias get_caption get_value
|
90
|
+
alias caption get_value
|
91
|
+
alias value get_value
|
92
|
+
|
72
93
|
# Set the select state of a radio button object.
|
73
94
|
#
|
74
95
|
# @param state [Boolean] true = selected / false = unselected
|
@@ -82,7 +103,7 @@ module TestCentricity
|
|
82
103
|
if @proxy.nil?
|
83
104
|
obj.set(state)
|
84
105
|
else
|
85
|
-
@proxy.click unless state == obj.checked?
|
106
|
+
page.find(:css, @proxy).click unless state == obj.checked?
|
86
107
|
end
|
87
108
|
end
|
88
109
|
|
@@ -103,25 +124,5 @@ module TestCentricity
|
|
103
124
|
def unselect
|
104
125
|
set_selected_state(state = false)
|
105
126
|
end
|
106
|
-
|
107
|
-
# Highlight a radio button with a 3 pixel wide, red dashed border for the specified wait time.
|
108
|
-
# If wait time is zero, then the highlight will remain until the page is refreshed
|
109
|
-
#
|
110
|
-
# @param duration [Integer or Float] wait time in seconds
|
111
|
-
# @example
|
112
|
-
# accept_terms_radio.highlight(3)
|
113
|
-
#
|
114
|
-
def highlight(duration = 1)
|
115
|
-
@proxy.nil? ? super : @proxy.highlight(duration)
|
116
|
-
end
|
117
|
-
|
118
|
-
# Restore a highlighted radio button's original style
|
119
|
-
#
|
120
|
-
# @example
|
121
|
-
# accept_terms_radio.unhighlight
|
122
|
-
#
|
123
|
-
def unhighlight
|
124
|
-
@proxy.nil? ? super : @proxy.unhighlight
|
125
|
-
end
|
126
127
|
end
|
127
128
|
end
|
@@ -7,7 +7,6 @@ module TestCentricity
|
|
7
7
|
attr_accessor :options_list
|
8
8
|
attr_accessor :group_item
|
9
9
|
attr_accessor :group_heading
|
10
|
-
attr_accessor :base_object
|
11
10
|
|
12
11
|
def initialize(name, parent, locator, context)
|
13
12
|
super
|
@@ -286,18 +285,5 @@ module TestCentricity
|
|
286
285
|
trigger.click
|
287
286
|
end
|
288
287
|
end
|
289
|
-
|
290
|
-
def find_component(component, component_name)
|
291
|
-
begin
|
292
|
-
element = @base_object.find(:css, component, minimum: 0, wait: 1)
|
293
|
-
rescue
|
294
|
-
begin
|
295
|
-
element = page.find(:css, component, minimum: 0, wait: 5)
|
296
|
-
rescue
|
297
|
-
raise "List #{component_name} (#{component}) for selectlist named '#{@name}' (#{locator}) not found"
|
298
|
-
end
|
299
|
-
end
|
300
|
-
element
|
301
|
-
end
|
302
288
|
end
|
303
289
|
end
|
@@ -44,6 +44,7 @@ module TestCentricity
|
|
44
44
|
|
45
45
|
attr_reader :parent, :locator, :context, :type, :name
|
46
46
|
attr_accessor :alt_locator, :locator_type, :original_style
|
47
|
+
attr_accessor :base_object
|
47
48
|
|
48
49
|
XPATH_SELECTORS = ['//', '[@', '[contains(']
|
49
50
|
CSS_SELECTORS = ['#', ':nth-child(', ':first-child', ':last-child', ':nth-of-type(', ':first-of-type', ':last-of-type', '^=', '$=', '*=', ':contains(']
|
@@ -196,7 +197,7 @@ module TestCentricity
|
|
196
197
|
#
|
197
198
|
def exists?(visible = true)
|
198
199
|
obj, = find_object(visible)
|
199
|
-
obj
|
200
|
+
!obj.nil?
|
200
201
|
end
|
201
202
|
|
202
203
|
# Is UI object visible?
|
@@ -516,6 +517,8 @@ module TestCentricity
|
|
516
517
|
end
|
517
518
|
|
518
519
|
alias get_caption get_value
|
520
|
+
alias caption get_value
|
521
|
+
alias value get_value
|
519
522
|
|
520
523
|
def verify_value(expected, enqueue = false)
|
521
524
|
actual = get_value
|
@@ -1064,5 +1067,18 @@ module TestCentricity
|
|
1064
1067
|
expected == actual
|
1065
1068
|
end
|
1066
1069
|
end
|
1070
|
+
|
1071
|
+
def find_component(component, component_name)
|
1072
|
+
begin
|
1073
|
+
element = @base_object.find(:css, component, minimum: 0, wait: 1)
|
1074
|
+
rescue
|
1075
|
+
begin
|
1076
|
+
element = page.find(:css, component, minimum: 0, wait: 5)
|
1077
|
+
rescue
|
1078
|
+
raise "Component #{component_name} (#{component}) for #{@type} named '#{@name}' (#{locator}) not found"
|
1079
|
+
end
|
1080
|
+
end
|
1081
|
+
element
|
1082
|
+
end
|
1067
1083
|
end
|
1068
1084
|
end
|
data/lib/testcentricity_web.rb
CHANGED
data/testcentricity_web.gemspec
CHANGED
@@ -7,18 +7,17 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.name = 'testcentricity_web'
|
8
8
|
spec.version = TestCentricityWeb::VERSION
|
9
9
|
spec.platform = Gem::Platform::RUBY
|
10
|
-
spec.required_ruby_version = '>= 2.
|
10
|
+
spec.required_ruby_version = '>= 2.7.5'
|
11
11
|
spec.authors = ['A.J. Mrozinski']
|
12
12
|
spec.email = ['testcentricity@gmail.com']
|
13
13
|
spec.summary = 'A Page Object and Data Object Model Framework for desktop and mobile web testing'
|
14
14
|
spec.description = '
|
15
15
|
The TestCentricity™ Web core generic framework for desktop and mobile web browser-based app testing implements
|
16
|
-
a Page Object Model DSL for use with Cucumber, Capybara, and Selenium-Webdriver. The gem provides support for running
|
16
|
+
a Page Object Model DSL for use with Cucumber, Capybara, and Selenium-Webdriver v4.x. The gem provides support for running
|
17
17
|
automated tests against locally hosted desktop browsers, locally hosted emulated mobile browsers (iOS, Android, Windows
|
18
18
|
Phone, Blackberry, Kindle Fire) running within a local instance of Chrome, mobile Safari browsers on iOS device simulators
|
19
|
-
|
20
|
-
|
21
|
-
BrowserStack, Sauce Labs, CrossBrowserTesting, TestingBot, Gridlastic, or LambdaTest services).'
|
19
|
+
or physical iOS devices, mobile Chrome or Android browsers on Android Studio virtual device emulators, or cloud hosted
|
20
|
+
desktop or mobile web browsers (using the BrowserStack, Sauce Labs, TestingBot, or LambdaTest services).'
|
22
21
|
spec.homepage = ''
|
23
22
|
spec.license = 'BSD-3-Clause'
|
24
23
|
|
@@ -34,14 +33,14 @@ Gem::Specification.new do |spec|
|
|
34
33
|
spec.add_runtime_dependency 'appium_lib'
|
35
34
|
spec.add_runtime_dependency 'browserstack-local'
|
36
35
|
spec.add_runtime_dependency 'capybara', '>= 3.1', '< 4'
|
37
|
-
spec.add_runtime_dependency 'childprocess'
|
36
|
+
spec.add_runtime_dependency 'childprocess'
|
38
37
|
spec.add_runtime_dependency 'chronic', '0.10.2'
|
39
38
|
spec.add_runtime_dependency 'faker'
|
40
39
|
spec.add_runtime_dependency 'i18n'
|
41
40
|
spec.add_runtime_dependency 'os', '~> 1.0'
|
42
|
-
spec.add_runtime_dependency 'selenium-webdriver'
|
41
|
+
spec.add_runtime_dependency 'selenium-webdriver', '>= 4.0', '< 5'
|
43
42
|
spec.add_runtime_dependency 'spreadsheet', '1.1.7'
|
44
43
|
spec.add_runtime_dependency 'test-unit'
|
45
|
-
spec.add_runtime_dependency 'webdrivers', '~>
|
44
|
+
spec.add_runtime_dependency 'webdrivers', '~> 5.0'
|
46
45
|
spec.add_runtime_dependency 'virtus'
|
47
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testcentricity_web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- A.J. Mrozinski
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -90,16 +90,16 @@ dependencies:
|
|
90
90
|
name: childprocess
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
92
92
|
requirements:
|
93
|
-
- - "
|
93
|
+
- - ">="
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version: '0
|
95
|
+
version: '0'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
|
-
- - "
|
100
|
+
- - ">="
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version: '0
|
102
|
+
version: '0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: chronic
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,14 +162,20 @@ dependencies:
|
|
162
162
|
requirements:
|
163
163
|
- - ">="
|
164
164
|
- !ruby/object:Gem::Version
|
165
|
-
version: '0'
|
165
|
+
version: '4.0'
|
166
|
+
- - "<"
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '5'
|
166
169
|
type: :runtime
|
167
170
|
prerelease: false
|
168
171
|
version_requirements: !ruby/object:Gem::Requirement
|
169
172
|
requirements:
|
170
173
|
- - ">="
|
171
174
|
- !ruby/object:Gem::Version
|
172
|
-
version: '0'
|
175
|
+
version: '4.0'
|
176
|
+
- - "<"
|
177
|
+
- !ruby/object:Gem::Version
|
178
|
+
version: '5'
|
173
179
|
- !ruby/object:Gem::Dependency
|
174
180
|
name: spreadsheet
|
175
181
|
requirement: !ruby/object:Gem::Requirement
|
@@ -204,14 +210,14 @@ dependencies:
|
|
204
210
|
requirements:
|
205
211
|
- - "~>"
|
206
212
|
- !ruby/object:Gem::Version
|
207
|
-
version: '
|
213
|
+
version: '5.0'
|
208
214
|
type: :runtime
|
209
215
|
prerelease: false
|
210
216
|
version_requirements: !ruby/object:Gem::Requirement
|
211
217
|
requirements:
|
212
218
|
- - "~>"
|
213
219
|
- !ruby/object:Gem::Version
|
214
|
-
version: '
|
220
|
+
version: '5.0'
|
215
221
|
- !ruby/object:Gem::Dependency
|
216
222
|
name: virtus
|
217
223
|
requirement: !ruby/object:Gem::Requirement
|
@@ -229,12 +235,11 @@ dependencies:
|
|
229
235
|
description: |2-
|
230
236
|
|
231
237
|
The TestCentricity™ Web core generic framework for desktop and mobile web browser-based app testing implements
|
232
|
-
a Page Object Model DSL for use with Cucumber, Capybara, and Selenium-Webdriver. The gem provides support for running
|
238
|
+
a Page Object Model DSL for use with Cucumber, Capybara, and Selenium-Webdriver v4.x. The gem provides support for running
|
233
239
|
automated tests against locally hosted desktop browsers, locally hosted emulated mobile browsers (iOS, Android, Windows
|
234
240
|
Phone, Blackberry, Kindle Fire) running within a local instance of Chrome, mobile Safari browsers on iOS device simulators
|
235
|
-
|
236
|
-
|
237
|
-
BrowserStack, Sauce Labs, CrossBrowserTesting, TestingBot, Gridlastic, or LambdaTest services).
|
241
|
+
or physical iOS devices, mobile Chrome or Android browsers on Android Studio virtual device emulators, or cloud hosted
|
242
|
+
desktop or mobile web browsers (using the BrowserStack, Sauce Labs, TestingBot, or LambdaTest services).
|
238
243
|
email:
|
239
244
|
- testcentricity@gmail.com
|
240
245
|
executables: []
|
@@ -302,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
302
307
|
requirements:
|
303
308
|
- - ">="
|
304
309
|
- !ruby/object:Gem::Version
|
305
|
-
version: 2.
|
310
|
+
version: 2.7.5
|
306
311
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
307
312
|
requirements:
|
308
313
|
- - ">="
|
@@ -310,7 +315,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
310
315
|
version: '0'
|
311
316
|
requirements:
|
312
317
|
- Capybara, Selenium-WebDriver
|
313
|
-
rubygems_version: 3.
|
318
|
+
rubygems_version: 3.1.6
|
314
319
|
signing_key:
|
315
320
|
specification_version: 4
|
316
321
|
summary: A Page Object and Data Object Model Framework for desktop and mobile web
|