testcentricity 2.4.3 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +29 -0
  3. data/.rspec +2 -1
  4. data/.rubocop.yml +38 -0
  5. data/.ruby-version +1 -1
  6. data/.simplecov +9 -0
  7. data/.yardopts +3 -0
  8. data/CHANGELOG.md +275 -0
  9. data/CODE_OF_CONDUCT.md +13 -0
  10. data/{LICENSE.txt → LICENSE.md} +3 -4
  11. data/README.md +938 -1384
  12. data/Rakefile +63 -1
  13. data/config/cucumber.yml +145 -0
  14. data/config/locales/en-US.yml +56 -0
  15. data/config/test_data/LOCAL_data.yml +11 -0
  16. data/config/test_data/data.yml +10 -0
  17. data/features/deep_links.feature +26 -0
  18. data/features/login.feature +30 -0
  19. data/features/navigation.feature +31 -0
  20. data/features/step_definitions/generic_steps.rb +72 -0
  21. data/features/support/android/screens/about_screen.rb +11 -0
  22. data/features/support/android/screens/base_app_screen.rb +29 -0
  23. data/features/support/android/screens/checkout_address_screen.rb +17 -0
  24. data/features/support/android/screens/checkout_payment_screen.rb +22 -0
  25. data/features/support/android/screens/login_screen.rb +18 -0
  26. data/features/support/android/screens/products_screen.rb +13 -0
  27. data/features/support/android/screens/saucebot_screen.rb +16 -0
  28. data/features/support/android/screens/webview_screen.rb +13 -0
  29. data/features/support/android/sections/nav_widgets/nav_menu.rb +39 -0
  30. data/features/support/env.rb +61 -0
  31. data/features/support/hooks.rb +135 -0
  32. data/features/support/ios/screens/about_screen.rb +11 -0
  33. data/features/support/ios/screens/base_app_screen.rb +19 -0
  34. data/features/support/ios/screens/checkout_address_screen.rb +17 -0
  35. data/features/support/ios/screens/checkout_payment_screen.rb +22 -0
  36. data/features/support/ios/screens/login_screen.rb +18 -0
  37. data/features/support/ios/screens/products_screen.rb +13 -0
  38. data/features/support/ios/screens/saucebot_screen.rb +16 -0
  39. data/features/support/ios/screens/webview_screen.rb +13 -0
  40. data/features/support/ios/sections/list_items/product_cell_item.rb +13 -0
  41. data/features/support/ios/sections/modals/base_modal.rb +23 -0
  42. data/features/support/ios/sections/modals/logout_modal.rb +6 -0
  43. data/features/support/ios/sections/modals/reset_app_state_modal.rb +6 -0
  44. data/features/support/ios/sections/nav_widgets/nav_bar.rb +31 -0
  45. data/features/support/ios/sections/nav_widgets/nav_menu.rb +41 -0
  46. data/features/support/shared_components/screens/base_app_screen.rb +31 -0
  47. data/features/support/shared_components/screens/checkout_address_screen.rb +17 -0
  48. data/features/support/shared_components/screens/checkout_payment_screen.rb +22 -0
  49. data/features/support/shared_components/screens/login_screen.rb +39 -0
  50. data/features/support/shared_components/screens/saucebot_screen.rb +17 -0
  51. data/features/support/shared_components/screens/webview_screen.rb +12 -0
  52. data/features/support/shared_components/sections/nav_menu.rb +58 -0
  53. data/features/support/world_data.rb +12 -0
  54. data/features/support/world_pages.rb +26 -0
  55. data/lib/testcentricity/app_core/appium_connect_helper.rb +343 -111
  56. data/lib/testcentricity/app_core/screen_object.rb +252 -0
  57. data/lib/testcentricity/app_core/screen_objects_helper.rb +29 -201
  58. data/lib/testcentricity/app_core/{screen_sections_helper.rb → screen_section.rb} +40 -105
  59. data/lib/testcentricity/app_elements/app_element_helper.rb +17 -8
  60. data/lib/testcentricity/app_elements/checkbox.rb +3 -3
  61. data/lib/testcentricity/data_objects/environment.rb +133 -39
  62. data/lib/testcentricity/version.rb +1 -1
  63. data/lib/testcentricity.rb +4 -129
  64. data/reports/.keep +1 -0
  65. data/spec/fixtures/page_object.rb +22 -0
  66. data/spec/fixtures/page_section_object.rb +21 -0
  67. data/spec/fixtures/screen_object.rb +16 -0
  68. data/spec/fixtures/screen_section_object.rb +16 -0
  69. data/spec/spec_helper.rb +28 -9
  70. data/spec/testcentricity/elements/button_spec.rb +18 -0
  71. data/spec/testcentricity/elements/checkbox_spec.rb +28 -0
  72. data/spec/testcentricity/elements/image_spec.rb +13 -0
  73. data/spec/testcentricity/elements/label_spec.rb +18 -0
  74. data/spec/testcentricity/elements/list_spec.rb +13 -0
  75. data/spec/testcentricity/elements/ui_element_spec.rb +72 -0
  76. data/spec/testcentricity/mobile/appium_connect_spec.rb +117 -0
  77. data/spec/testcentricity/mobile/screen_object_spec.rb +63 -0
  78. data/spec/testcentricity/mobile/screen_section_object_spec.rb +56 -0
  79. data/spec/testcentricity/version_spec.rb +7 -0
  80. data/spec/testcentricity/web/browser_spec.rb +41 -0
  81. data/spec/testcentricity/web/local_webdriver_spec.rb +86 -0
  82. data/spec/testcentricity/web/mobile_webdriver_spec.rb +123 -0
  83. data/spec/testcentricity/web/page_object_spec.rb +85 -0
  84. data/spec/testcentricity/web/page_section_object_spec.rb +72 -0
  85. data/testcentricity.gemspec +28 -27
  86. metadata +196 -127
  87. data/.ruby-gemset +0 -1
  88. data/Gemfile.lock +0 -93
  89. data/bin/console +0 -14
  90. data/bin/setup +0 -8
  91. data/lib/devices/devices.yml +0 -352
  92. data/lib/testcentricity/app_core/appium_server.rb +0 -69
  93. data/lib/testcentricity/browser_helper.rb +0 -174
  94. data/lib/testcentricity/data_objects/data_objects_helper.rb +0 -78
  95. data/lib/testcentricity/data_objects/excel_helper.rb +0 -242
  96. data/lib/testcentricity/exception_queue_helper.rb +0 -111
  97. data/lib/testcentricity/utility_helpers.rb +0 -32
  98. data/lib/testcentricity/web_core/drag_drop_helper.rb +0 -15
  99. data/lib/testcentricity/web_core/page_objects_helper.rb +0 -677
  100. data/lib/testcentricity/web_core/page_sections_helper.rb +0 -895
  101. data/lib/testcentricity/web_core/webdriver_helper.rb +0 -588
  102. data/lib/testcentricity/web_elements/button.rb +0 -8
  103. data/lib/testcentricity/web_elements/cell_button.rb +0 -8
  104. data/lib/testcentricity/web_elements/cell_checkbox.rb +0 -38
  105. data/lib/testcentricity/web_elements/cell_element.rb +0 -69
  106. data/lib/testcentricity/web_elements/cell_image.rb +0 -8
  107. data/lib/testcentricity/web_elements/cell_radio.rb +0 -31
  108. data/lib/testcentricity/web_elements/checkbox.rb +0 -100
  109. data/lib/testcentricity/web_elements/file_field.rb +0 -45
  110. data/lib/testcentricity/web_elements/image.rb +0 -34
  111. data/lib/testcentricity/web_elements/label.rb +0 -8
  112. data/lib/testcentricity/web_elements/link.rb +0 -8
  113. data/lib/testcentricity/web_elements/list.rb +0 -100
  114. data/lib/testcentricity/web_elements/list_button.rb +0 -8
  115. data/lib/testcentricity/web_elements/list_checkbox.rb +0 -38
  116. data/lib/testcentricity/web_elements/list_element.rb +0 -61
  117. data/lib/testcentricity/web_elements/list_radio.rb +0 -31
  118. data/lib/testcentricity/web_elements/radio.rb +0 -74
  119. data/lib/testcentricity/web_elements/select_list.rb +0 -208
  120. data/lib/testcentricity/web_elements/siebel_open_ui_helper.rb +0 -15
  121. data/lib/testcentricity/web_elements/table.rb +0 -612
  122. data/lib/testcentricity/web_elements/textfield.rb +0 -114
  123. data/lib/testcentricity/web_elements/ui_elements_helper.rb +0 -532
  124. data/lib/testcentricity/world_extensions.rb +0 -26
  125. data/my_templates/default/method_details/setup.rb +0 -3
  126. data/spec/testcentricity_spec.rb +0 -9
