testcentricity_web 4.1.7 → 4.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +4 -4
  2. data/.simplecov +5 -1
  3. data/CHANGELOG.md +12 -1
  4. data/Gemfile.lock +1 -1
  5. data/README.md +3 -1
  6. data/Rakefile +29 -3
  7. data/config/cucumber.yml +11 -4
  8. data/config/test_data/LOCAL_data.json +15 -0
  9. data/config/test_data/LOCAL_data.xls +0 -0
  10. data/config/test_data/LOCAL_data.yml +11 -0
  11. data/config/test_data/data.json +13 -0
  12. data/config/test_data/data.yml +12 -4
  13. data/features/basic_form_page_css.feature +39 -0
  14. data/features/basic_form_page_xpath.feature +26 -0
  15. data/features/media_players.feature +4 -7
  16. data/features/step_definitions/generic_steps.rb.rb +65 -0
  17. data/features/support/data/form_data.rb +43 -0
  18. data/features/support/env.rb +3 -3
  19. data/features/support/hooks.rb +21 -1
  20. data/features/support/pages/base_test_page.rb +11 -0
  21. data/features/support/pages/{basic_css_test_page.rb → basic_css_form_page.rb} +3 -3
  22. data/features/support/pages/{basic_test_page.rb → basic_form_page.rb} +120 -24
  23. data/features/support/pages/{basic_xpath_test_page.rb → basic_xpath_form_page.rb} +3 -3
  24. data/features/support/pages/custom_controls_page.rb +2 -5
  25. data/features/support/pages/indexed_sections_page.rb +2 -5
  26. data/features/support/pages/media_test_page.rb +27 -14
  27. data/features/support/sections/header_nav.rb +11 -0
  28. data/features/support/world_data.rb +1 -1
  29. data/features/support/world_pages.rb +2 -2
  30. data/lib/testcentricity_web/appium_server.rb +5 -0
  31. data/lib/testcentricity_web/data_objects/data_objects_helper.rb +7 -0
  32. data/lib/testcentricity_web/data_objects/environment.rb +2 -0
  33. data/lib/testcentricity_web/data_objects/excel_helper.rb +60 -59
  34. data/lib/testcentricity_web/version.rb +1 -1
  35. data/lib/testcentricity_web/web_core/drag_drop_helper.rb +4 -0
  36. data/lib/testcentricity_web/web_core/page_objects_helper.rb +3 -1
  37. data/lib/testcentricity_web/web_core/webdriver_helper.rb +16 -0
  38. data/lib/testcentricity_web/web_elements/file_field.rb +9 -5
  39. data/lib/testcentricity_web/web_elements/image.rb +2 -1
  40. data/lib/testcentricity_web/web_elements/media.rb +1 -13
  41. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +20 -7
  42. data/lib/testcentricity_web/web_elements/video.rb +2 -2
  43. data/test_site/basic_test_page.html +1 -1
  44. data/test_site/media/count_and_bars.mp4 +0 -0
  45. data/test_site/media_page.html +2 -2
  46. metadata +18 -12
  47. data/features/basic_test_page_css.feature +0 -35
  48. data/features/basic_test_page_xpath.feature +0 -27
@@ -29,10 +29,12 @@ module TestCentricity
29
29
  # set downloads folder path
30
30
  @downloads_path = "#{Dir.pwd}/downloads"
31
31
  if ENV['PARALLEL']
32
+ # :nocov:
32
33
  Environ.parallel = true
33
34
  Environ.process_num = ENV['TEST_ENV_NUMBER']
34
35
  @downloads_path = "#{@downloads_path}/#{ENV['TEST_ENV_NUMBER']}"
35
36
  Dir.mkdir(@downloads_path) unless Dir.exist?(@downloads_path)
37
+ # :nocov:
36
38
  else
37
39
  Environ.parallel = false
38
40
  end
@@ -50,6 +52,7 @@ module TestCentricity
50
52
  when :appium
