testcentricity_web 4.3.1 → 4.4.0

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 +27 -79
  33. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +0 -1148
@@ -1,44 +1,46 @@
1
1
  module TestCentricity
2
- class Video < Media
3
- def initialize(name, parent, locator, context)
4
- super
5
- @type = :video
6
- end
2
+ module Elements
3
+ class Video < Media
4
+ def initialize(name, parent, locator, context)
5
+ super
6
+ @type = :video
7
+ end
7
8
 
8
- # Return video Height property
9
- #
10
- # @return [Integer] video height
11
- # @example
12
- # height = video_player.video_height
13
- #
14
- def video_height
15
- obj, = find_element
16
- object_not_found_exception(obj, :video)
17
- obj.native.attribute('videoHeight').to_i
18
- end
9
+ # Return video Height property
10
+ #
11
+ # @return [Integer] video height
12
+ # @example
13
+ # height = video_player.video_height
14
+ #
15
+ def video_height
16
+ obj, = find_element
17
+ object_not_found_exception(obj, :video)
18
+ obj.native.attribute('videoHeight').to_i
19
+ end
19
20
 
20
- # Return video Width property
21
- #
22
- # @return [Integer] video width
23
- # @example
24
- # width = video_player.video_width
25
- #
26
- def video_width
27
- obj, = find_element
28
- object_not_found_exception(obj, :video)
29
- obj.native.attribute('videoWidth').to_i
30
- end
21
+ # Return video Width property
22
+ #
23
+ # @return [Integer] video width
24
+ # @example
25
+ # width = video_player.video_width
26
+ #
27
+ def video_width
28
+ obj, = find_element
29
+ object_not_found_exception(obj, :video)
30
+ obj.native.attribute('videoWidth').to_i
31
+ end
31
32
 
32
- # Return video poster property
33
- #
34
- # @return poster value
35
- # @example
36
- # poster = video_player.poster
37
- #
38
- def poster
39
- obj, = find_element
40
- object_not_found_exception(obj, :video)
41
- obj.native.attribute('poster')
33
+ # Return video poster property
34
+ #
35
+ # @return poster value
36
+ # @example
37
+ # poster = video_player.poster
38
+ #
39
+ def poster
40
+ obj, = find_element
41
+ object_not_found_exception(obj, :video)
42
+ obj.native.attribute('poster')
43
+ end
42
44
  end
43
45
  end
44
46
  end
@@ -8,8 +8,21 @@ module WorldData
8
8
  # return if data objects have already been instantiated and registered
9
9
  return if TestCentricity::DataManager.loaded?
10
10
 
11
- # register and instantiate all data objects
12
- eval(TestCentricity::DataManager.register_data_objects(data_objects))
11
+ # instantiate all data objects
12
+ @data = {}
13
+ data_objects.each do |data_type, data_class|
14
+ @data[data_type] = data_class.new unless @data.has_key?(data_type)
15
+ # define data object accessor method
16
+ define_method(data_type) do
17
+ if instance_variable_defined?(:"@#{data_type}")
18
+ instance_variable_get(:"@#{data_type}")
19
+ else
20
+ instance_variable_set(:"@#{data_type}", TestCentricity::DataManager.find_data_object(data_type))
21
+ end
22
+ end
23
+ end
24
+ # register all data objects with DataManager
25
+ TestCentricity::DataManager.register_data_objects(@data)
13
26
  end
14
27
  end
15
28
 
@@ -20,7 +33,27 @@ module WorldPages
20
33
  # return if page objects have already been instantiated and registered
21
34
  return if TestCentricity::PageManager.loaded?
22
35
 
