lib/honeydew/device_matchers.rb in honeydew-0.24.1 vs lib/honeydew/device_matchers.rb in honeydew-0.25.0

- old
+ new

@@ -1,7 +1,12 @@ module Honeydew module DeviceMatchers + + def has_app_installed_in_data?(package_name) + packages_in_data.grep(/#{package_name}/).count > 0 + end + def has_text?(text) perform_assertion :is_text_present, :text => text end def has_element_with_description?(description) @@ -64,8 +69,22 @@ end def has_settings_menu_item?(item_name) perform_assertion :has_settings_menu_item, :menuName => item_name + end + + private + + def installed_packages + adb("shell pm list packages -f").split(/\r\n/) + end + + def packages_in_data + installed_packages.select {|p| p.starts_with? "package:/data/"} + end + + def packages_in_system + installed_packages.select {|p| p.starts_with? "package:/system/"} end end end