@@ -1,7 +1,7 @@
1
1
  require 'test/unit'
2
2
 
3
3
  module TestCentricity
4
- class ScreenSection
4
+ class ScreenSection < BaseScreenSectionObject
5
5
  include Test::Unit::Assertions
6
6
 
7
7
  attr_reader :context, :name
@@ -81,7 +81,7 @@ module TestCentricity
81
81
  end
82
82
 
83
83
  def self.element(element_name, locator)
84
- define_element(element_name, TestCentricity::AppUIElement, locator)
84
+ define_section_element(element_name, TestCentricity::AppUIElement, locator)
85
85
  end
86
86
 
87
87
  def self.elements(element_hash)
@@ -91,7 +91,7 @@ module TestCentricity
91
91
  end
92
92
 
93
93
  def self.button(element_name, locator)
94
- define_element(element_name, TestCentricity::AppButton, locator)
94
+ define_section_element(element_name, TestCentricity::AppButton, locator)
95
95
  end
96
96
 
97
97
  def self.buttons(element_hash)
@@ -101,7 +101,7 @@ module TestCentricity
101
101
  end
102
102
 
103
103
  def self.textfield(element_name, locator)
104
- define_element(element_name, TestCentricity::AppTextField, locator)
104
+ define_section_element(element_name, TestCentricity::AppTextField, locator)
105
105
  end