23
- # register and instantiate all page objects
24
- eval(TestCentricity::PageManager.register_page_objects(page_objects))
36
+ # instantiate all page objects
37
+ @pages = {}
38
+ page_objects.each do |page_object, page_class|
39
+ obj = page_class.new
40
+ @pages[page_object] = obj unless @pages.has_key?(page_object)
41
+ page_names = obj.page_name
42
+ page_names = Array(page_names) if page_names.is_a? String
43
+ page_names.each do |name|
44
+ page_key = name.gsub(/\s+/, '').downcase.to_sym
45
+ @pages[page_key] = obj unless @pages.has_key?(page_key)
46
+ end
47
+ # define page object accessor method
48
+ define_method(page_object) do
49
+ if instance_variable_defined?(:"@#{page_object}")
50
+ instance_variable_get(:"@#{page_object}")
51
+ else
52
+ instance_variable_set(:"@#{page_object}", TestCentricity::PageManager.find_page(page_object))
53
+ end
54
+ end
55
+ end
56
+ # register all page objects with PageManager
57
+ TestCentricity::PageManager.register_page_objects(@pages)
25
58
  end
26
59
  end
@@ -18,7 +18,7 @@ require 'testcentricity_web/data_objects/data_objects_helper'
18
18
  require 'testcentricity_web/data_objects/environment'
19
19
  require 'testcentricity_web/data_objects/excel_helper'
20
20
 
21
- require 'testcentricity_web/web_elements/ui_elements_helper'
21
+ require 'testcentricity_web/web_elements/ui_element'
22
22
  require 'testcentricity_web/web_elements/button'
23
23
  require 'testcentricity_web/web_elements/checkbox'
24
24
  require 'testcentricity_web/web_elements/file_field'
@@ -43,21 +43,7 @@ module TestCentricity
43
43
  @page_objects = {}
44
44
 
45
45
  def self.register_page_objects(pages)
46
- result = ''
47
- pages.each do |page_object, page_class|
48
- obj = page_class.new
49
- @page_objects[page_object] = obj unless @page_objects.has_key?(page_object)
50
- page_names = obj.page_name
51
- page_names = Array(page_names) if page_names.is_a? String
52
- page_names.each do |name|
53
- page_key = name.gsub(/\s+/, '').downcase.to_sym
54
- if page_key != page_object
55
- @page_objects[page_key] = obj unless @page_objects.has_key?(page_key)
56
- end
57
- result = "#{result}def #{page_object};@#{page_object} ||= TestCentricity::PageManager.find_page(:#{page_object});end;"
58
- end
59
- end
60
- result
46
+ @page_objects = pages
61
47
  end
62
48
 
63
49
  # Have all PageObjects been registered?
@@ -71,7 +57,7 @@ module TestCentricity
71
57
  end
72
58
 
73
59
  def self.find_page(page_name)
74
- (page_name.is_a? String) ? page_id = page_name.gsub(/\s+/, '').downcase.to_sym : page_id = page_name
60
+ page_id = (page_name.is_a? String) ? page_name.gsub(/\s+/, '').downcase.to_sym : page_name
75
61
  page = @page_objects[page_id]
76
62
  raise "No page object defined for page named '#{page_name}'" unless page
77
63
  page
@@ -103,12 +89,7 @@ module TestCentricity
103
89
  @data_objects = {}
104
90
 
105
91
  def self.register_data_objects(data)
106
- result = ''
107
- data.each do |data_type, data_class|
108
- @data_objects[data_type] = data_class.new unless @data_objects.has_key?(data_type)
109
- result = "#{result}def #{data_type};@#{data_type} ||= TestCentricity::DataManager.find_data_object(:#{data_type});end;"
110
- end
111
- result
92
+ @data_objects = data
112
93
  end
113
94
 
114
95
  def self.find_data_object(data_object)
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testcentricity_web
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.3.1
4
+ version: 4.4.0
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: 2022-08-19 00:00:00.000000000 Z
11
+ date: 2023-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: appium_capybara
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: bundler
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -44,28 +30,14 @@ dependencies:
44
30
  requirements:
45
31
  - - '='
46
32
  - !ruby/object:Gem::Version
