Sha256: b3702ac726e8d5524b5a535cc2b2269b64ef2768f83da5c250195fd7491e524a

Contents?: true

Size: 1.06 KB

Versions: 40

Compression:

Stored size: 1.06 KB

Contents

require 'calabash-cucumber'

module Briar
  module UIA

    def uia_handle_target_command(cmd, *query_args)
      args = query_args.map do |part|
        if part.is_a?(String)
          "#{escape_uia_string(part)}"
        else
          "#{escape_uia_string(part.to_edn)}"
        end
      end
      command = %Q[target.#{cmd}(#{args.join(', ')})]
      if ENV['DEBUG'] == '1'
        puts 'Sending UIA command'
        puts command
      end
      s=send_uia_command :command => command
      if ENV['DEBUG'] == '1'
        puts 'Result'
        p s
      end
      if s['status'] == 'success'
        s['value']
      else
        raise s
      end
    end

    def uia_touch_with_options(point, opts={})
      defaults = {:tap_count => 1,
                  :touch_count => 1,
                  :duration => 0.0}
      opts = defaults.merge(opts)
      pt = "{x: #{point[:x]}, y: #{point[:y]}}"
      args = "{tapCount: #{opts[:tap_count]}, touchCount: #{opts[:touch_count]}, duration: #{opts[:duration]}}"
      uia_handle_target_command(:tapWithOptions, pt, args)
    end

  end
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
briar-1.1.3 lib/briar/uia/briar_uia.rb
briar-1.1.2 lib/briar/uia/briar_uia.rb
briar-1.1.1 lib/briar/uia/briar_uia.rb
briar-1.1.0 lib/briar/uia/briar_uia.rb
briar-1.0.1 lib/briar/uia/briar_uia.rb
briar-0.1.4 lib/briar/uia/briar_uia.rb
briar-1.0.0 lib/briar/uia/briar_uia.rb
briar-0.1.4.b3 lib/briar/uia/briar_uia.rb
briar-0.1.4.b2 lib/briar/uia/briar_uia.rb
briar-0.1.4.b1 lib/briar/uia/briar_uia.rb
briar-0.1.3 lib/briar/uia/briar_uia.rb
briar-0.1.3.rc1 lib/briar/uia/briar_uia.rb
briar-0.1.3.b11 lib/briar/uia/briar_uia.rb
briar-0.1.3.b10 lib/briar/uia/briar_uia.rb
briar-0.1.3.b9 lib/briar/uia/briar_uia.rb
briar-0.1.3.b8 lib/briar/uia/briar_uia.rb
briar-0.1.3.b7 lib/briar/uia/briar_uia.rb
briar-0.1.3.b6 lib/briar/uia/briar_uia.rb
briar-0.1.3.b5 lib/briar/uia/briar_uia.rb
briar-0.1.3.b4 lib/briar/uia/briar_uia.rb