106
106
 
107
107
  def self.textfields(element_hash)
@@ -111,7 +111,7 @@ module TestCentricity
111
111
  end
112
112
 
113
113
  def self.switch(element_name, locator)
114
- define_element(element_name, TestCentricity::AppSwitch, locator)
114
+ define_section_element(element_name, TestCentricity::AppSwitch, locator)
115
115
  end
116
116
 
117
117
  def self.switches(element_hash)
@@ -121,7 +121,7 @@ module TestCentricity
121
121
  end
122
122
 
123
123
  def self.checkbox(element_name, locator)
124
- define_element(element_name, TestCentricity::AppCheckBox, locator)
124
+ define_section_element(element_name, TestCentricity::AppCheckBox, locator)
125
125
  end
126
126
 
127
127
  def self.checkboxes(element_hash)
@@ -131,7 +131,7 @@ module TestCentricity
131
131
  end
132
132
 
133
133
  def self.label(element_name, locator)
134
- define_element(element_name, TestCentricity::AppLabel, locator)
134
+ define_section_element(element_name, TestCentricity::AppLabel, locator)
135
135
  end
136
136
 
137
137
  def self.labels(element_hash)
@@ -141,7 +141,7 @@ module TestCentricity
141
141
  end
142
142
 
143
143
  def self.list(element_name, locator)
144
- define_element(element_name, TestCentricity::AppList, locator)
144
+ define_section_element(element_name, TestCentricity::AppList, locator)
145
145
  end
146
146
 
147
147
  def self.lists(element_hash)
@@ -151,7 +151,7 @@ module TestCentricity
151
151
  end
152
152
 
153
153
  def self.selectlist(element_name, locator)
