testcentricity 2.4.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (127) 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 -1378
  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 +355 -111
  56. data/lib/testcentricity/app_core/screen_object.rb +252 -0
  57. data/lib/testcentricity/app_core/screen_objects_helper.rb +29 -280
  58. data/lib/testcentricity/app_core/screen_section.rb +350 -0
  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/app_core/screen_sections_helper.rb +0 -491
  94. data/lib/testcentricity/browser_helper.rb +0 -174
  95. data/lib/testcentricity/data_objects/data_objects_helper.rb +0 -78
  96. data/lib/testcentricity/data_objects/excel_helper.rb +0 -242
  97. data/lib/testcentricity/exception_queue_helper.rb +0 -111
  98. data/lib/testcentricity/utility_helpers.rb +0 -28
  99. data/lib/testcentricity/web_core/drag_drop_helper.rb +0 -15
  100. data/lib/testcentricity/web_core/page_objects_helper.rb +0 -711
  101. data/lib/testcentricity/web_core/page_sections_helper.rb +0 -932
  102. data/lib/testcentricity/web_core/webdriver_helper.rb +0 -588
  103. data/lib/testcentricity/web_elements/button.rb +0 -8
  104. data/lib/testcentricity/web_elements/cell_button.rb +0 -8
  105. data/lib/testcentricity/web_elements/cell_checkbox.rb +0 -38
  106. data/lib/testcentricity/web_elements/cell_element.rb +0 -69
  107. data/lib/testcentricity/web_elements/cell_image.rb +0 -8
  108. data/lib/testcentricity/web_elements/cell_radio.rb +0 -31
  109. data/lib/testcentricity/web_elements/checkbox.rb +0 -100
  110. data/lib/testcentricity/web_elements/file_field.rb +0 -45
  111. data/lib/testcentricity/web_elements/image.rb +0 -34
  112. data/lib/testcentricity/web_elements/label.rb +0 -8
  113. data/lib/testcentricity/web_elements/link.rb +0 -8
  114. data/lib/testcentricity/web_elements/list.rb +0 -100
  115. data/lib/testcentricity/web_elements/list_button.rb +0 -8
  116. data/lib/testcentricity/web_elements/list_checkbox.rb +0 -38
  117. data/lib/testcentricity/web_elements/list_element.rb +0 -61
  118. data/lib/testcentricity/web_elements/list_radio.rb +0 -31
  119. data/lib/testcentricity/web_elements/radio.rb +0 -74
  120. data/lib/testcentricity/web_elements/select_list.rb +0 -208
  121. data/lib/testcentricity/web_elements/siebel_open_ui_helper.rb +0 -15
  122. data/lib/testcentricity/web_elements/table.rb +0 -612
  123. data/lib/testcentricity/web_elements/textfield.rb +0 -114
  124. data/lib/testcentricity/web_elements/ui_elements_helper.rb +0 -532
  125. data/lib/testcentricity/world_extensions.rb +0 -26
  126. data/my_templates/default/method_details/setup.rb +0 -3
  127. data/spec/testcentricity_spec.rb +0 -9
