lib/calabash-android/operations.rb in calabash-android-0.5.0.pre1 vs lib/calabash-android/operations.rb in calabash-android-0.5.0.pre2
- old
+ new
@@ -459,12 +459,12 @@
File.expand_path(ENV['CALABASH_SERVER_PORTS'] || "~/.calabash.yaml")
end
def connected_devices
lines = `#{Env.adb_path} devices`.split("\n")
- lines.shift
- lines.collect { |l| l.split("\t").first}
+ start_index = lines.index{ |x| x =~ /List of devices attached/ } + 1
+ lines[start_index..-1].collect { |l| l.split("\t").first }
end
def wake_up
wake_up_cmd = "#{adb_command} shell am start -a android.intent.action.MAIN -n #{package_name(@test_server_path)}/sh.calaba.instrumentationbackend.WakeUp"
log "Waking up device using:"
@@ -762,10 +762,14 @@
def keyboard_enter_text(text, options = {})
perform_action('keyboard_enter_text', text)
end
+ def keyboard_enter_char(character, options = {})
+ keyboard_enter_text(character[0,1], options)
+ end
+
def enter_text(uiquery, text, options = {})
tap_when_element_exists(uiquery, options)
sleep 0.5
keyboard_enter_text(text, options)
end
@@ -776,10 +780,14 @@
raise "No elements found. Query: #{query_string}" if result.empty?
true
end
+ def hide_soft_keyboard
+ perform_action('hide_soft_keyboard')
+ end
+
def find_coordinate(uiquery)
raise "Cannot find nil" unless uiquery
element = execute_uiquery(uiquery)
@@ -829,12 +837,12 @@
def press_menu_button
perform_action('press_menu')
end
- def select_options_menu_item(text, options={})
+ def select_options_menu_item(identifier, options={})
press_menu_button
- tap_when_element_exists("DropDownListView * marked:'#{text}'", options)
+ tap_when_element_exists("DropDownListView * marked:'#{identifier}'", options)
end
def select_context_menu_item(view_uiquery, menu_item_query_string)
long_press(view_uiquery)