154
- define_element(element_name, TestCentricity::AppSelectList, locator)
154
+ define_section_element(element_name, TestCentricity::AppSelectList, locator)
155
155
  end
156
156
 
157
157
  def self.selectlists(element_hash)
@@ -161,7 +161,7 @@ module TestCentricity
161
161
  end
162
162
 
163
163
  def self.image(element_name, locator)
164
- define_element(element_name, TestCentricity::AppImage, locator)
164
+ define_section_element(element_name, TestCentricity::AppImage, locator)
165
165
  end
166
166
 
167
167
  def self.images(element_hash)
@@ -180,7 +180,7 @@ module TestCentricity
180
180
  end
181
181
 
182
182
  def self.section(section_name, obj, locator = 0)
183
- define_element(section_name, obj, locator)
183
+ define_section_element(section_name, obj, locator)
184
184
  end
185
185
 
186
186
  def self.sections(section_hash)
@@ -232,47 +232,62 @@ module TestCentricity
232
232
  end
233
233
 
234
234
  def visible?
235
- if exists?
236
- section.displayed?
237
- else
238
- false
239
- end
235
+ section = find_section
236
+ return false if section.nil?
237
+
238
+ section.displayed?
240
239
  end
241
240
 
242
241
  def hidden?
243
242
  !visible?
244
243
  end
245
244
 
246
- def wait_until_exists(seconds = nil)
245
+ def wait_until_exists(seconds = nil, post_exception = true)
247
246
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
248
247
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
249
248
  wait.until { exists? }
250
249
  rescue
251
- raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless exists?
250
+ if post_exception
251
+ raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless exists?
252
+ else
253
+ exists?
254
+ end
252
255
  end
253
256
 
254
- def wait_until_gone(seconds = nil)
257
+ def wait_until_gone(seconds = nil, post_exception = true)
255
258
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
256
259
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
257
260
  wait.until { !exists? }
258
261
  rescue
259
- raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if exists?
262
+ if post_exception
263
+ raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if exists?
264
+ else
265
+ exists?
266
+ end
260
267
  end
261
268
 
262
- def wait_until_visible(seconds = nil)
269
+ def wait_until_visible(seconds = nil, post_exception = true)
263
270
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
264
271
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
265
272
  wait.until { visible? }
266
273
  rescue
267
- raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless visible?
274
+ if post_exception
275
+ raise "Could not find Section object '#{get_name}' (#{get_locator}) after #{timeout} seconds" unless visible?
276
+ else
277
+ visible?
278
+ end
268
279
  end
269
280
 
270
- def wait_until_hidden(seconds = nil)
281
+ def wait_until_hidden(seconds = nil, post_exception = true)
271
282
  timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
272
283
  wait = Selenium::WebDriver::Wait.new(timeout: timeout)
273
284
  wait.until { hidden? }
274
285
  rescue
275
- raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if visible?
286
+ if post_exception
287
+ raise "Section object '#{get_name}' (#{get_locator}) remained visible after #{timeout} seconds" if visible?
288
+ else
289
+ visible?
290
+ end
276
291
  end
277
292
 
278
293
 
@@ -300,86 +315,6 @@ module TestCentricity
300
315
  section.location.y
301
316
  end
302
317
 
