lib/calabash-cucumber/keyboard_helpers.rb in calabash-cucumber-0.20.0 vs lib/calabash-cucumber/keyboard_helpers.rb in calabash-cucumber-0.20.3

- old
+ new

@@ -171,17 +171,22 @@ def text_from_first_responder if !keyboard_visible? screenshot_and_raise "There must be a visible keyboard" end - ['textField', 'textView'].each do |ui_class| - query = "#{ui_class} isFirstResponder:1" - result = _query_wrapper(query, :text) - if !result.empty? - return result.first - end - end - "" + query = "* isFirstResponder:1" + elements = _query_wrapper(query, :text) + + return "" if elements.count == 0 + + text = elements[0] + + # first responder did not respond to :text selector + return "" if text == "*****" + + return "" if text.nil? + + text end # @visibility private # TODO Remove in 0.21.0 alias_method :_text_from_first_responder, :text_from_first_responder