@@ -0,0 +1,350 @@
1
+ require 'test/unit'
2
+
3
+ module TestCentricity
4
+ class ScreenSection < BaseScreenSectionObject
5
+ include Test::Unit::Assertions
6
+
7
+ attr_reader :context, :name
8
+ attr_accessor :locator
9
+ attr_accessor :parent
10
+ attr_accessor :parent_list
11
+ attr_accessor :list_index
12
+
13
+ def initialize(name, parent, locator, context)
14
+ @name = name
15
+ @parent = parent
16
+ @locator = locator
17
+ @context = context
18
+ @parent_list = nil
19
+ @list_index = nil
20
+ end
21
+
22
+ def get_locator
23
+ if @locator.zero? && defined?(section_locator)
24
+ my_locator = section_locator
25
+ else
26
+ my_locator = @locator
27
+ end
28
+ locators = []
29
+ if @context == :section && !@parent.nil?
30
+ locators.push(@parent.get_locator)
31
+ end
32
+
33
+ if @parent_list.nil?
34
+ locators.push(my_locator)
35
+ else
36
+ locators.push(@parent_list.get_locator)
37
+ if @list_index.nil?
38
+ locators.push(my_locator)
39
+ else
40
+ list_key = my_locator.keys[0]
41
+ list_value = "#{my_locator.values[0]}[#{@list_index}]"
42
+ locators.push( { list_key => list_value } )
43
+ end
44
+ end
45
+ locators
46
+ end
47
+
48
+ def set_list_index(list, index = 1)
49
+ @parent_list = list unless list.nil?
50
+ @list_index = index
51
+ end
52
+
53
+ def get_item_count
54
+ raise 'No parent list defined' if @parent_list.nil?
55
+ @parent_list.get_item_count
56
+ end
57
+
58
+ def get_list_items
59
+ items = []
60
+ (1..get_item_count).each do |item|
61
+ set_list_index(nil, item)
62
+ items.push(get_value)
63
+ end
64
+ items
65
+ end
66
+
67
+ def get_object_type
68
+ :section
69
+ end
70
+
71
+ def get_name
72
+ @name
73
+ end
74
+
75
+ def set_parent(parent)
76
+ @parent = parent
77
+ end
78
+
79
+ def self.trait(trait_name, &block)
80
+ define_method(trait_name.to_s, &block)
81
+ end
82
+
83
+ def self.element(element_name, locator)
84
+ define_section_element(element_name, TestCentricity::AppUIElement, locator)
85
+ end
86
+
87
+ def self.elements(element_hash)
88
+ element_hash.each do |element_name, locator|
89
+ element(element_name, locator)
90
+ end
91
+ end
92
+
93
+ def self.button(element_name, locator)
94
+ define_section_element(element_name, TestCentricity::AppButton, locator)
95
+ end
96
+
97
+ def self.buttons(element_hash)
98
+ element_hash.each do |element_name, locator|
99
+ button(element_name, locator)
100
+ end
101
+ end
102
+
103
+ def self.textfield(element_name, locator)
104
+ define_section_element(element_name, TestCentricity::AppTextField, locator)
105
+ end
106
+
107
+ def self.textfields(element_hash)
108
+ element_hash.each do |element_name, locator|
109
+ textfield(element_name, locator)
110
+ end
111
+ end
112
+
113
+ def self.switch(element_name, locator)
114
+ define_section_element(element_name, TestCentricity::AppSwitch, locator)
115
+ end
116
+
117
+ def self.switches(element_hash)
118
+ element_hash.each do |element_name, locator|
119
+ switch(element_name, locator)
120
+ end
121
+ end
122
+
123
+ def self.checkbox(element_name, locator)
124
+ define_section_element(element_name, TestCentricity::AppCheckBox, locator)
125
+ end
126
+
127
+ def self.checkboxes(element_hash)
128
+ element_hash.each do |element_name, locator|
129
+ checkbox(element_name, locator)
130
+ end
131
+ end
132
+
133
+ def self.label(element_name, locator)
134
+ define_section_element(element_name, TestCentricity::AppLabel, locator)
135
+ end
136
+
137
+ def self.labels(element_hash)
138
+ element_hash.each do |element_name, locator|
139
+ label(element_name, locator)
140
+ end
141
+ end
142
+
143
+ def self.list(element_name, locator)
144
+ define_section_element(element_name, TestCentricity::AppList, locator)
145
+ end
146
+
147
+ def self.lists(element_hash)
148
+ element_hash.each do |element_name, locator|
149
+ list(element_name, locator)
150
+ end
151
+ end
152
+
153
+ def self.selectlist(element_name, locator)
154
+ define_section_element(element_name, TestCentricity::AppSelectList, locator)
155
+ end
156
+
157
+ def self.selectlists(element_hash)
158
+ element_hash.each do |element_name, locator|
159
+ selectlist(element_name, locator)
160
+ end
161
+ end
162
+
163
+ def self.image(element_name, locator)
164
+ define_section_element(element_name, TestCentricity::AppImage, locator)
165
+ end
166
+
167
+ def self.images(element_hash)
168
+ element_hash.each do |element_name, locator|
169
+ image(element_name, locator)
170
+ end
171
+ end
172
+
173
+ def self.alert(element_name, locator)
174
+ define_method(element_name) do
175
+ ivar_name = "@#{element_name}"
176
+ ivar = instance_variable_get(ivar_name)
177
+ return ivar if ivar
178
+ instance_variable_set(ivar_name, TestCentricity::AppAlert.new(element_name, self, locator, :page))
179
+ end
180
+ end
181
+
182
+ def self.section(section_name, obj, locator = 0)
183
+ define_section_element(section_name, obj, locator)
184
+ end
185
+
186
+ def self.sections(section_hash)
187
+ section_hash.each do |section_name, class_name|
188
+ section(section_name, class_name)
189
+ end
190
+ end
191
+
192
+
193
+ def click
194
+ section = find_section
195
+ section_not_found_exception(section)
196
+ section.click
197
+ end
198
+
199
+ def tap
200
+ section = find_section
201
+ section_not_found_exception(section)
202
+ x = section.location.x
203
+ y = section.location.y
204
+ tap_action = Appium::TouchAction.new.tap(element: section, x: x, y: y)
205
+ tap_action.perform
206
+ end
207
+
208
+ def double_tap
209
+ section = find_section
210
+ section_not_found_exception(section)
211
+ x = section.location.x
212
+ y = section.location.y
213
+ tap_action = Appium::TouchAction.new.double_tap(element: section, x: x, y: y)
214
+ tap_action.perform
215
+ end
216
+
217
+ def exists?
218
+ section = find_section
219
+ section != nil
220
+ end
221
+
222
+ def enabled?
223
+ section = find_section
224
+ section_not_found_exception(section)
225
+ section.enabled?
226
+ end
227
+
228
+ def disabled?
229
+ section = find_section
230
+ section_not_found_exception(section)
231
+ section.enabled?
232
+ end
233
+
234
+ def visible?
235
+ section = find_section
236
+ return false if section.nil?
237
+
238
+ section.displayed?
239
+ end
240
+
241
+ def hidden?
242
+ !visible?
243
+ end
244
+
245
+ def wait_until_exists(seconds = nil, post_exception = true)
246
+ timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
247
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
248
+ wait.until { exists? }
249
+ rescue
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
255
+ end
256
+
257
+ def wait_until_gone(seconds = nil, post_exception = true)
258
+ timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
259
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
260
+ wait.until { !exists? }
261
+ rescue
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
267
+ end
268
+
269
+ def wait_until_visible(seconds = nil, post_exception = true)
270
+ timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
271
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
272
+ wait.until { visible? }
273
+ rescue
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
279
+ end
280
+
281
+ def wait_until_hidden(seconds = nil, post_exception = true)
282
+ timeout = seconds.nil? ? Environ.default_max_wait_time : seconds
283
+ wait = Selenium::WebDriver::Wait.new(timeout: timeout)
284
+ wait.until { hidden? }
285
+ rescue
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
291
+ end
292
+
293
+
294
+ def width
295
+ section = find_section
296
+ section_not_found_exception(section)
297
+ section.size.width
298
+ end
299
+
300
+ def height
301
+ section = find_section
302
+ section_not_found_exception(section)
303
+ section.size.height
304
+ end
305
+
306
+ def x_loc
307
+ section = find_section
308
+ section_not_found_exception(section)
309
+ section.location.x
310
+ end
311
+
312
+ def y_loc
313
+ section = find_section
314
+ section_not_found_exception(section)
315
+ section.location.y
316
+ end
317
+
318
+ private
319
+
320
+ def find_section
321
+ obj = nil
322
+ locators = get_locator
323
+ locators.each do |loc|
324
+ if obj.nil?
325
+ obj = find_element(loc.keys[0], loc.values[0])
326
+ puts "Found object #{loc}" if ENV['DEBUG']
327
+ else
328
+ obj = obj.find_element(loc.keys[0], loc.values[0])
329
+ puts "Found object #{loc}" if ENV['DEBUG']
330
+ end
331
+ end
332
+ obj
333
+ rescue
334
+ nil
335
+ end
336
+
337
+ def section_not_found_exception(obj)
338
+ raise ObjectNotFoundError.new("Section object '#{get_name}' (#{get_locator}) not found") unless obj
339
+ end
340
+
341
+ def self.define_section_element(element_name, obj, locator)
342
+ define_method(element_name) do
343
+ ivar_name = "@#{element_name}"
344
+ ivar = instance_variable_get(ivar_name)
345
+ return ivar if ivar
346
+ instance_variable_set(ivar_name, obj.new(element_name, self, locator, :section))
347
+ end
348
+ end
349
+ end
350
+ end
@@ -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.1'
2
+ VERSION = '3.0.0'
3
3
  end