303
-
304
- def verify_ui_states(ui_states)
305
- ui_states.each do |ui_object, object_states|
306
- object_states.each do |property, state|
307
-
308
- puts "#{ui_object.get_name} - #{property} = #{state}" if ENV['DEBUG']
309
-
310
- case property
311
- when :class
312
- actual = ui_object.get_attribute(:class)
313
- when :exists
314
- actual = ui_object.exists?
315
- when :enabled
316
- actual = ui_object.enabled?
317
- when :disabled
318
- actual = ui_object.disabled?
319
- when :visible
320
- actual = ui_object.visible?
321
- when :hidden
322
- actual = ui_object.hidden?
323
- when :checked
324
- actual = ui_object.checked?
325
- when :selected
326
- actual = ui_object.selected?
327
- when :value
328
- actual = ui_object.get_value
329
- when :caption
330
- actual = ui_object.get_caption
331
- when :name
332
- actual = ui_object.tag_name
333
- when :placeholder
334
- actual = ui_object.get_placeholder
335
- when :readonly
336
- actual = ui_object.read_only?
337
- when :maxlength
338
- actual = ui_object.get_max_length
339
- when :items
340
- actual = ui_object.get_list_items
341
- when :itemcount
342
- actual = ui_object.get_item_count
343
- when :width
344
- actual = ui_object.width
345
- when :height
346
- actual = ui_object.height
347
- when :x
348
- actual = ui_object.x_loc
349
- when :y
350
- actual = ui_object.y_loc
351
- end
352
- error_msg = "Expected UI object '#{ui_object.get_name}' (#{ui_object.get_locator}) #{property} property to"
353
- ExceptionQueue.enqueue_comparison(state, actual, error_msg)
354
- end
355
- end
356
- rescue ObjectNotFoundError => e
357
- ExceptionQueue.enqueue_exception(e.message)
358
- ensure
359
- ExceptionQueue.post_exceptions
360
- end
361
-
362
- def populate_data_fields(data, wait_time = nil)
363
- timeout = wait_time.nil? ? 5 : wait_time
364
- data.each do |data_field, data_param|
365
- unless data_param.blank?
366
- # make sure the intended UI target element is visible before trying to set its value
367
- data_field.wait_until_visible(timeout)
368
- if data_param == '!DELETE'
369
- data_field.clear
370
- else
371
- case data_field.get_object_type
372
- when :checkbox
373
- data_field.set_checkbox_state(data_param.to_bool)
374
- when :textfield
375
- data_field.clear
376
- data_field.set("#{data_param}\t")
377
- end
378
- end
379
- end
380
- end
381
- end
382
-
383
318
  private
384
319
 
385
320
  def find_section
@@ -403,7 +338,7 @@ module TestCentricity
403
338
  raise ObjectNotFoundError.new("Section object '#{get_name}' (#{get_locator}) not found") unless obj
404
339
  end
405
340
 
406
- def self.define_element(element_name, obj, locator)
341
+ def self.define_section_element(element_name, obj, locator)
407
342
  define_method(element_name) do
408
343
  ivar_name = "@#{element_name}"
409
344
  ivar = instance_variable_get(ivar_name)
@@ -88,6 +88,8 @@ module TestCentricity
88
88
  end
89
89
  end
90
90
 
91
+ alias value get_value
92
+
91
93
  def get_caption
92
94
  obj = element
93
95
  object_not_found_exception(obj)
@@ -98,18 +100,25 @@ module TestCentricity
98
100
  else
99
101
  obj.text
100
102
  end
101
- elsif Environ.device_os == :ios
103
+ elsif Environ.is_ios?
102
104
  case obj.tag_name
103
105
  when 'XCUIElementTypeNavigationBar'
104
- obj.attribute('name')
106
+ obj.attribute(:name)
105
107
  else
106
- obj.attribute('label')
108
+ obj.attribute(:label)
107
109
  end
108
110
  else
109
- obj.text
111
+ caption = obj.text
112
+ if caption.blank? && obj.attribute(:class) == 'android.view.ViewGroup'
113
+ caption_obj = obj.find_element(:xpath, '//android.widget.TextView')
114
+ caption = caption_obj.text
115
+ end
116
+ caption
110
117
  end
111
118
  end
112
119
 
120
+ alias caption get_caption
121
+
113
122
  def exists?
114
123
  begin
115
124
  element.displayed?
@@ -297,8 +306,8 @@ module TestCentricity
297
306
  def scroll(direction)
298
307
  obj = element
299
308
  object_not_found_exception(obj)
300
- if Environ.device_os == :ios
301
- execute_script('mobile: scroll', direction: direction.to_s, element: obj)
309
+ if Environ.is_ios?
310
+ $driver.execute_script('mobile: scroll', direction: direction.to_s, element: obj)
302
311
  else
303
312
  case direction
304
313
  when :down
@@ -323,8 +332,8 @@ module TestCentricity
323
332
  def swipe(direction)
324
333
  obj = element
325
334
  object_not_found_exception(obj)
326
- if Environ.device_os == :ios
327
- execute_script('mobile: swipe', direction: direction.to_s, element: obj)
335
+ if Environ.is_ios?
336
+ $driver.execute_script('mobile: swipe', direction: direction.to_s, element: obj)
328
337
  else
329
338
  actions = Appium::TouchAction.new
330
339
  actions.scroll(element: obj).perform
@@ -8,7 +8,7 @@ module TestCentricity
8
8
  def checked?
9
9
  obj = element
10
10
  object_not_found_exception(obj)
11
- obj.attribute('checked') == 'true'
11
+ obj.selected?
12
12
  end
13
13
 
14
14
  # Set the check state of a checkbox object.
@@ -33,9 +33,9 @@ module TestCentricity
33
33
  obj = element
34
34
  object_not_found_exception(obj)
35
35
  if state
36
- obj.click unless obj.attribute('checked') == 'true'
36
+ obj.click unless obj.selected?
37
37
  else
38
- obj.click if obj.attribute('checked') == 'true'
38
+ obj.click if obj.selected?
39
39
  end
40
40
  end
41
41
  end
@@ -1,52 +1,44 @@
1
1
  module TestCentricity
2
- class EnvironData < TestCentricity::ExcelDataSource
3
- attr_accessor :current
4
-
5
- WKS_ENVIRONS ||= 'Environments'
6
-
7
- def find_environ(environ_name, source_type = :excel)
8
- case source_type
9
- when :excel
10
- data = ExcelData.read_row_data(XL_PRIMARY_DATA_FILE, WKS_ENVIRONS, environ_name)
11
- when :yaml
12
- data = read_yaml_node_data('environments.yml', environ_name)
13
- when :json
14
- data = read_json_node_data('environments.json', environ_name)
15
- end
16
- @current = Environ.new(data)
17
- Environ.current = @current
18
- end
19
- end
20
-
21
-
22
2
  class Environ < TestCentricity::DataObject
23
3
  @session_id = Time.now.strftime('%d%H%M%S%L')
24
4
  @session_time_stamp = Time.now.strftime('%Y%m%d%H%M%S')
25
- @session_code
26
5
  @test_environment = ENV['TEST_ENVIRONMENT']
6
+ @a11y_standard = ENV['ACCESSIBILITY_STANDARD'] || 'best-practice'
7
+ @locale = ENV['LOCALE'] || 'en'
8
+ @language = ENV['LANGUAGE'] || 'English'
27
9
  @screen_shots = []
28
10
 
29
11
  attr_accessor :test_environment
12
+ attr_accessor :app_host
30
13
  attr_accessor :browser
31
14
  attr_accessor :browser_size
15
+ attr_accessor :headless
32
16
  attr_accessor :session_state
17
+ attr_accessor :session_code
33
18
  attr_accessor :os
34
19
  attr_accessor :device
35
20
  attr_accessor :device_name
36
21
  attr_accessor :device_type
37
22
  attr_accessor :device_os
23
+ attr_accessor :device_os_version
38
24
  attr_accessor :device_orientation
39
25
  attr_accessor :screen_size
40
26
  attr_accessor :platform
41
27
  attr_accessor :driver
28
+ attr_accessor :grid
42
29
  attr_accessor :tunneling
30
+ attr_accessor :locale
31
+ attr_accessor :language
32
+
33
+ attr_accessor :parallel
34
+ attr_accessor :process_num
43
35
 
44
36
  attr_accessor :signed_in
45
37
  attr_accessor :portal_status
46
38
  attr_accessor :portal_context
47
39
  attr_accessor :external_page
48
40
 
49
- attr_accessor :default_max_wait_time
41
+ attr_accessor :a11y_standard
50
42
 
51
43
  attr_accessor :protocol
52
44
  attr_accessor :hostname
@@ -54,33 +46,60 @@ module TestCentricity
54
46
  attr_accessor :user_id
55
47
  attr_accessor :password
56
48
  attr_accessor :append
49
+ attr_accessor :app_id
50
+ attr_accessor :api_key
57
51
  attr_accessor :option1
58
52
  attr_accessor :option2
53
+ attr_accessor :option3
54
+ attr_accessor :option4
59
55
  attr_accessor :dns
60
56
  attr_accessor :db_username
61
57
  attr_accessor :db_password
62
58
  attr_accessor :ios_app_path
63
59
  attr_accessor :ios_ipa_path
64
60
  attr_accessor :android_apk_path
61
+ attr_accessor :default_max_wait_time
62
+ attr_accessor :deep_link_prefix
63
+ attr_accessor :ios_bundle_id
64
+ attr_accessor :android_app_id
65
65
 
66
66
  def initialize(data)
67
- @protocol = data['PROTOCOL']
68
- @hostname = data['HOST_NAME']
69
- @base_url = data['BASE_URL']
70
- @user_id = data['USER_ID']
71
- @password = data['PASSWORD']
72
- @append = data['APPEND']
73
- @option1 = data['OPTIONAL_1']
74
- @option2 = data['OPTIONAL_2']
75
- @dns = data['DNS']
76
- @db_username = data['DB_USERNAME']
77
- @db_password = data['DB_PASSWORD']
78
- @ios_app_path = data['IOS_APP_PATH']
79
- @ios_ipa_path = data['IOS_IPA_PATH']
67
+ @protocol = data['PROTOCOL']
68
+ @hostname = data['HOST_NAME']
69
+ @base_url = data['BASE_URL']
70
+ @user_id = data['USER_ID']
71
+ @password = data['PASSWORD']
72
+ @append = data['APPEND']
73
+ @app_id = data['APP_ID']
74
+ @api_key = data['API_KEY']
75
+ @option1 = data['OPTIONAL_1']
76
+ @option2 = data['OPTIONAL_2']
77
+ @option3 = data['OPTIONAL_3']
78
+ @option4 = data['OPTIONAL_4']
79
+ @dns = data['DNS']
80
+ @db_username = data['DB_USERNAME']
81
+ @db_password = data['DB_PASSWORD']
82
+ @ios_app_path = data['IOS_APP_PATH']
83
+ @ios_ipa_path = data['IOS_IPA_PATH']
80
84
  @android_apk_path = data['ANDROID_APK_PATH']
85
+ @deep_link_prefix = data['DEEP_LINK_PREFIX']
86
+ @ios_bundle_id = data['IOS_BUNDLE_ID']
87
+ @android_app_id = data['ANDROID_APP_ID']
88
+
89
+ url = @hostname.blank? ? "#{@base_url}#{@append}" : "#{@hostname}/#{@base_url}#{@append}"
90
+ @app_host = if @user_id.blank? || @password.blank?
91
+ "#{@protocol}://#{url}"
92
+ else
93
+ "#{@protocol}://#{@user_id}:#{@password}@#{url}"
94
+ end
95
+
81
96
  super
82
97
  end
83
98
 
99
+ def self.app_host
100
+ @app_host
101
+ end
102
+
84
103
  def self.session_code
85
104
  if @session_code.nil?
86
105
  characters = ('a'..'z').to_a
@@ -97,6 +116,22 @@ module TestCentricity
97
116
  @session_time_stamp
98
117
  end
99
118
 
119
+ def self.parallel=(state)
120
+ @parallel = state
121
+ end
122
+
123
+ def self.parallel
124
+ @parallel
125
+ end
126
+
127
+ def self.process_num=(num)
128
+ @process_num = num
129
+ end
130
+
131
+ def self.process_num
132
+ @process_num
133
+ end
134
+
100
135
  def self.test_environment
101
136
  if @test_environment.blank?
102
137
  nil
@@ -131,12 +166,12 @@ module TestCentricity
131
166
  @browser_size
132
167
  end
133
168
 
134
- def self.screen_size=(size)
135
- @screen_size = size
169
+ def self.headless=(state)
170
+ @headless = state
136
171
  end
137
172
 
138
- def self.screen_size
139
- @screen_size
173
+ def self.headless
174
+ @headless
140
175
  end
141
176
 
142
177
  def self.session_state=(session_state)
@@ -199,6 +234,14 @@ module TestCentricity
199
234
  @device_os
200
235
  end
201
236
 
237
+ def self.device_os_version=(version)
238
+ @device_os_version = version
239
+ end
240
+
241
+ def self.device_os_version
242
+ @device_os_version
243
+ end
244
+
202
245
  def self.is_ios?
203
246
  @device_os == :ios
204
247
  end
@@ -215,6 +258,14 @@ module TestCentricity
215
258
  @device_orientation
216
259
  end
217
260
 
261
+ def self.screen_size=(size)
262
+ @screen_size = size
263
+ end
264
+
265
+ def self.screen_size
266
+ @screen_size
267
+ end
268
+
218
269
  def self.driver=(type)
219
270
  @driver = type
220
271
  end
@@ -223,6 +274,14 @@ module TestCentricity
223
274
  @driver
224
275
  end
225
276
 
277
+ def self.grid=(type)
278
+ @grid = type
279
+ end
280
+
281
+ def self.grid
282
+ @grid
283
+ end
284
+
226
285
  def self.tunneling=(state)
227
286
  @tunneling = state
228
287
  end
@@ -231,10 +290,30 @@ module TestCentricity
231
290
  @tunneling
232
291
  end
233
292
 
293
+ def self.language=(language)
294
+ @language = language
295
+ end
296
+
297
+ def self.language
298
+ @language
299
+ end
300
+
301
+ def self.locale=(locale)
302
+ @locale = locale
303
+ end
304
+
305
+ def self.locale
306
+ @locale
307
+ end
308
+
234
309
  def self.platform=(platform)
235
310
  @platform = platform
236
311
  end
237
312
 
313
+ def self.platform
314
+ @platform
315
+ end
316
+
238
317
  def self.is_mobile?
239
318
  @platform == :mobile
240
319
  end
@@ -286,5 +365,20 @@ module TestCentricity
286
365
  def self.reset_contexts
287
366
  @screen_shots = []
288
367
  end
368
+
369
+ # :nocov:
370
+ def self.report_header
371
+ report_header = "\n<b><u>TEST ENVIRONMENT</u>:</b> #{ENV['TEST_ENVIRONMENT']}\n"\
372
+ " <b>Target:</b>\t #{Environ.browser.capitalize}\n"
373
+ report_header = "#{report_header} <b>Device:</b>\t #{Environ.device_name}\n" if Environ.device_name
374
+ report_header = "#{report_header} <b>Device OS:</b>\t #{Environ.device_os} #{Environ.device_os_version}\n" if Environ.device_os
375
+ report_header = "#{report_header} <b>Device type:</b>\t #{Environ.device_type}\n" if Environ.device_type
376
+ report_header = "#{report_header} <b>OS:</b>\t\t #{Environ.os}\n" if Environ.os
377
+ report_header = "#{report_header} <b>Locale:</b>\t #{Environ.locale}\n" if Environ.locale
378
+ report_header = "#{report_header} <b>Language:</b>\t #{Environ.language}\n" if Environ.language
379
+ report_header = "#{report_header} <b>Country:</b>\t #{ENV['COUNTRY']}\n" if ENV['COUNTRY']
380
+ "#{report_header}\n\n"
381
+ end
382
+ # :nocov:
289
383
  end
290
384
  end
@@ -1,3 +1,3 @@
1
1
  module TestCentricity
2
- VERSION = '2.4.3'
2
+ VERSION = '3.0.0'
3
3
  end