Skip to content

Commit 29f031a

Browse files
authored
Ignore server version check for grid (#600)
* update grid configurations * rescure 500 error for remote_status * add some comments
1 parent 1b7a4b4 commit 29f031a

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

grid/appium.txt.ios.example

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
[caps]
22
platformName = "ios"
33
platformVersion = "10.3"
4-
deviceName = "iPhone Simulator"
5-
browserName = "Safari"
4+
deviceName ="iPhone Simulator"
5+
automationName = 'XCUITest'
6+
app = "/absolute/path/to/UICatalog.app"
67
some_capability = "some_capability"
78

89
[appium_lib]

grid/config.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"capabilities":
33
[
44
{
5-
"browserName": "Safari",
5+
"browserName": "iPhone Simulator",
66
"version":"9.0",
77
"platform":"MAC",
88
"maxInstances": 1

lib/appium_lib/device/device.rb

+2-1
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,8 @@ def app_installed?(app_id)
241241
add_endpoint_method(:background_app) do
242242
def background_app(duration = 0)
243243
# https://github.com/appium/ruby_lib/issues/500, https://github.com/appium/appium/issues/7741
244-
if $driver.automation_name_is_xcuitest? && $driver.appium_server_status['build']['version'] >= '1.6.4'
244+
# `execute :background_app, {}, seconds: { timeout: duration_milli_sec }` works over Appium 1.6.4
245+
if $driver.automation_name_is_xcuitest?
245246
duration_milli_sec = duration.nil? ? nil : duration * 1000
246247
execute :background_app, {}, seconds: { timeout: duration_milli_sec }
247248
else

lib/appium_lib/driver.rb

+10
Original file line numberDiff line numberDiff line change
@@ -502,13 +502,23 @@ def check_server_version_xcuitest
502502
# }
503503
# ```
504504
#
505+
# Returns blank hash for Selenium Grid since `remote_status` gets 500 error
506+
#
507+
# ```ruby
508+
# {}
509+
# ```
510+
#
505511
# @return [Hash]
506512
def appium_server_version
507513
driver.remote_status
508514
rescue Selenium::WebDriver::Error::WebDriverError => ex
509515
raise unless ex.message.include?('content-type=""')
510516
# server (TestObject for instance) does not respond to status call
511517
{}
518+
rescue Selenium::WebDriver::Error::ServerError => e
519+
raise unless e.message.include?('status code 500')
520+
# driver.remote_status returns 500 error for using selenium grid
521+
{}
512522
end
513523

514524
# Returns the client's version info

0 commit comments

Comments
 (0)