51
53
  initialize_appium
52
54
  'Appium'
55
+ # :nocov:
53
56
  when :browserstack
54
57
  initialize_browserstack
55
58
  'Browserstack cloud service'
@@ -62,6 +65,7 @@ module TestCentricity
62
65
  when :testingbot
63
66
  initialize_testingbot
64
67
  'TestingBot cloud service'
68
+ # :nocov:
65
69
  else
66
70
  if ENV['SELENIUM'] == 'remote'
67
71
  initialize_remote
@@ -91,11 +95,13 @@ module TestCentricity
91
95
  def self.initialize_browser_size
92
96
  # tile browser windows if running in multiple parallel threads and BROWSER_TILE environment variable is true
93
97
  if ENV['PARALLEL'] && ENV['BROWSER_TILE']
98
+ # :nocov:
94
99
  thread = ENV['TEST_ENV_NUMBER'].to_i
95
100
  if thread > 1
96
101
  Browsers.set_browser_window_position(100 * thread - 1, 100 * thread - 1)
97
102
  sleep(1)
98
103
  end
104
+ # :nocov:
99
105
  else
100
106
  Browsers.set_browser_window_position(10, 10)
101
107
  sleep(1)
@@ -116,6 +122,7 @@ module TestCentricity
116
122
  Environ.session_state = :running
117
123
  end
118
124
 
125
+ # :nocov:
119
126
  def self.close_tunnel
120
127
  unless @bs_local.nil?
121
128
  @bs_local.stop
@@ -126,6 +133,7 @@ module TestCentricity
126
133
  end
127
134
  end
128
135
  end
136
+ # :nocov:
129
137
 
130
138
  private
131
139
 
@@ -147,10 +155,12 @@ module TestCentricity
147
155
  desired_capabilities[:avd] = ENV['APP_DEVICE'] if Environ.device_os == :android
148
156
  desired_capabilities[:automationName] = ENV['AUTOMATION_ENGINE'] if ENV['AUTOMATION_ENGINE']
149
157
  if ENV['UDID']
158
+ # :nocov:
150
159
  Environ.device = :device
151
160
  desired_capabilities[:udid] = ENV['UDID']
152
161
  desired_capabilities[:xcodeOrgId] = ENV['TEAM_ID'] if ENV['TEAM_ID']
153
162
  desired_capabilities[:xcodeSigningId] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
163
+ # :nocov:
154
164
  else
155
165
  Environ.device = :simulator
156
166
  desired_capabilities[:orientation] = Environ.device_orientation.upcase if Environ.device_orientation
@@ -179,11 +189,13 @@ module TestCentricity
179
189
  desired_capabilities[:chromedriverExecutable] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
180
190
  # set wdaLocalPort (iOS) or systemPort (Android) if PARALLEL_PORT is true
181
191
  if ENV['PARALLEL'] && ENV['PARALLEL_PORT']
192
+ # :nocov:
182
193
  if Environ.device_os == :ios
183
194
  desired_capabilities[:wdaLocalPort] = 8100 + ENV['TEST_ENV_NUMBER'].to_i
184
195
  else
185
196
  desired_capabilities[:systemPort] = 8200 + ENV['TEST_ENV_NUMBER'].to_i
186
197
  end
198
+ # :nocov:
187
199
  else
188
200
  desired_capabilities[:wdaLocalPort] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
189
201
  desired_capabilities[:systemPort] = ENV['SYSTEM_PORT'] if ENV['SYSTEM_PORT']
@@ -255,6 +267,7 @@ module TestCentricity
255
267
  Capybara.default_driver = :selenium
256
268
  end
257
269
 
270
+ # :nocov:
258
271
  def self.initialize_browserstack
259
272
  browser = ENV['BS_BROWSER']
260
273
  Environ.grid = :browserstack
@@ -554,6 +567,7 @@ module TestCentricity
554
567
  # configure file_detector for remote uploads if target is desktop web browser
555
568
  config_file_uploads unless ENV['TB_PLATFORM']
556
569
  end
570
+ # :nocov:
557
571
 
558
572
  def self.chrome_edge_options(browser)
559
573
  options = case browser
@@ -599,6 +613,7 @@ module TestCentricity
599
613
  options
600
614
  end
601
615
 
616
+ # :nocov:
602
617
  def self.test_context_message
603
618
  context_message = if ENV['TEST_CONTEXT']
604
619
  "#{Environ.test_environment.to_s.upcase} - #{ENV['TEST_CONTEXT']}"
@@ -636,5 +651,6 @@ module TestCentricity
636
651
  str if File.exist?(str)
637
652
  end
638
653
  end
654
+ # :nocov:
639
655
  end
640
656
  end
@@ -5,17 +5,19 @@ module TestCentricity
5
5
  @type = :filefield
6
6
  end
7
7
 
8
+ def file_upload(file_path)
9
+ obj, = find_element(visible = false)
10
+ obj.send_keys(file_path)
11
+ end
12
+
13
+ # :nocov:
14
+
8
15
  def file_attach(file_path)
9
16
  Capybara.ignore_hidden_elements = false
10
17
  page.attach_file(@locator, file_path)
11
18
  Capybara.ignore_hidden_elements = true
12
19
  end
13
20
 
14
- def file_upload(file_path)
15
- obj, = find_element(visible = false)
16
- obj.send_keys(file_path)
17
- end
18
-
19
21
  def drop_files(files)
20
22
  js_script = 'fileList = Array();'
21
23
  files.count.times do |i|
@@ -41,5 +43,7 @@ module TestCentricity
41
43
  # trigger the fake drop event
42
44
  page.execute_script(js_script)
43
45
  end
46
+
47
+ # :nocov:
44
48
  end
45
49
  end
@@ -14,7 +14,8 @@ module TestCentricity
14
14
  def loaded?
15
15
  obj, = find_element
16
16
  object_not_found_exception(obj, nil)
17
- obj.native.attribute('complete')
17
+ state = obj.native.attribute('complete')
18
+ state.boolean? ? state : state == 'true'
18
19
  end
19
20
 
20
21
  alias is_loaded? loaded?
@@ -195,7 +195,7 @@ module TestCentricity
195
195
  wait.until { ready_state == value }
196
196
  rescue StandardError
197
197
  if post_exception
198
- raise "Ready state of Audio #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
198
+ raise "Ready state of media #{object_ref_message} failed to equal '#{value}' after #{timeout} seconds" unless get_value == value
199
199
  else
200
200
  ready_state == value
201
201
  end
@@ -293,18 +293,6 @@ module TestCentricity
293
293
  page.execute_script('arguments[0].volume = arguments[1]', obj, value)
294
294
  end
295
295
 
296
- # Return media crossorigin property
297
- #
298
- # @return crossorigin value
299
- # @example
300
- # with_creds = media_player.crossorigin == 'use-credentials'
301
- #
302
- def crossorigin
303
- obj, = find_element
304
- object_not_found_exception(obj, @type)
305
- obj.native.attribute('crossorigin')
306
- end
307
-
308
296
  # Return media preload property
309
297
  #
310
298
  # @return preload value
@@ -168,7 +168,7 @@ module TestCentricity
168
168
  def scroll_to(position)
169
169
  obj, type = find_element
170
170
  object_not_found_exception(obj, type)
171
- obj.scroll_to(position)
171
+ page.scroll_to(obj, align: position)
172
172
  end
173
173
 
174
174
  def set(value)
@@ -521,12 +521,13 @@ module TestCentricity
521
521
  def get_value(visible = true)
522
522
  obj, type = find_element(visible)
523
523
  object_not_found_exception(obj, type)
524
- case obj.tag_name.downcase
525
- when 'input', 'select', 'textarea'
526
- obj.value
527
- else
528
- obj.text
529
- end
524
+ text = case obj.tag_name.downcase
525
+ when 'input', 'select', 'textarea'
526
+ obj.value
527
+ else
528
+ obj.text
529
+ end
530
+ text.gsub(/[[:space:]]+/, ' ').strip
530
531
  end
531
532
 
532
533
  alias get_caption get_value
@@ -998,6 +999,18 @@ module TestCentricity
998
999
  state.boolean? ? state : state == 'true'
999
1000
  end
1000
1001
 
1002
+ # Return crossorigin property
1003
+ #
1004
+ # @return crossorigin value
1005
+ # @example
1006
+ # with_creds = media_player.crossorigin == 'use-credentials'
1007
+ #
1008
+ def crossorigin
1009
+ obj, = find_element
1010
+ object_not_found_exception(obj, @type)
1011
+ obj.native.attribute('crossorigin')
1012
+ end
1013
+
1001
1014
  def get_attribute(attrib)
1002
1015
  obj, type = find_element(visible = false)
1003
1016
  object_not_found_exception(obj, type)
@@ -14,7 +14,7 @@ module TestCentricity
14
14
  def video_height
15
15
  obj, = find_element
16
16
  object_not_found_exception(obj, :video)
17
- obj.native.attribute('videoHeight')
17
+ obj.native.attribute('videoHeight').to_i
18
18
  end
19
19
 
20
20
  # Return video Width property
@@ -26,7 +26,7 @@ module TestCentricity
26
26
  def video_width
27
27
  obj, = find_element
28
28
  object_not_found_exception(obj, :video)
29
- obj.native.attribute('videoWidth')
29
+ obj.native.attribute('videoWidth').to_i
30
30
  end
31
31
 
32
32
  # Return video poster property
@@ -43,7 +43,7 @@
43
43
  </head>
44
44
  <body>
45
45
  <div class="page-body">
46
- <h2>Basic HTML Form Example</h2>
46
+ <h2>Basic HTML Form</h2>
47
47
 
48
48
  <div id="nav_bar" class="topnav">
49
49
  <a id="form_link" class="active" href="#">Basic HTML Form</a>
Binary file
@@ -56,8 +56,8 @@
56
56
  <tbody>
57
57
  <tr>
58
58
  <td>
59
- <label id="video">Video:</label>
60
- <video id="video_player" width="400" controls>
59
+ <label id="video1">Video:</label>
60
+ <video id="video_player1" width="480" height="360" controls>
61
61
  <source src="media/count_and_bars.mp4" type="video/mp4">
62
62
  </video>
63
63
  </td>
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.1.7
4
+ version: 4.1.8
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-03-27 00:00:00.000000000 Z
11
+ date: 2022-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -334,21 +334,25 @@ files:
334
334
  - README.md
335
335
  - Rakefile
336
336
  - config/cucumber.yml
337
+ - config/test_data/LOCAL_data.json
338
+ - config/test_data/LOCAL_data.xls
339
+ - config/test_data/LOCAL_data.yml
337
340
  - config/test_data/data.json
338
341
  - config/test_data/data.xls
339
342
  - config/test_data/data.yml
340
343
  - docker-compose-v3.yml
341
- - features/basic_test_page_css.feature
342
- - features/basic_test_page_xpath.feature
344
+ - features/basic_form_page_css.feature
345
+ - features/basic_form_page_xpath.feature
343
346
  - features/media_players.feature
344
347
  - features/step_definitions/generic_steps.rb.rb
345
348
  - features/step_definitions/media_steps.rb
349
+ - features/support/data/form_data.rb
346
350
  - features/support/env.rb
347
351
  - features/support/hooks.rb
348
352
  - features/support/pages/base_test_page.rb
349
- - features/support/pages/basic_css_test_page.rb
350
- - features/support/pages/basic_test_page.rb
351
- - features/support/pages/basic_xpath_test_page.rb
353
+ - features/support/pages/basic_css_form_page.rb
354
+ - features/support/pages/basic_form_page.rb
355
+ - features/support/pages/basic_xpath_form_page.rb
352
356
  - features/support/pages/custom_controls_page.rb
353
357
  - features/support/pages/indexed_sections_page.rb
354
358
  - features/support/pages/media_test_page.rb
@@ -398,6 +402,7 @@ files:
398
402
  - test_site/media/MIB2.mp4
399
403
  - test_site/media/MP4_small.mp4
400
404
  - test_site/media/MPS_sample.mp3
405
+ - test_site/media/count_and_bars.mp4
401
406
  - test_site/media_page.html
402
407
  - testcentricity_web.gemspec
403
408
  homepage: ''
@@ -426,17 +431,18 @@ specification_version: 4
426
431
  summary: A Page Object and Data Object Model Framework for desktop and mobile web
427
432
  testing
428
433
  test_files:
429
- - features/basic_test_page_css.feature
430
- - features/basic_test_page_xpath.feature
434
+ - features/basic_form_page_css.feature
435
+ - features/basic_form_page_xpath.feature
431
436
  - features/media_players.feature
432
437
  - features/step_definitions/generic_steps.rb.rb
433
438
  - features/step_definitions/media_steps.rb
439
+ - features/support/data/form_data.rb
434
440
  - features/support/env.rb
435
441
  - features/support/hooks.rb
436
442
  - features/support/pages/base_test_page.rb
437
- - features/support/pages/basic_css_test_page.rb
438
- - features/support/pages/basic_test_page.rb
439
- - features/support/pages/basic_xpath_test_page.rb
443
+ - features/support/pages/basic_css_form_page.rb
444
+ - features/support/pages/basic_form_page.rb
445
+ - features/support/pages/basic_xpath_form_page.rb
440
446
  - features/support/pages/custom_controls_page.rb
441
447
  - features/support/pages/indexed_sections_page.rb
442
448
  - features/support/pages/media_test_page.rb
@@ -1,35 +0,0 @@
1
- Feature: Basic HTML Test Page using CSS locators
2
- In order to xxx
3
- As a xxxx
4
- I expect to xxxx
5
-
6
-
7
- Background:
8
- Given I am on the Basic CSS Test page
9
-
10
-
11
- Scenario: xxxxx
12
- Then I expect the Basic CSS Test page to be correctly displayed
13
-
14
-
15
- @!mobile
16
- Scenario: xxxxx
17
- Then I expect the tab order to be correct
18
-
19
-
20
- Scenario: xxxxx
21
- When I populate the form fields
22
- Then I expect the form fields to be correctly populated
23
- When I cancel my changes
24
- Then I expect the Basic CSS Test page to be correctly displayed
25
-
26
-
27
- Scenario Outline: Verify functionality of navigation tabs
28
- When I click the <target_page> navigation tab
29
- Then I expect the <target_page> page to be correctly displayed
30
-
31
- Examples:
32
- |target_page |
33
- |Media Test |
34
- |Indexed Sections |
35
- |Custom Controls |
@@ -1,27 +0,0 @@
1
- @!grid
2
-
3
-
4
- Feature: Basic HTML Test Page using Xpath locators
5
- In order to xxx
6
- As a xxxx
7
- I expect to xxxx
8
-
9
-
10
- Background:
11
- Given I am on the Basic Xpath Test page
12
-
13
-
14
- Scenario: xxxxx
15
- Then I expect the Basic Xpath Test page to be correctly displayed
16
-
17
-
18
- @!mobile
19
- Scenario: xxxxx
20
- Then I expect the tab order to be correct
21
-
22
-
23
- Scenario: xxxxx
24
- When I populate the form fields
25
- Then I expect the form fields to be correctly populated
26
- When I cancel my changes
27
- Then I expect the Basic Xpath Test page to be correctly displayed