testcentricity 2.4.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +29 -0
- data/.rspec +2 -1
- data/.rubocop.yml +38 -0
- data/.ruby-version +1 -1
- data/.simplecov +9 -0
- data/.yardopts +3 -0
- data/CHANGELOG.md +275 -0
- data/CODE_OF_CONDUCT.md +13 -0
- data/{LICENSE.txt → LICENSE.md} +3 -4
- data/README.md +938 -1384
- data/Rakefile +63 -1
- data/config/cucumber.yml +145 -0
- data/config/locales/en-US.yml +56 -0
- data/config/test_data/LOCAL_data.yml +11 -0
- data/config/test_data/data.yml +10 -0
- data/features/deep_links.feature +26 -0
- data/features/login.feature +30 -0
- data/features/navigation.feature +31 -0
- data/features/step_definitions/generic_steps.rb +72 -0
- data/features/support/android/screens/about_screen.rb +11 -0
- data/features/support/android/screens/base_app_screen.rb +29 -0
- data/features/support/android/screens/checkout_address_screen.rb +17 -0
- data/features/support/android/screens/checkout_payment_screen.rb +22 -0
- data/features/support/android/screens/login_screen.rb +18 -0
- data/features/support/android/screens/products_screen.rb +13 -0
- data/features/support/android/screens/saucebot_screen.rb +16 -0
- data/features/support/android/screens/webview_screen.rb +13 -0
- data/features/support/android/sections/nav_widgets/nav_menu.rb +39 -0
- data/features/support/env.rb +61 -0
- data/features/support/hooks.rb +135 -0
- data/features/support/ios/screens/about_screen.rb +11 -0
- data/features/support/ios/screens/base_app_screen.rb +19 -0
- data/features/support/ios/screens/checkout_address_screen.rb +17 -0
- data/features/support/ios/screens/checkout_payment_screen.rb +22 -0
- data/features/support/ios/screens/login_screen.rb +18 -0
- data/features/support/ios/screens/products_screen.rb +13 -0
- data/features/support/ios/screens/saucebot_screen.rb +16 -0
- data/features/support/ios/screens/webview_screen.rb +13 -0
- data/features/support/ios/sections/list_items/product_cell_item.rb +13 -0
- data/features/support/ios/sections/modals/base_modal.rb +23 -0
- data/features/support/ios/sections/modals/logout_modal.rb +6 -0
- data/features/support/ios/sections/modals/reset_app_state_modal.rb +6 -0
- data/features/support/ios/sections/nav_widgets/nav_bar.rb +31 -0
- data/features/support/ios/sections/nav_widgets/nav_menu.rb +41 -0
- data/features/support/shared_components/screens/base_app_screen.rb +31 -0
- data/features/support/shared_components/screens/checkout_address_screen.rb +17 -0
- data/features/support/shared_components/screens/checkout_payment_screen.rb +22 -0
- data/features/support/shared_components/screens/login_screen.rb +39 -0
- data/features/support/shared_components/screens/saucebot_screen.rb +17 -0
- data/features/support/shared_components/screens/webview_screen.rb +12 -0
- data/features/support/shared_components/sections/nav_menu.rb +58 -0
- data/features/support/world_data.rb +12 -0
- data/features/support/world_pages.rb +26 -0
- data/lib/testcentricity/app_core/appium_connect_helper.rb +343 -111
- data/lib/testcentricity/app_core/screen_object.rb +252 -0
- data/lib/testcentricity/app_core/screen_objects_helper.rb +29 -201
- data/lib/testcentricity/app_core/{screen_sections_helper.rb → screen_section.rb} +40 -105
- data/lib/testcentricity/app_elements/app_element_helper.rb +17 -8
- data/lib/testcentricity/app_elements/checkbox.rb +3 -3
- data/lib/testcentricity/data_objects/environment.rb +133 -39
- data/lib/testcentricity/version.rb +1 -1
- data/lib/testcentricity.rb +4 -129
- data/reports/.keep +1 -0
- data/spec/fixtures/page_object.rb +22 -0
- data/spec/fixtures/page_section_object.rb +21 -0
- data/spec/fixtures/screen_object.rb +16 -0
- data/spec/fixtures/screen_section_object.rb +16 -0
- data/spec/spec_helper.rb +28 -9
- data/spec/testcentricity/elements/button_spec.rb +18 -0
- data/spec/testcentricity/elements/checkbox_spec.rb +28 -0
- data/spec/testcentricity/elements/image_spec.rb +13 -0
- data/spec/testcentricity/elements/label_spec.rb +18 -0
- data/spec/testcentricity/elements/list_spec.rb +13 -0
- data/spec/testcentricity/elements/ui_element_spec.rb +72 -0
- data/spec/testcentricity/mobile/appium_connect_spec.rb +117 -0
- data/spec/testcentricity/mobile/screen_object_spec.rb +63 -0
- data/spec/testcentricity/mobile/screen_section_object_spec.rb +56 -0
- data/spec/testcentricity/version_spec.rb +7 -0
- data/spec/testcentricity/web/browser_spec.rb +41 -0
- data/spec/testcentricity/web/local_webdriver_spec.rb +86 -0
- data/spec/testcentricity/web/mobile_webdriver_spec.rb +123 -0
- data/spec/testcentricity/web/page_object_spec.rb +85 -0
- data/spec/testcentricity/web/page_section_object_spec.rb +72 -0
- data/testcentricity.gemspec +28 -27
- metadata +196 -127
- data/.ruby-gemset +0 -1
- data/Gemfile.lock +0 -93
- data/bin/console +0 -14
- data/bin/setup +0 -8
- data/lib/devices/devices.yml +0 -352
- data/lib/testcentricity/app_core/appium_server.rb +0 -69
- data/lib/testcentricity/browser_helper.rb +0 -174
- data/lib/testcentricity/data_objects/data_objects_helper.rb +0 -78
- data/lib/testcentricity/data_objects/excel_helper.rb +0 -242
- data/lib/testcentricity/exception_queue_helper.rb +0 -111
- data/lib/testcentricity/utility_helpers.rb +0 -32
- data/lib/testcentricity/web_core/drag_drop_helper.rb +0 -15
- data/lib/testcentricity/web_core/page_objects_helper.rb +0 -677
- data/lib/testcentricity/web_core/page_sections_helper.rb +0 -895
- data/lib/testcentricity/web_core/webdriver_helper.rb +0 -588
- data/lib/testcentricity/web_elements/button.rb +0 -8
- data/lib/testcentricity/web_elements/cell_button.rb +0 -8
- data/lib/testcentricity/web_elements/cell_checkbox.rb +0 -38
- data/lib/testcentricity/web_elements/cell_element.rb +0 -69
- data/lib/testcentricity/web_elements/cell_image.rb +0 -8
- data/lib/testcentricity/web_elements/cell_radio.rb +0 -31
- data/lib/testcentricity/web_elements/checkbox.rb +0 -100
- data/lib/testcentricity/web_elements/file_field.rb +0 -45
- data/lib/testcentricity/web_elements/image.rb +0 -34
- data/lib/testcentricity/web_elements/label.rb +0 -8
- data/lib/testcentricity/web_elements/link.rb +0 -8
- data/lib/testcentricity/web_elements/list.rb +0 -100
- data/lib/testcentricity/web_elements/list_button.rb +0 -8
- data/lib/testcentricity/web_elements/list_checkbox.rb +0 -38
- data/lib/testcentricity/web_elements/list_element.rb +0 -61
- data/lib/testcentricity/web_elements/list_radio.rb +0 -31
- data/lib/testcentricity/web_elements/radio.rb +0 -74
- data/lib/testcentricity/web_elements/select_list.rb +0 -208
- data/lib/testcentricity/web_elements/siebel_open_ui_helper.rb +0 -15
- data/lib/testcentricity/web_elements/table.rb +0 -612
- data/lib/testcentricity/web_elements/textfield.rb +0 -114
- data/lib/testcentricity/web_elements/ui_elements_helper.rb +0 -532
- data/lib/testcentricity/world_extensions.rb +0 -26
- data/my_templates/default/method_details/setup.rb +0 -3
- data/spec/testcentricity_spec.rb +0 -9
@@ -0,0 +1,12 @@
|
|
1
|
+
module WorldData
|
2
|
+
#
|
3
|
+
# data_objects method returns a hash table of your web app's data objects and associated data object classes to be instantiated
|
4
|
+
# by the TestCentricity™ DataManager. Data Object class definitions are contained in the features/support/data folder.
|
5
|
+
#
|
6
|
+
def data_objects
|
7
|
+
{}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
World(WorldData)
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module WorldPages
|
2
|
+
|
3
|
+
#
|
4
|
+
# The page_objects method returns a hash table of your web or native mobile app's page objects and associated page
|
5
|
+
# classes to be instantiated by the TestCentricity PageManager.
|
6
|
+
#
|
7
|
+
# Web Page Object class definitions are contained in the features/support/web/pages folder.
|
8
|
+
# iOS Screen Object class definitions are contained in the features/support/ios/screens folder.
|
9
|
+
# Android Screen Object class definitions are contained in the features/support/android/screens folder.
|
10
|
+
#
|
11
|
+
def page_objects
|
12
|
+
{
|
13
|
+
base_app_screen: BaseAppScreen,
|
14
|
+
about_screen: AboutScreen,
|
15
|
+
login_screen: LoginScreen,
|
16
|
+
webview_screen: WebViewScreen,
|
17
|
+
products_screen: ProductsScreen,
|
18
|
+
checkout_address_screen: CheckoutAddressScreen,
|
19
|
+
checkout_payment_screen: CheckoutPaymentScreen,
|
20
|
+
saucebot_video_screen: SauceBotScreen
|
21
|
+
}
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
World(WorldPages)
|
@@ -1,61 +1,84 @@
|
|
1
1
|
require 'appium_lib'
|
2
|
+
require 'curb'
|
3
|
+
require 'json'
|
2
4
|
|
3
5
|
|
4
6
|
module TestCentricity
|
5
7
|
module AppiumConnect
|
6
8
|
|
7
9
|
attr_accessor :running
|
8
|
-
attr_accessor :
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
attr_accessor :endpoint
|
11
|
+
attr_accessor :capabilities
|
12
|
+
|
13
|
+
def self.initialize_appium(options = nil)
|
14
|
+
@endpoint = nil
|
15
|
+
@capabilities = nil
|
16
|
+
if options.is_a?(Hash)
|
17
|
+
@endpoint = options[:endpoint] if options.key?(:endpoint)
|
18
|
+
@capabilities = options[:desired_capabilities] if options.key?(:desired_capabilities)
|
19
|
+
end
|
20
|
+
Environ.platform = :mobile
|
21
|
+
Environ.driver = :appium
|
13
22
|
Environ.device_type = ENV['DEVICE_TYPE'] if ENV['DEVICE_TYPE']
|
14
|
-
Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
15
23
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
24
|
+
Environ.device_orientation = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
25
|
+
Environ.device_os_version = ENV['APP_VERSION']
|
26
|
+
browser = ENV['WEB_BROWSER']
|
27
|
+
Environ.browser = browser
|
28
|
+
case browser.downcase.to_sym
|
29
|
+
when :appium
|
30
|
+
Environ.device_name = ENV['APP_DEVICE']
|
31
|
+
Environ.device_os = ENV['APP_PLATFORM_NAME']
|
32
|
+
Environ.device = ENV['UDID'] ? :device : :simulator
|
33
|
+
when :browserstack
|
34
|
+
Environ.device_name = ENV['BS_DEVICE']
|
35
|
+
Environ.device_os = ENV['BS_OS']
|
36
|
+
Environ.device = :device
|
37
|
+
upload_app(:browserstack) if ENV['UPLOAD_APP']
|
38
|
+
when :saucelabs
|
39
|
+
Environ.device_name = ENV['SL_DEVICE']
|
40
|
+
Environ.device_os = ENV['SL_OS']
|
41
|
+
when :testingbot
|
42
|
+
Environ.device_name = ENV['TB_DEVICE']
|
43
|
+
Environ.device_os = ENV['TB_OS']
|
44
|
+
Environ.device = :device
|
45
|
+
upload_app(:testingbot) if ENV['UPLOAD_APP']
|
46
|
+
when :lambdatest
|
47
|
+
Environ.device_name = ENV['LT_DEVICE']
|
48
|
+
Environ.device_os = ENV['LT_OS']
|
49
|
+
else
|
50
|
+
raise "#{browser} is not a valid selector"
|
30
51
|
end
|
31
52
|
@running = false
|
32
53
|
end
|
33
54
|
|
34
55
|
def self.start_driver
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
puts "Appium desired_capabilities = #{desired_capabilities}" if ENV['DEBUG']
|
56
|
+
browser = Environ.browser
|
57
|
+
capabilities = case browser.downcase.to_sym
|
58
|
+
when :appium
|
59
|
+
appium_local_capabilities
|
60
|
+
when :browserstack
|
61
|
+
browserstack_capabilities
|
62
|
+
when :saucelabs
|
63
|
+
sauce_capabilities
|
64
|
+
when :testingbot
|
65
|
+
testingbot_capabilities
|
66
|
+
when :lambdatest
|
67
|
+
lambdatest_capabilities
|
68
|
+
else
|
69
|
+
raise "#{browser} is not a valid selector"
|
70
|
+
end
|
71
|
+
puts "Appium desired_capabilities = #{capabilities}" if ENV['DEBUG']
|
53
72
|
|
54
|
-
|
73
|
+
desired_capabilities = {
|
74
|
+
caps: capabilities,
|
75
|
+
appium_lib: { server_url: @endpoint }
|
76
|
+
}
|
77
|
+
Appium::Driver.new(desired_capabilities, true).start_driver
|
55
78
|
@running = true
|
56
|
-
Appium.promote_appium_methods
|
57
|
-
Appium.promote_appium_methods
|
58
|
-
Appium.promote_appium_methods
|
79
|
+
Appium.promote_appium_methods(TestCentricity::ScreenObject)
|
80
|
+
Appium.promote_appium_methods(TestCentricity::ScreenSection)
|
81
|
+
Appium.promote_appium_methods(TestCentricity::AppUIElement)
|
59
82
|
|
60
83
|
Environ.screen_size = $driver.window_size
|
61
84
|
end
|
@@ -80,14 +103,18 @@ module TestCentricity
|
|
80
103
|
$driver.install_app(app_path)
|
81
104
|
end
|
82
105
|
|
83
|
-
def self.app_installed?(bundle_id)
|
84
|
-
$driver.app_installed?(bundle_id)
|
106
|
+
def self.app_installed?(bundle_id = nil)
|
107
|
+
$driver.app_installed?(get_app_id(bundle_id))
|
85
108
|
end
|
86
109
|
|
87
110
|
def self.launch_app
|
88
111
|
$driver.launch_app
|
89
112
|
end
|
90
113
|
|
114
|
+
def self.background_app(duration)
|
115
|
+
$driver.background_app(duration)
|
116
|
+
end
|
117
|
+
|
91
118
|
def self.close_app
|
92
119
|
$driver.close_app
|
93
120
|
end
|
@@ -96,8 +123,20 @@ module TestCentricity
|
|
96
123
|
$driver.reset
|
97
124
|
end
|
98
125
|
|
99
|
-
def self.remove_app(bundle_id)
|
100
|
-
$driver.remove_app(bundle_id)
|
126
|
+
def self.remove_app(bundle_id = nil)
|
127
|
+
$driver.remove_app(get_app_id(bundle_id))
|
128
|
+
end
|
129
|
+
|
130
|
+
def self.activate_app(bundle_id = nil)
|
131
|
+
$driver.activate_app(get_app_id(bundle_id))
|
132
|
+
end
|
133
|
+
|
134
|
+
def self.app_state(bundle_id = nil)
|
135
|
+
$driver.app_state(get_app_id(bundle_id))
|
136
|
+
end
|
137
|
+
|
138
|
+
def self.terminate_app(bundle_id = nil)
|
139
|
+
$driver.terminate_app(get_app_id(bundle_id))
|
101
140
|
end
|
102
141
|
|
103
142
|
def self.implicit_wait(timeout)
|
@@ -112,10 +151,18 @@ module TestCentricity
|
|
112
151
|
$driver.is_keyboard_shown
|
113
152
|
end
|
114
153
|
|
154
|
+
def self.orientation
|
155
|
+
$driver.orientation
|
156
|
+
end
|
157
|
+
|
115
158
|
def self.set_orientation(orientation)
|
116
159
|
$driver.rotation = orientation.downcase.to_sym
|
117
160
|
end
|
118
161
|
|
162
|
+
def self.geolocation
|
163
|
+
$driver.location
|
164
|
+
end
|
165
|
+
|
119
166
|
def self.set_geolocation(latitude, longitude, altitude)
|
120
167
|
$driver.set_location(latitude, longitude, altitude)
|
121
168
|
end
|
@@ -152,81 +199,266 @@ module TestCentricity
|
|
152
199
|
puts "Current context = #{$driver.current_context}" if ENV['DEBUG']
|
153
200
|
end
|
154
201
|
|
202
|
+
def self.upload_app(service)
|
203
|
+
case service
|
204
|
+
when :browserstack
|
205
|
+
url = 'https://api-cloud.browserstack.com/app-automate/upload'
|
206
|
+
user_id = ENV['BS_USERNAME']
|
207
|
+
auth_key = ENV['BS_AUTHKEY']
|
208
|
+
when :testingbot
|
209
|
+
url = 'https://api.testingbot.com/v1/storage'
|
210
|
+
user_id = ENV['TB_USERNAME']
|
211
|
+
auth_key = ENV['TB_AUTHKEY']
|
212
|
+
else
|
213
|
+
raise "#{service} is not a valid selector"
|
214
|
+
end
|
215
|
+
|
216
|
+
file_path = if Environ.is_android?
|
217
|
+
Environ.current.android_apk_path
|
218
|
+
elsif Environ.is_ios?
|
219
|
+
Environ.is_device? ?
|
220
|
+
Environ.current.ios_ipa_path :
|
221
|
+
Environ.current.ios_app_path
|
222
|
+
end
|
223
|
+
|
224
|
+
c = Curl::Easy.new(url)
|
225
|
+
c.http_auth_types = :basic
|
226
|
+
c.username = user_id
|
227
|
+
c.password = auth_key
|
228
|
+
c.multipart_form_post = true
|
229
|
+
c.http_post(Curl::PostField.file('file', file_path))
|
230
|
+
result = JSON.parse(c.body_str)
|
231
|
+
puts "app_url = #{result['app_url']}"
|
232
|
+
ENV['APP'] = result['app_url']
|
233
|
+
end
|
234
|
+
|
155
235
|
private
|
156
236
|
|
157
|
-
def self.
|
158
|
-
|
159
|
-
caps: {
|
160
|
-
platformName: ENV['APP_PLATFORM_NAME'],
|
161
|
-
platformVersion: ENV['APP_VERSION'],
|
162
|
-
deviceName: ENV['APP_DEVICE'],
|
163
|
-
automationName: ENV['AUTOMATION_ENGINE']
|
164
|
-
}
|
165
|
-
}
|
166
|
-
capabilities = desired_capabilities[:caps]
|
167
|
-
capabilities[:avd] = ENV['APP_DEVICE'] if ENV['APP_PLATFORM_NAME'].downcase.to_sym == :android
|
168
|
-
capabilities[:orientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
|
169
|
-
capabilities[:language] = ENV['LANGUAGE'] if ENV['LANGUAGE']
|
170
|
-
capabilities[:locale] = ENV['LOCALE'].gsub('-', '_') if ENV['LOCALE']
|
171
|
-
capabilities[:newCommandTimeout] = ENV['NEW_COMMAND_TIMEOUT'] if ENV['NEW_COMMAND_TIMEOUT']
|
172
|
-
capabilities[:noReset] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
|
173
|
-
capabilities[:fullReset] = ENV['APP_FULL_RESET'] if ENV['APP_FULL_RESET']
|
174
|
-
capabilities[:webkitDebugProxyPort] = ENV['WEBKIT_DEBUG_PROXY_PORT'] if ENV['WEBKIT_DEBUG_PROXY_PORT']
|
175
|
-
capabilities[:webDriverAgentUrl] = ENV['WEBDRIVER_AGENT_URL'] if ENV['WEBDRIVER_AGENT_URL']
|
176
|
-
capabilities[:wdaLocalPort] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
|
177
|
-
capabilities[:usePrebuiltWDA] = ENV['USE_PREBUILT_WDA'] if ENV['USE_PREBUILT_WDA']
|
178
|
-
capabilities[:useNewWDA] = ENV['USE_NEW_WDA'] if ENV['USE_NEW_WDA']
|
179
|
-
capabilities[:startIWDP] = ENV['START_IWDP'] if ENV['START_IWDP']
|
180
|
-
capabilities[:autoWebview] = ENV['AUTO_WEBVIEW'] if ENV['AUTO_WEBVIEW']
|
181
|
-
capabilities[:chromedriverExecutable] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
|
182
|
-
capabilities[:autoWebviewTimeout] = ENV['AUTO_WEBVIEW_TIMEOUT'] if ENV['AUTO_WEBVIEW_TIMEOUT']
|
183
|
-
|
184
|
-
if ENV['UDID']
|
185
|
-
capabilities[:udid] = ENV['UDID']
|
186
|
-
capabilities[:bundleId] = ENV['BUNDLE_ID'] if ENV['BUNDLE_ID']
|
187
|
-
capabilities[:xcodeOrgId] = ENV['TEAM_ID'] if ENV['TEAM_ID']
|
188
|
-
capabilities[:xcodeSigningId] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
|
189
|
-
capabilities[:appActivity] = ENV['APP_ACTIVITY'] if ENV['APP_ACTIVITY']
|
190
|
-
capabilities[:appPackage] = ENV['APP_PACKAGE'] if ENV['APP_PACKAGE']
|
191
|
-
end
|
237
|
+
def self.get_app_id(bundle_id = nil)
|
238
|
+
return bundle_id unless bundle_id.nil?
|
192
239
|
|
193
|
-
if
|
194
|
-
|
240
|
+
if Environ.is_ios?
|
241
|
+
Environ.current.ios_bundle_id
|
242
|
+
elsif Environ.is_android?
|
243
|
+
Environ.current.android_app_id
|
195
244
|
else
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
245
|
+
nil
|
246
|
+
end
|
247
|
+
end
|
248
|
+
|
249
|
+
def self.appium_local_capabilities
|
250
|
+
# specify endpoint url
|
251
|
+
@endpoint = 'http://127.0.0.1:4723/wd/hub' if @endpoint.nil?
|
252
|
+
# define local Appium capabilities
|
253
|
+
if @capabilities.nil?
|
254
|
+
caps = {
|
255
|
+
platformName: ENV['APP_PLATFORM_NAME'],
|
256
|
+
platformVersion: ENV['APP_VERSION'],
|
257
|
+
deviceName: ENV['APP_DEVICE'],
|
258
|
+
automationName: ENV['AUTOMATION_ENGINE']
|
259
|
+
}
|
260
|
+
caps[:avd] = ENV['APP_DEVICE'] if ENV['APP_PLATFORM_NAME'].downcase.to_sym == :android
|
261
|
+
caps[:orientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
|
262
|
+
caps[:language] = ENV['LANGUAGE'] if ENV['LANGUAGE']
|
263
|
+
if ENV['LOCALE']
|
264
|
+
caps[:locale] = if Environ.is_android?
|
265
|
+
locale = ENV['LOCALE'].gsub('-', '_')
|
266
|
+
locale.split('_')[1]
|
267
|
+
else
|
268
|
+
ENV['LOCALE'].gsub('-', '_')
|
269
|
+
end
|
270
|
+
end
|
271
|
+
caps[:newCommandTimeout] = ENV['NEW_COMMAND_TIMEOUT'] if ENV['NEW_COMMAND_TIMEOUT']
|
272
|
+
caps[:noReset] = ENV['APP_NO_RESET'] if ENV['APP_NO_RESET']
|
273
|
+
caps[:fullReset] = ENV['APP_FULL_RESET'] if ENV['APP_FULL_RESET']
|
274
|
+
caps[:webkitDebugProxyPort] = ENV['WEBKIT_DEBUG_PROXY_PORT'] if ENV['WEBKIT_DEBUG_PROXY_PORT']
|
275
|
+
caps[:webDriverAgentUrl] = ENV['WEBDRIVER_AGENT_URL'] if ENV['WEBDRIVER_AGENT_URL']
|
276
|
+
caps[:wdaLocalPort] = ENV['WDA_LOCAL_PORT'] if ENV['WDA_LOCAL_PORT']
|
277
|
+
caps[:usePrebuiltWDA] = ENV['USE_PREBUILT_WDA'] if ENV['USE_PREBUILT_WDA']
|
278
|
+
caps[:useNewWDA] = ENV['USE_NEW_WDA'] if ENV['USE_NEW_WDA']
|
279
|
+
caps[:autoWebview] = ENV['AUTO_WEBVIEW'] if ENV['AUTO_WEBVIEW']
|
280
|
+
caps[:chromedriverExecutable] = ENV['CHROMEDRIVER_EXECUTABLE'] if ENV['CHROMEDRIVER_EXECUTABLE']
|
281
|
+
caps[:autoWebviewTimeout] = ENV['AUTO_WEBVIEW_TIMEOUT'] if ENV['AUTO_WEBVIEW_TIMEOUT']
|
282
|
+
caps[:udid] = ENV['UDID'] if ENV['UDID']
|
283
|
+
caps[:xcodeOrgId] = ENV['TEAM_ID'] if ENV['TEAM_ID']
|
284
|
+
caps[:xcodeSigningId] = ENV['TEAM_NAME'] if ENV['TEAM_NAME']
|
285
|
+
caps[:appActivity] = ENV['APP_ACTIVITY'] if ENV['APP_ACTIVITY']
|
286
|
+
caps[:appPackage] = ENV['APP_PACKAGE'] if ENV['APP_PACKAGE']
|
287
|
+
|
288
|
+
if ENV['BUNDLE_ID']
|
289
|
+
caps[:bundleId] = ENV['BUNDLE_ID']
|
290
|
+
else
|
291
|
+
app_id = get_app_id
|
292
|
+
caps[:bundleId] = app_id unless app_id.nil?
|
293
|
+
end
|
294
|
+
|
295
|
+
caps[:app] = if ENV['APP']
|
296
|
+
ENV['APP']
|
297
|
+
else
|
298
|
+
if Environ.is_android?
|
299
|
+
Environ.current.android_apk_path
|
300
|
+
elsif Environ.is_ios?
|
301
|
+
Environ.is_device? ?
|
302
|
+
Environ.current.ios_ipa_path :
|
303
|
+
Environ.current.ios_app_path
|
304
|
+
end
|
202
305
|
end
|
306
|
+
caps
|
307
|
+
else
|
308
|
+
@capabilities
|
203
309
|
end
|
204
|
-
desired_capabilities
|
205
310
|
end
|
206
311
|
|
312
|
+
# :nocov:
|
207
313
|
def self.browserstack_capabilities
|
208
|
-
endpoint
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
314
|
+
# specify endpoint url
|
315
|
+
@endpoint = 'http://hub-cloud.browserstack.com/wd/hub' if @endpoint.nil?
|
316
|
+
# define BrowserStack options
|
317
|
+
options = if @capabilities.nil?
|
318
|
+
# define the required set of BrowserStack options
|
319
|
+
bs_options = {
|
320
|
+
userName: ENV['BS_USERNAME'],
|
321
|
+
accessKey: ENV['BS_AUTHKEY'],
|
322
|
+
sessionName: test_context_message
|
323
|
+
}
|
324
|
+
# define the optional BrowserStack options
|
325
|
+
bs_options[:projectName] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
326
|
+
bs_options[:buildName] = ENV['AUTOMATE_BUILD'] if ENV['AUTOMATE_BUILD']
|
327
|
+
bs_options[:geoLocation] = ENV['IP_GEOLOCATION'] if ENV['IP_GEOLOCATION']
|
328
|
+
bs_options[:timezone] = ENV['TIME_ZONE'] if ENV['TIME_ZONE']
|
329
|
+
bs_options[:video] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
|
330
|
+
bs_options[:debug] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
|
331
|
+
bs_options[:local] = ENV['TUNNELING'] if ENV['TUNNELING']
|
332
|
+
bs_options[:deviceOrientation] = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
333
|
+
bs_options[:appiumLogs] = ENV['APPIUM_LOGS'] if ENV['APPIUM_LOGS']
|
334
|
+
bs_options[:networkLogs] = ENV['NETWORK_LOGS'] if ENV['NETWORK_LOGS']
|
335
|
+
bs_options[:deviceLogs] = ENV['DEVICE_LOGS'] if ENV['DEVICE_LOGS']
|
336
|
+
bs_options[:networkProfile] = ENV['NETWORK_PROFILE'] if ENV['NETWORK_PROFILE']
|
337
|
+
bs_options[:idleTimeout] = ENV['IDLE_TIMEOUT'] if ENV['IDLE_TIMEOUT']
|
338
|
+
bs_options[:resignApp] = ENV['RESIGN_APP'] if ENV['RESIGN_APP']
|
339
|
+
bs_options[:gpsLocation] = ENV['GPS_LOCATION'] if ENV['GPS_LOCATION']
|
340
|
+
bs_options[:acceptInsecureCerts] = ENV['ACCEPT_INSECURE_CERTS'] if ENV['ACCEPT_INSECURE_CERTS']
|
341
|
+
bs_options[:disableAnimations] = ENV['DISABLE_ANIMATION'] if ENV['DISABLE_ANIMATION']
|
342
|
+
bs_options[:appiumVersion] = if ENV['APPIUM_VERSION']
|
343
|
+
ENV['APPIUM_VERSION']
|
344
|
+
else
|
345
|
+
'1.22.0'
|
346
|
+
end
|
347
|
+
capabilities = {
|
348
|
+
platformName: ENV['BS_OS'],
|
349
|
+
platformVersion: ENV['BS_OS_VERSION'],
|
350
|
+
deviceName: ENV['BS_DEVICE'],
|
351
|
+
app: ENV['APP'],
|
352
|
+
'bstack:options': bs_options
|
353
|
+
}
|
354
|
+
capabilities[:language] = ENV['LANGUAGE'] if ENV['LANGUAGE']
|
355
|
+
capabilities[:locale] = ENV['LOCALE'] if ENV['LOCALE']
|
356
|
+
capabilities
|
357
|
+
else
|
358
|
+
@capabilities
|
359
|
+
end
|
360
|
+
options
|
361
|
+
end
|
362
|
+
|
363
|
+
def self.sauce_capabilities
|
364
|
+
# specify endpoint url
|
365
|
+
@endpoint = "https://#{ENV['SL_USERNAME']}:#{ENV['SL_AUTHKEY']}@ondemand.#{ENV['DATA_CENTER']}.saucelabs.com:443/wd/hub" if @endpoint.nil?
|
366
|
+
# define SauceLab options
|
367
|
+
options = if @capabilities.nil?
|
368
|
+
capabilities = {
|
369
|
+
platformName: ENV['SL_OS'],
|
370
|
+
app: ENV['APP'],
|
371
|
+
deviceName: ENV['SL_DEVICE'],
|
372
|
+
platformVersion: ENV['SL_OS_VERSION'],
|
373
|
+
deviceType: ENV['DEVICE_TYPE'],
|
374
|
+
build: test_context_message
|
375
|
+
}
|
376
|
+
capabilities[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
377
|
+
capabilities[:deviceOrientation] = ENV['ORIENTATION'].upcase if ENV['ORIENTATION']
|
378
|
+
capabilities[:recordVideo] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
|
379
|
+
capabilities[:recordScreenshots] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
|
380
|
+
capabilities[:appiumVersion] = if ENV['APPIUM_VERSION']
|
381
|
+
ENV['APPIUM_VERSION']
|
382
|
+
else
|
383
|
+
'1.22.3'
|
384
|
+
end
|
385
|
+
capabilities
|
386
|
+
else
|
387
|
+
@capabilities
|
388
|
+
end
|
389
|
+
options
|
390
|
+
end
|
391
|
+
|
392
|
+
def self.testingbot_capabilities
|
393
|
+
# specify endpoint url
|
394
|
+
@endpoint = "http://#{ENV['TB_USERNAME']}:#{ENV['TB_AUTHKEY']}@hub.testingbot.com/wd/hub" if @endpoint.nil?
|
395
|
+
# define TestingBot options
|
396
|
+
options = if @capabilities.nil?
|
397
|
+
capabilities = {
|
398
|
+
user: ENV['TB_USERNAME'],
|
399
|
+
accessKey: ENV['TB_AUTHKEY'],
|
400
|
+
platformName: ENV['TB_OS'],
|
401
|
+
app: ENV['APP'],
|
402
|
+
deviceName: ENV['TB_DEVICE'],
|
403
|
+
version: ENV['TB_OS_VERSION'],
|
404
|
+
build: test_context_message
|
405
|
+
}
|
406
|
+
capabilities[:realDevice] = ENV['REAL_DEVICE'].to_bool if ENV['REAL_DEVICE']
|
407
|
+
capabilities[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
408
|
+
capabilities
|
409
|
+
else
|
410
|
+
@capabilities
|
411
|
+
end
|
412
|
+
options
|
413
|
+
end
|
414
|
+
|
415
|
+
def self.lambdatest_capabilities
|
416
|
+
# specify endpoint url
|
417
|
+
@endpoint = "https://#{ENV['LT_USERNAME']}:#{ENV['LT_AUTHKEY']}@beta-hub.lambdatest.com/wd/hub" if @endpoint.nil?
|
418
|
+
# define LambdaTest options
|
419
|
+
options = if @capabilities.nil?
|
420
|
+
# define the required set of LambdaTest options
|
421
|
+
lt_options = {
|
422
|
+
deviceName: ENV['LT_DEVICE'],
|
423
|
+
platformName: ENV['LT_OS'],
|
424
|
+
platformVersion: ENV['LT_OS_VERSION'],
|
425
|
+
app: ENV['APP'],
|
426
|
+
w3c: true,
|
427
|
+
build: test_context_message
|
428
|
+
}
|
429
|
+
# define the optional LambdaTest options
|
430
|
+
lt_options[:name] = ENV['AUTOMATE_PROJECT'] if ENV['AUTOMATE_PROJECT']
|
431
|
+
lt_options[:isRealMobile] = ENV['REAL_DEVICE'].to_bool if ENV['REAL_DEVICE']
|
432
|
+
lt_options[:deviceOrientation] = ENV['ORIENTATION'] if ENV['ORIENTATION']
|
433
|
+
lt_options[:geoLocation] = ENV['GEO_LOCATION'] if ENV['GEO_LOCATION']
|
434
|
+
lt_options[:video] = ENV['RECORD_VIDEO'] if ENV['RECORD_VIDEO']
|
435
|
+
lt_options[:visual] = ENV['SCREENSHOTS'] if ENV['SCREENSHOTS']
|
436
|
+
lt_options[:network] = ENV['NETWORK_LOGS'] if ENV['NETWORK_LOGS']
|
437
|
+
lt_options[:deviceLogs] = ENV['DEVICE_LOGS'] if ENV['DEVICE_LOGS']
|
438
|
+
lt_options[:tunnel] = ENV['TUNNELING'] if ENV['TUNNELING']
|
439
|
+
lt_options[:idleTimeout] = ENV['IDLE_TIMEOUT'] if ENV['IDLE_TIMEOUT']
|
440
|
+
|
441
|
+
{ 'LT:Options': lt_options }
|
442
|
+
else
|
443
|
+
@capabilities
|
444
|
+
end
|
445
|
+
options
|
446
|
+
end
|
447
|
+
|
448
|
+
def self.test_context_message
|
449
|
+
context_message = if ENV['TEST_CONTEXT']
|
450
|
+
"#{Environ.test_environment.to_s.upcase} - #{ENV['TEST_CONTEXT']}"
|
451
|
+
else
|
452
|
+
Environ.test_environment.to_s.upcase
|
453
|
+
end
|
454
|
+
if ENV['PARALLEL']
|
455
|
+
thread_num = ENV['TEST_ENV_NUMBER']
|
456
|
+
thread_num = 1 if thread_num.blank?
|
457
|
+
context_message = "#{context_message} - Thread ##{thread_num}"
|
458
|
+
end
|
459
|
+
context_message
|
229
460
|
end
|
461
|
+
# :nocov:
|
230
462
|
end
|
231
463
|
end
|
232
464
|
|