testcentricity_web 4.1.9 → 4.3.0

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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +96 -1
  3. data/README.md +88 -48
  4. data/lib/testcentricity_web/browser_helper.rb +2 -1
  5. data/lib/testcentricity_web/data_objects/environment.rb +0 -1
  6. data/lib/testcentricity_web/version.rb +1 -1
  7. data/lib/testcentricity_web/web_core/page_objects_helper.rb +40 -3
  8. data/lib/testcentricity_web/web_core/webdriver_helper.rb +89 -80
  9. data/lib/testcentricity_web/web_elements/media.rb +108 -0
  10. data/lib/testcentricity_web/web_elements/textfield.rb +28 -0
  11. data/lib/testcentricity_web/web_elements/ui_elements_helper.rb +39 -1
  12. metadata +37 -181
  13. data/.gitignore +0 -39
  14. data/.idea/.name +0 -1
  15. data/.idea/encodings.xml +0 -6
  16. data/.idea/misc.xml +0 -4
  17. data/.idea/modules.xml +0 -8
  18. data/.idea/vcs.xml +0 -7
  19. data/.rspec +0 -4
  20. data/.rubocop.yml +0 -38
  21. data/.ruby-version +0 -1
  22. data/.simplecov +0 -9
  23. data/CODE_OF_CONDUCT.md +0 -13
  24. data/Gemfile +0 -6
  25. data/Rakefile +0 -115
  26. data/config/cucumber.yml +0 -171
  27. data/config/locales/en-US.yml +0 -56
  28. data/config/test_data/LOCAL_data.json +0 -15
  29. data/config/test_data/LOCAL_data.xls +0 -0
  30. data/config/test_data/LOCAL_data.yml +0 -11
  31. data/config/test_data/data.json +0 -25
  32. data/config/test_data/data.xls +0 -0
  33. data/config/test_data/data.yml +0 -20
  34. data/docker-compose.yml +0 -48
  35. data/features/basic_form_page_css.feature +0 -54
  36. data/features/basic_form_page_xpath.feature +0 -26
  37. data/features/custom_controls.feature +0 -29
  38. data/features/media_players.feature +0 -67
  39. data/features/step_definitions/generic_steps.rb.rb +0 -124
  40. data/features/step_definitions/media_steps.rb +0 -30
  41. data/features/support/data/form_data.rb +0 -43
  42. data/features/support/env.rb +0 -51
  43. data/features/support/hooks.rb +0 -270
  44. data/features/support/pages/base_test_page.rb +0 -22
  45. data/features/support/pages/basic_css_form_page.rb +0 -53
  46. data/features/support/pages/basic_form_page.rb +0 -429
  47. data/features/support/pages/basic_xpath_form_page.rb +0 -54
  48. data/features/support/pages/custom_controls_page.rb +0 -263
  49. data/features/support/pages/indexed_sections_page.rb +0 -57
  50. data/features/support/pages/media_test_page.rb +0 -207
  51. data/features/support/sections/header_nav.rb +0 -48
  52. data/features/support/sections/product_card.rb +0 -39
  53. data/features/support/world_data.rb +0 -12
  54. data/features/support/world_pages.rb +0 -18
  55. data/reports/.keep +0 -1
  56. data/spec/fixtures/page_object.rb +0 -22
  57. data/spec/fixtures/section_object.rb +0 -21
  58. data/spec/spec_helper.rb +0 -31
  59. data/spec/testcentricity_web/browser_spec.rb +0 -41
  60. data/spec/testcentricity_web/elements/audio_spec.rb +0 -68
  61. data/spec/testcentricity_web/elements/button_spec.rb +0 -18
  62. data/spec/testcentricity_web/elements/checkbox_spec.rb +0 -33
  63. data/spec/testcentricity_web/elements/file_field_spec.rb +0 -13
  64. data/spec/testcentricity_web/elements/image_spec.rb +0 -33
  65. data/spec/testcentricity_web/elements/label_spec.rb +0 -18
  66. data/spec/testcentricity_web/elements/link_spec.rb +0 -23
  67. data/spec/testcentricity_web/elements/list_spec.rb +0 -13
  68. data/spec/testcentricity_web/elements/radio_spec.rb +0 -28
  69. data/spec/testcentricity_web/elements/ui_element_spec.rb +0 -125
  70. data/spec/testcentricity_web/elements/video_spec.rb +0 -68
  71. data/spec/testcentricity_web/helper_specs/object_helpers_spec.rb +0 -39
  72. data/spec/testcentricity_web/helper_specs/string_helpers_spec.rb +0 -49
  73. data/spec/testcentricity_web/page_object_spec.rb +0 -90
  74. data/spec/testcentricity_web/section_object_spec.rb +0 -72
  75. data/spec/testcentricity_web/version_spec.rb +0 -7
  76. data/spec/testcentricity_web/webdriver_connect/grid_webdriver_spec.rb +0 -72
  77. data/spec/testcentricity_web/webdriver_connect/local_webdriver_spec.rb +0 -86
  78. data/spec/testcentricity_web/webdriver_connect/mobile_webdriver_spec.rb +0 -65
  79. data/test_site/basic_test_page.html +0 -290
  80. data/test_site/chosen-sprite.png +0 -0
  81. data/test_site/chosen-sprite@2x.png +0 -0
  82. data/test_site/chosen.css +0 -496
  83. data/test_site/chosen.jquery.js +0 -1359
  84. data/test_site/chosen.jquery.min.js +0 -3
  85. data/test_site/chosen.min.css +0 -11
  86. data/test_site/chosen.proto.js +0 -1399
  87. data/test_site/chosen.proto.min.js +0 -3
  88. data/test_site/composer.json +0 -36
  89. data/test_site/custom_controls_page.html +0 -629
  90. data/test_site/docsupport/chosen.png +0 -0
  91. data/test_site/docsupport/init.js +0 -11
  92. data/test_site/docsupport/init.proto.js +0 -16
  93. data/test_site/docsupport/jquery-1.12.4.min.js +0 -5
  94. data/test_site/docsupport/jquery-3.2.1.min.js +0 -4
  95. data/test_site/docsupport/oss-credit.png +0 -0
  96. data/test_site/docsupport/prism.css +0 -108
  97. data/test_site/docsupport/prism.js +0 -9
  98. data/test_site/docsupport/prototype-1.7.0.0.js +0 -6082
  99. data/test_site/docsupport/style.css +0 -219
  100. data/test_site/images/Blouse_Black.jpg +0 -0
  101. data/test_site/images/Granny.jpg +0 -0
  102. data/test_site/images/Printed_Dress.jpg +0 -0
  103. data/test_site/images/T-shirt.jpg +0 -0
  104. data/test_site/images/Wilder.jpg +0 -0
  105. data/test_site/images/You_Betcha.jpg +0 -0
  106. data/test_site/images/jeans3.jpg +0 -0
  107. data/test_site/indexed_sections_page.html +0 -215
  108. data/test_site/media/MIB2-subtitles-pt-BR.vtt +0 -49
  109. data/test_site/media/MIB2.mp4 +0 -0
  110. data/test_site/media/MP4_small.mp4 +0 -0
  111. data/test_site/media/MPS_sample.mp3 +0 -0
  112. data/test_site/media/bbc_scotland_report.mp3 +0 -0
  113. data/test_site/media/count_and_bars.mp4 +0 -0
  114. data/test_site/media_page.html +0 -86
  115. data/testcentricity_web.gemspec +0 -57
