Skip to content

Instantly share code, notes, and snippets.

@leviwilson
Forked from gjinfo737/test.rb
Last active December 17, 2015 21:09
Show Gist options
  • Save leviwilson/5672351 to your computer and use it in GitHub Desktop.
Save leviwilson/5672351 to your computer and use it in GitHub Desktop.
require 'gametel'
Gametel.apk_path = "../app/bin/CoPilot-debug.apk"
Gametel.start "_AppActivity"
@driver = Gametel.default_driver
@platform = @driver.platform
def tag_for(item, list, which_image=0)
@platform.get_view_by_index('android.widget.ListView', list) do |d|
d.get_child_at item, :variable => '@@the_list_item@@'
d.get_class
d.for_name 'android.widget.ImageView', :variable => '@@image_class@@'
d.get_current_views '@@image_class@@', '@@the_list_item@@', :target => :Robotium
d.get(which_image)
d.get_tag
end
@platform.last_json
end
def drawable_id(id)
@platform.chain_calls do |d|
d.get_current_activity
d.get_resources :variable => '@@resources@@'
d.get_identifier id, 'drawable', 'copilot.app'
end
@platform.last_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment