Skip to content

Commit

Permalink
Fail driver on server error
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve Kirkland committed Dec 20, 2024
1 parent cbfdb24 commit 85eaa21
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/maze/api/appium/file_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def write_app_file(contents, filename)
rescue Selenium::WebDriver::Error::UnknownError => e
$logger.error "Error writing file to device: #{e.message}"
false
rescue Selenium::WebDriver::Error::ServerError => e
# Assume the remote appium session has stopped, so crash out of the session
fail_driver
raise e
end

# Attempts to retrieve a given file from the device (using Appium). The default location for the file will be
Expand Down Expand Up @@ -62,6 +66,10 @@ def read_app_file(filename, directory = nil)
rescue Selenium::WebDriver::Error::UnknownError => e
$logger.error "Error reading file from device: #{e.message}"
false
rescue Selenium::WebDriver::Error::ServerError => e
# Assume the remote appium session has stopped, so crash out of the session
fail_driver
raise e
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/maze/api/appium/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ def initialize
def failed_driver?
@driver.failed?
end

def fail_driver
@driver.fail_driver
end
end
end
end
Expand Down

0 comments on commit 85eaa21

Please sign in to comment.