lib/calabash-cucumber/device_agent.rb in calabash-cucumber-0.20.3 vs lib/calabash-cucumber/device_agent.rb in calabash-cucumber-0.20.4

- old
+ new

@@ -22,10 +22,32 @@ def initialize(client, world) @client = client @world = world end + # @!visibility private + def to_s + if client.running? + version = client.server_version["bundle_short_version"] + else + version = "not connected!" + end + "#<DeviceAgent API: #{version}>" + end + + # @!visibility private + def inspect + to_s + end + + # @!visibility private + # https://github.com/awesome-print/awesome_print/pull/253 + # Awesome print patch for BasicObject + def ai(_) + to_s + end + # Query the UI for elements. # # @example # query({id: "login", :type "Button"}) # @@ -111,9 +133,14 @@ # @see http://masilotti.com/xctest-documentation/Constants/XCUIElementType.html # @param [Hash] uiquery A hash describing the query. # @return [Array<Hash>] An array of elements matching the `uiquery`. def query(uiquery) client.query(uiquery) + end + + # Perform a clear text on the active view + def clear_text + client.clear_text end # Query for the center of a view. # # @see #query