47
- version: 8.0.0
33
+ version: 9.1.0
48
34
  type: :development
49
35
  prerelease: false
50
36
  version_requirements: !ruby/object:Gem::Requirement
51
37
  requirements:
52
38
  - - '='
53
39
  - !ruby/object:Gem::Version
54
- version: 8.0.0
55
- - !ruby/object:Gem::Dependency
56
- name: cuke_modeler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '3.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '3.0'
40
+ version: 9.1.0
69
41
  - !ruby/object:Gem::Dependency
70
42
  name: docker-compose
71
43
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +114,14 @@ dependencies:
142
114
  requirements:
143
115
  - - ">="
144
116
  - !ruby/object:Gem::Version
145
- version: 3.11.0
117
+ version: 3.12.0
146
118
  type: :development
147
119
  prerelease: false
148
120
  version_requirements: !ruby/object:Gem::Requirement
149
121
  requirements:
150
122
  - - ">="
151
123
  - !ruby/object:Gem::Version
152
- version: 3.11.0
124
+ version: 3.12.0
153
125
  - !ruby/object:Gem::Dependency
154
126
  name: simplecov
155
127
  requirement: !ruby/object:Gem::Requirement
@@ -182,16 +154,16 @@ dependencies:
182
154
  name: appium_lib
183
155
  requirement: !ruby/object:Gem::Requirement
184
156
  requirements:
185
- - - ">="
157
+ - - "~>"
186
158
  - !ruby/object:Gem::Version
187
- version: '0'
159
+ version: 13.0.1
188
160
  type: :runtime
189
161
  prerelease: false
190
162
  version_requirements: !ruby/object:Gem::Requirement
191
163
  requirements:
192
- - - ">="
164
+ - - "~>"
193
165
  - !ruby/object:Gem::Version
194
- version: '0'
166
+ version: 13.0.1
195
167
  - !ruby/object:Gem::Dependency
196
168
  name: browserstack-local
197
169
  requirement: !ruby/object:Gem::Requirement
@@ -210,22 +182,16 @@ dependencies:
210
182
  name: capybara
211
183
  requirement: !ruby/object:Gem::Requirement
212
184
  requirements:
213
- - - ">="
214
- - !ruby/object:Gem::Version
215
- version: 3.37.1
216
- - - "<"
185
+ - - '='
217
186
  - !ruby/object:Gem::Version
218
- version: '4'
187
+ version: 3.39.2
219
188
  type: :runtime
220
189
  prerelease: false
221
190
  version_requirements: !ruby/object:Gem::Requirement
222
191
  requirements:
223
- - - ">="
224
- - !ruby/object:Gem::Version
225
- version: 3.37.1
226
- - - "<"
192
+ - - '='
227
193
  - !ruby/object:Gem::Version
228
- version: '4'
194
+ version: 3.39.2
229
195
  - !ruby/object:Gem::Dependency
230
196
  name: childprocess
231
197
  requirement: !ruby/object:Gem::Requirement
@@ -300,22 +266,16 @@ dependencies:
300
266
  name: selenium-webdriver
301
267
  requirement: !ruby/object:Gem::Requirement
302
268
  requirements:
303
- - - ">="
304
- - !ruby/object:Gem::Version
305
- version: 4.3.0
306
- - - "<"
269
+ - - '='
307
270
  - !ruby/object:Gem::Version
308
- version: '5'
271
+ version: 4.14.0
309
272
  type: :runtime
310
273
  prerelease: false
311
274
  version_requirements: !ruby/object:Gem::Requirement
312
275
  requirements:
313
- - - ">="
314
- - !ruby/object:Gem::Version
315
- version: 4.3.0
316
- - - "<"
276
+ - - '='
317
277
  - !ruby/object:Gem::Version
318
- version: '5'
278
+ version: 4.14.0
319
279
  - !ruby/object:Gem::Dependency
320
280
  name: spreadsheet
321
281
  requirement: !ruby/object:Gem::Requirement
