lib/calabash/device.rb in calabash-1.9.9.pre2 vs lib/calabash/device.rb in calabash-1.9.9.pre3
- old
+ new
@@ -1,89 +1,105 @@
module Calabash
class Device
include Utility
+ # @!visibility private
@@default = nil
+ # @!visibility private
def self.default
@@default
end
+ # @!visibility private
def self.default=(value)
@@default = value
end
- attr_reader :identifier, :server, :http_client, :logger
+ attr_reader :identifier
+ # @!visibility private
+ attr_reader :server, :http_client, :logger
# Create a new device.
# @param [String] identifier A token that uniquely identifies the device.
# On iOS, this is the device UDID, or a simulator name or UDID returned by
# `$ xcrun instruments -s devices`.
# On Android, this is the serial of the device, emulator or simulator
# returned by `$ adb devices`.
- # @param [Server] server A server object.
+ # @param [Calabash::Server] server A server object.
#
- # @return [Device] A device.
+ # @return [Calabash::Device] A device.
+ # @!visibility public
def initialize(identifier, server, options={})
@identifier = identifier
@server = server
@logger = options[:logger] || Calabash::Logger.new
@http_client = HTTP::RetriableClient.new(server, options.fetch(:http_options, {}))
end
+ # @!visibility private
def change_server(new_server)
@server = new_server
@http_client.change_server(new_server)
end
# Start the application and the test server
+ # @!visibility private
def start_app(path_or_application, options={})
application = parse_path_or_app_parameters(path_or_application)
_start_app(application, options)
end
# Shutdown the application and the test server
+ # @!visibility private
def stop_app
_stop_app
end
# @see Screenshot#screenshot
+ # @!visibility private
def screenshot(name=nil)
path = Screenshot.obtain_screenshot_path!(name)
_screenshot(path)
end
+ # @!visibility private
def install_app(path_or_application)
application = parse_path_or_app_parameters(path_or_application)
_install_app(application)
end
+ # @!visibility private
def ensure_app_installed(path_or_application)
application = parse_path_or_app_parameters(path_or_application)
_ensure_app_installed(application)
end
+ # @!visibility private
def uninstall_app(path_or_application)
application = parse_path_or_app_parameters(path_or_application)
_uninstall_app(application)
end
+ # @!visibility private
def clear_app_data(path_or_application)
application = parse_path_or_app_parameters(path_or_application)
_clear_app_data(application)
end
+ # @!visibility private
def set_location(location)
abstract_method!
end
+ # @!visibility private
def dump
request = HTTP::Request.new('/dump')
JSON.parse(http_client.get(request, timeout: 60).body)
end
@@ -92,10 +108,11 @@
class EnsureTestServerReadyTimeoutError < RuntimeError; end
# Ensures the test server is ready
#
# @raise [RuntimeError] Raises error when the server does not respond
+ # @!visibility private
def ensure_test_server_ready(options={})
begin
Timeout.timeout(options.fetch(:timeout, 30), EnsureTestServerReadyTimeoutError) do
loop do
break if test_server_responding?
@@ -111,10 +128,11 @@
abstract_method!
end
# Performs a `tap` on the (first) view that matches `query`.
# @see Calabash::Gestures#tap
+ # @!visibility private
def tap(query, options={})
Query.ensure_valid_query(query)
gesture_options = options.dup
gesture_options[:at] ||= {}
@@ -128,10 +146,11 @@
_tap(query, gesture_options)
end
# Performs a `double_tap` on the (first) view that matches `query`.
# @see Calabash::Gestures#double_tap
+ # @!visibility private
def double_tap(query, options={})
Query.ensure_valid_query(query)
gesture_options = options.dup
gesture_options[:at] ||= {}
@@ -145,10 +164,11 @@
_double_tap(query, gesture_options)
end
# Performs a `long_press` on the (first) view that matches `query`.
# @see Calabash::Gestures#long_press
+ # @!visibility private
def long_press(query, options={})
Query.ensure_valid_query(query)
gesture_options = options.dup
gesture_options[:at] ||= {}
@@ -163,10 +183,11 @@
_long_press(query, gesture_options)
end
# Performs a `pan` on the (first) view that matches `query`.
# @see Calabash::Gestures#pan
+ # @!visibility private
def pan(query, from, to, options={})
Query.ensure_valid_query(query)
ensure_valid_swipe_params(from, to)
@@ -177,10 +198,11 @@
_pan(query, from, to, gesture_options)
end
# Performs a `pan` between two elements.
# @see Calabash::Gestures#pan_between
+ # @!visibility private
def pan_between(query_from, query_to, options={})
Query.ensure_valid_query(query_from)
Query.ensure_valid_query(query_to)
gesture_options = options.dup
@@ -190,10 +212,11 @@
_pan_between(query_from, query_to, gesture_options)
end
# Performs a `flick` on the (first) view that matches `query`.
# @see Calabash::Gestures#flick
+ # @!visibility private
def flick(query, from, to, options={})
Query.ensure_valid_query(query)
ensure_valid_swipe_params(from, to)
@@ -203,10 +226,11 @@
_flick(query, from, to, gesture_options)
end
# @see Calabash::Gestures#pinch
+ # @!visibility private
def pinch(direction, query, options={})
Query.ensure_valid_query(query)
unless direction == :out || direction == :in
raise ArgumentError, "Invalid direction '#{direction}'"
@@ -218,9 +242,10 @@
_pinch(direction, query, gesture_options)
end
# Enter `text` into the currently focused view.
# @see Calabash::Text#enter_text
+ # @!visibility private
def enter_text(text)
abstract_method!
end
# @!visibility private