@@ -1,43 +0,0 @@
1
- class FormDataSource < TestCentricity::ExcelDataSource
2
- def read_form_data
3
- form_data = case ENV['DATA_SOURCE'].downcase.to_sym
4
- when :excel
5
- read_excel_row_data('Form_data', 'primary')
6
- when :yaml, :json
7
- environs.read('Form_data', 'primary')
8
- else
9
- raise "#{ENV['DATA_SOURCE']} is not a valid data source"
10
- end
11
- FormData.current = FormData.new(form_data)
12
- end
13
-
14
- def map_form_data(form_data)
15
- FormData.current = FormData.new(form_data)
16
- end
17
- end
18
-
19
-
20
- class FormData < TestCentricity::DataPresenter
21
- attribute :username, String
22
- attribute :password, String
23
- attribute :image_filename, String
24
- attribute :multi_select, String
25
- attribute :drop_down_item, String
26
- attribute :check1, Boolean, default: false
27
- attribute :check2, Boolean, default: false
28
- attribute :check3, Boolean, default: false
29
- attribute :radio_select, Integer
30
-
31
- def initialize(data)
32
- @username = data[:username]
33
- @password = data[:password]
34
- @image_filename = data[:image_filename]
35
- @multi_select = data[:multi_select]
36
- @drop_down_item = data[:drop_down_item]
37
- @check1 = data[:check1]
38
- @check2 = data[:check2]
39
- @check3 = data[:check3]
40
- @radio_select = data[:radio_select]
41
- super
42
- end
43
- end
@@ -1,51 +0,0 @@
1
- require 'capybara/cucumber'
2
- require 'parallel_tests'
3
- require 'appium_capybara'
4
- require 'require_all'
5
- require 'simplecov'
6
- require 'testcentricity_web'
7
-
8
- include TestCentricity
9
-
10
- coverage_report_name = "Features-#{ENV['WEB_BROWSER']}-#{ENV['SELENIUM']}" + (ENV['TEST_ENV_NUMBER'] || '')
11
- SimpleCov.command_name("#{coverage_report_name}-#{Time.now.strftime('%Y%m%d%H%M%S%L')}")
12
-
13
- require_relative 'world_data'
14
- require_relative 'world_pages'
15
-
16
- require_rel 'data'
17
- require_rel 'sections'
18
- require_rel 'pages'
19
-
20
- $LOAD_PATH << './lib'
21
-
22
- # set Capybara's default max wait time to 20 seconds
23
- Capybara.default_max_wait_time = 20
24
-
25
- # set the default locale and auto load all translations from config/locales/*.rb,yml.
26
- ENV['LOCALE'] = 'en-US' unless ENV['LOCALE']
27
- I18n.load_path += Dir['config/locales/*.{rb,yml}']
28
- I18n.default_locale = ENV['LOCALE']
29
- I18n.locale = ENV['LOCALE']
30
- Faker::Config.locale = ENV['LOCALE']
31
-
32
- # instantiate all data objects and target test environment
33
- include WorldData
34
- ENV['DATA_SOURCE'] = 'yaml' unless ENV['DATA_SOURCE']
35
- environs.find_environ(ENV['TEST_ENVIRONMENT'], ENV['DATA_SOURCE'].downcase.to_sym)
36
- WorldData.instantiate_data_objects
37
-
38
- # instantiate all page objects
39
- include WorldPages
40
- WorldPages.instantiate_page_objects
41
-
42
- # establish connection to WebDriver and target web browser
43
- Webdrivers.cache_time = 86_400
44
-
45
-
46
- url = if Environ.test_environment == :local
47
- "file://#{File.dirname(__FILE__)}/../../test_site"
48
- else
49
- Environ.current.app_host
50
- end
51
- WebDriverConnect.initialize_web_driver(app_host: url)
@@ -1,270 +0,0 @@
1
-
2
- BeforeAll do
3
- # start Appium Server if command line option was specified and target browser is mobile simulator or device
4
- if ENV['APPIUM_SERVER'] == 'run' && Environ.driver == :appium
5
- $server = TestCentricity::AppiumServer.new
6
- $server.start
7
- end
8
- end
9
-
10
-
11
- AfterAll do
12
- # terminate Appium Server if command line option was specified and target browser is mobile simulator or device
13
- if ENV['APPIUM_SERVER'] == 'run' && Environ.driver == :appium && $server.running?
14
- $server.stop
15
- end
16
- # close driver
17
- terminate_session
18
- end
19
-
20
-
21
- Before do |scenario|
22
- # if executing tests in parallel concurrent threads, print thread number with scenario name
23
- message = Environ.parallel ? "Thread ##{Environ.process_num} | Scenario: #{scenario.name}" : "Scenario: #{scenario.name}"
24
- log message
25
- $initialized ||= false
26
- unless $initialized
27
- $initialized = true
28
- $test_start_time = Time.now
29
- # HTML report header information if reporting is enabled
30
- log Environ.report_header if ENV['REPORTING']
31
- end
32
- end
33
-
34
-
35
- After do |scenario|
36
- # process and embed any screenshots recorded during execution of scenario
37
- process_embed_screenshots(scenario)
38
- # clear out any queued screenshots
39
- Environ.reset_contexts
40
- # close any external pages that may have been opened
41
- if Environ.external_page
42
- Browsers.close_current_browser_instance
43
- begin
44
- page.driver.browser.switch_to.alert.accept
45
- Browsers.switch_to_new_browser_instance
46
- rescue
47
- end
48
- Environ.set_external_page(false)
49
- end
50
- # block any JavaScript modals that may appear as a result of ending the session
51
- Browsers.suppress_js_leave_page_modal
52
- # close Capybara Appium driver if it was opened
53
- Capybara.page.driver.quit if Capybara.default_driver == :appium
54
-
55
- if ENV['QUIT_DRIVER']
56
- terminate_session
57
- elsif Environ.grid == :browserstack
58
- # restart BrowserStack test sessions if test duration exceeds 110 minutes to avoid the 2 hour test limit
59
- test_elapsed_time = Time.now - $test_start_time
60
- if test_elapsed_time > 6600
61
- terminate_session
62
- log 'Restarting BrowserStack test session'
63
- $test_start_time = Time.now
64
- else
65
- Capybara.reset_sessions!
66
- end
67
- end
68
- end
69
-
70
-
71
- # exclusionary Around hooks to prevent running feature/scenario on unsupported browsers, devices, or
72
- # cloud remote browser hosting platforms. Use the following tags to block test execution:
73
- # desktop web browsers: @!safari, @!ie, @!firefox, @!chrome, @!edge
74
- # mobile devices: @!ipad, @!iphone
75
- # remotely hosted browsers: @!browserstack, @!saucelabs
76
-
77
- # block feature/scenario execution if running against Safari browser
78
- Around('@!safari') do |scenario, block|
79
- qualify_browser(:safari, 'Safari', scenario, block)
80
- end
81
-
82
-
83
- # block feature/scenario execution if running against Internet Explorer browser
84
- Around('@!ie') do |scenario, block|
85
- qualify_browser(:ie, 'Internet Explorer', scenario, block)
86
- end
87
-
88
-
89
- # block feature/scenario execution if running against Microsoft Edge browser
90
- Around('@!edge') do |scenario, block|
91
- qualify_browser(:edge, 'Edge', scenario, block)
92
- end
93
-
94
-
95
- # block feature/scenario execution if running against Chrome browser
96
- Around('@!chrome') do |scenario, block|
97
- qualify_browser(:chrome, 'Chrome', scenario, block)
98
- end
99
-
100
-
101
- # block feature/scenario execution if running against Firefox browser
102
- Around('@!firefox') do |scenario, block|
103
- qualify_browser(:firefox, 'Firefox', scenario, block)
104
- end
105
-
106
-
107
- Around('@!firefox_headless') do |scenario, block|
108
- qualify_browser(:firefox_headless, 'Firefox headless', scenario, block)
109
- end
110
-
111
-
112
- # block feature/scenario execution if running against iPad mobile browser
113
- Around('@!ipad') do |scenario, block|
114
- qualify_device('ipad', scenario, block)
115
- end
116
-
117
-
118
- # block feature/scenario execution if running against iPhone mobile browser
119
- Around('@!iphone') do |scenario, block|
120
- qualify_device('iphone', scenario, block)
121
- end
122
-
123
-
124
- # block feature/scenario execution if running on Selenium Grid or cloud-hosted services
125
- Around('@!grid') do |scenario, block|
126
- if !Environ.grid
127
- block.call
128
- else
129
- log "Scenario '#{scenario.name}' cannot be executed on Selenium Grid or cloud-hosted services."
130
- skip_this_scenario
131
- end
132
- end
133
-
134
-
135
- # block feature/scenario execution if running against Browserstack cloud-hosted service
136
- Around('@!browserstack') do |scenario, block|
137
- if Environ.grid != :browserstack
138
- block.call
139
- else
140
- log "Scenario '#{scenario.name}' cannot be executed on the BrowserStack service."
141
- skip_this_scenario
142
- end
143
- end
144
-
145
-
146
- # block feature/scenario execution if running against Sauce Labs cloud-hosted service
147
- Around('@!saucelabs') do |scenario, block|
148
- if Environ.grid != :saucelabs
149
- block.call
150
- else
151
- log "Scenario '#{scenario.name}' cannot be executed on the SauceLabs service."
152
- skip_this_scenario
153
- end
154
- end
155
-
156
-
157
- # block feature/scenario execution if running against a physical or emulated mobile device
158
- Around('@!device') do |scenario, block|
159
- if Environ.is_device?
160
- log "Scenario '#{scenario.name}' cannot be executed on physical or emulated devices."
161
- skip_this_scenario
162
- else
163
- block.call
164
- end
165
- end
166
-
167
-
168
- Around('@!ios') do |scenario, block|
169
- if Environ.device_os == :android
170
- block.call
171
- else
172
- log "Scenario '#{scenario.name}' can not be executed on iOS devices."
173
- skip_this_scenario
174
- end
175
- end
176
-
177
-
178
- Around('@!android') do |scenario, block|
179
- if Environ.device_os == :ios
180
- block.call
181
- else
182
- log "Scenario '#{scenario.name}' can not be executed on Android devices."
183
- skip_this_scenario
184
- end
185
- end
186
-
187
-
188
- Around('@!mobile') do |scenario, block|
189
- if Environ.platform == :mobile
190
- log "Scenario '#{scenario.name}' is not executed on mobile devices or simulators."
191
- skip_this_scenario
192
- else
193
- block.call
194
- end
195
- end
196
-
197
-
198
- Around('@!headless') do |scenario, block|
199
- if Environ.headless
200
- log "Scenario '#{scenario.name}' is not executed on headless browsers."
201
- skip_this_scenario
202
- else
203
- block.call
204
- end
205
- end
206
-
207
-
208
- Around('@!firefox_grid') do |scenario, block|
209
- if Environ.browser == :firefox && Environ.grid
210
- log "Scenario '#{scenario.name}' can not be executed on grid hosted Firefox browsers."
211
- skip_this_scenario
212
- else
213
- block.call
214
- end
215
- end
216
-
217
-
218
- # supporting methods
219
-
220
- def qualify_browser(browser_type, browser_name, scenario, block)
221
- if Environ.browser != browser_type && ENV['HOST_BROWSER'] != browser_name.downcase
222
- block.call
223
- else
224
- log "Scenario '#{scenario.name}' cannot be executed with the #{browser_name} browser."
225
- skip_this_scenario
226
- end
227
- end
228
-
229
- def qualify_device(device, scenario, block)
230
- if Environ.is_device?
231
- if Environ.device_type.include? device
232
- log "Scenario '#{scenario.name}' cannot be executed on #{device} devices."
233
- skip_this_scenario
234
- else
235
- block.call
236
- end
237
- else
238
- block.call
239
- end
240
- end
241
-
242
- def terminate_session
243
- Capybara.page.driver.quit
244
- Capybara.reset_sessions!
245
- Environ.session_state = :quit
246
- $driver_scenario_count = 0
247
- end
248
-
249
- def screen_shot_and_save_page(scenario)
250
- timestamp = Time.now.strftime('%Y%m%d%H%M%S%L')
251
- filename = scenario.nil? ? "Screenshot-#{timestamp}.png" : "Screenshot-#{scenario.__id__}-#{timestamp}.png"
252
- path = File.join Dir.pwd, 'reports/screenshots/', filename
253
- save_screenshot path
254
- log "Screenshot saved at #{path}"
255
- screen_shot = { path: path, filename: filename }
256
- Environ.save_screen_shot(screen_shot)
257
- attach(path, 'image/png') unless scenario.nil?
258
- end
259
-
260
- def process_embed_screenshots(scenario)
261
- screen_shots = Environ.get_screen_shots
262
- if screen_shots.count > 0
263
- screen_shots.each do |row|
264
- path = row[:path]
265
- attach(path, 'image/png')
266
- end
267
- else
268
- screen_shot_and_save_page(scenario) if scenario.failed?
269
- end
270
- end
@@ -1,22 +0,0 @@
1
- # Page Object class definition for Base Test page
2
-
3
- class BaseTestPage < TestCentricity::PageObject
4
- # Base Test page UI elements
5
- label :header_label, 'h2#header'
6
- sections header_nav: NavHeader
7
-
8
- def navigate_to
9
- navigator
10
- end
11
-
12
- def verify_page_ui
13
- # verify page title and header
14
- ui = {
15
- self => { exists: true, secure: false, title: page_title },
16
- header_label => { visible: true, caption: page_title }
17
- }
18
- verify_ui_states(ui)
19
- # verify header navigation bar
20
- header_nav.verify_nav_bar
21
- end
22
- end
@@ -1,53 +0,0 @@
1
- # Page Object class definition for Basic HTML Form page with CSS locators
2
-
3
- class BasicCSSFormPage < BasicFormPage
4
- trait(:page_name) { 'Basic CSS Form' }
5
- trait(:page_locator) { 'form#HTMLFormElements' }
6
-
7
- # Basic HTML Test page UI elements
8
- textfields username_field: 'input#username',
9
- password_field: 'input#password',
10
- max_length_field: 'input#maxlength',
11
- read_only_field: 'input#readonly',
12
- number_field: 'input#number-field',
13
- color_picker: 'input#color-picker',
14
- comments_field: 'textarea#comments'
15
- ranges slider: 'input#slider'
16
- filefields upload_file: 'input#filename'
17
- checkboxes check_1: 'input#check1',
18
- check_2: 'input#check2',
19
- check_3: 'input#check3',
20
- check_4: 'input#check4'
21
- radios radio_1: 'input#radio1',
22
- radio_2: 'input#radio2',
23
- radio_3: 'input#radio3',
24
- radio_4: 'input#radio4'
25
- selectlists multi_select: 'select#multipleselect',
26
- drop_down_select: 'select#dropdown'
27
- lists links_list: 'ul#links_list'
28
- links link_1: 'a#link1',
29
- link_2: 'a#link2',
30
- link_3: 'a#link3'
31
- tables static_table: 'table#table'
32
- images image_1: 'img#image1',
33
- image_2: 'img#image2',
34
- image_3: 'img#image3'
35
- buttons cancel_button: 'input#cancel',
36
- submit_button: 'input#submit'
37
- labels username_label: "label[for='username']",
38
- password_label: "label[for='password']",
39
- max_length_label: "label[for='maxlength']",
40
- read_only_label: "label[for='readonly']",
41
- number_label: "label[for='number-field']",
42
- color_label: "label[for='color-picker']",
43
- slider_label: "label[for='slider']",
44
- comments_label: "label[for='comments']",
45
- filename_label: "label[for='filename']",
46
- checkboxes_label: 'label#checkboxes',
47
- radios_label: 'label#radios',
48
- multiselect_label: "label[for='multipleselect']",
49
- dropdown_label: "label[for='dropdown']",
50
- link_label: 'label#links',
51
- table_label: "label[for='table']",
52
- images_label: 'label#images'
53
- end