@@ -358,28 +318,14 @@ dependencies:
358
318
  - - ">="
359
319
  - !ruby/object:Gem::Version
360
320
  version: '0'
361
- - !ruby/object:Gem::Dependency
362
- name: webdrivers
363
- requirement: !ruby/object:Gem::Requirement
364
- requirements:
365
- - - "~>"
366
- - !ruby/object:Gem::Version
367
- version: '5.0'
368
- type: :runtime
369
- prerelease: false
370
- version_requirements: !ruby/object:Gem::Requirement
371
- requirements:
372
- - - "~>"
373
- - !ruby/object:Gem::Version
374
- version: '5.0'
375
321
  description: |2-
376
322
 
377
323
  The TestCentricity™ Web core framework for desktop and mobile web browser-based app testing implements a Page Object
378
- Model DSL for use with Cucumber, Capybara, and Selenium-Webdriver v4.x. The gem also facilitates the configuration of
379
- the appropriate Selenium-Webdriver capabilities required to establish a connection with locally hosted desktop browsers,
324
+ Model DSL for use with Cucumber or RSpec, and Selenium-Webdriver v4.14. The gem also facilitates the configuration of
325
+ the appropriate Selenium-Webdriver capabilities required to establish connections to locally hosted desktop browsers,
380
326
  locally hosted emulated mobile browsers (iOS, Android, etc.) running within a local instance of Chrome, mobile Safari
381
- browsers on iOS device simulators or physical iOS devices, mobile Chrome or Android browsers on Android Studio virtual
382
- device emulators, or cloud hosted desktop or mobile web browsers (using BrowserStack, Sauce Labs, TestingBot, or
327
+ browsers on iOS device simulators or physical iOS devices, mobile Chrome browsers on Android Studio virtual device
328
+ emulators, or cloud hosted desktop or mobile web browsers (using BrowserStack, Sauce Labs, TestingBot, or
383
329
  LambdaTest services).
384
330
  email:
385
331
  - testcentricity@gmail.com
@@ -420,7 +366,7 @@ files:
420
366
  - lib/testcentricity_web/web_elements/select_list.rb
421
367
  - lib/testcentricity_web/web_elements/table.rb
422
368
  - lib/testcentricity_web/web_elements/textfield.rb
423
- - lib/testcentricity_web/web_elements/ui_elements_helper.rb
369
+ - lib/testcentricity_web/web_elements/ui_element.rb
424
370
  - lib/testcentricity_web/web_elements/video.rb
425
371
  - lib/testcentricity_web/world_extensions.rb
426
372
  homepage: https://github.com/TestCentricity/testcentricity_web
@@ -428,6 +374,8 @@ licenses:
428
374
  - BSD-3-Clause
429
375
  metadata:
430
376
  changelog_uri: https://github.com/TestCentricity/testcentricity_web/blob/main/CHANGELOG.md
377
+ bug_tracker_uri: https://github.com/TestCentricity/testcentricity_web/issues
378
+ wiki_uri: https://github.com/TestCentricity/testcentricity_web/wiki
431
379
  documentation_uri: https://www.rubydoc.info/gems/testcentricity_web
432
380
  post_install_message:
433
381
  rdoc_options: []
@@ -437,7 +385,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
437
385
  requirements:
438
386
  - - ">="
439
387
  - !ruby/object:Gem::Version
440
- version: 2.7.5
388
+ version: 3.0.0
441
389
  required_rubygems_version: !ruby/object:Gem::Requirement
442
390
  requirements:
443
391
  - - ">="
@@ -445,7 +393,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
445
393
  version: '0'
446
394
  requirements:
447
395
  - Capybara, Selenium-WebDriver
448
- rubygems_version: 3.1.6
396
+ rubygems_version: 3.2.3
449
397
  signing_key:
450
398
  specification_version: 4
451
399
  summary: A Page Object Model Framework for desktop and mobile web testing