1

I have a Calabash iOS feature that is failing on iOS version 8.3 but works on later versions.

INFO: Embed is not available in this context. Will not embed.
    Then I fill in "Search" with "Haunted Halloween"                         # calabash-cucumber-0.19.2/features/step_definitions/calabash_steps.rb:108
      touch could not find view: 'textField marked: 'Search'', args: {:query=>"textField marked: 'Search'"} (RuntimeError)
      /Users/kevzettler/projects/calabash/features/search.feature:14:in `Then I fill in "Search" with "Haunted Halloween"'

When examing the UI tree with the calabash-console there is a noticeable discrepancy.

iOS 8.3:

          [UISearchBar] [text:]
            [UIView]
              [UISearchBarBackground]
              [UISearchBarTextField] [text:]
                [_UISearchBarSearchFieldBackgroundView]
                [UIImageView]
                [UISearchBarTextFieldLabel] [label:Search] [text:Search]
                [UIAccessibilityTextFieldElement] [text:Search]

iOS 9.3:

          [UISearchBar] [text:]
            [UIView]
              [UISearchBarBackground]
              [UISearchBarTextField] [label:Search] [text:]
                [_UISearchBarSearchFieldBackgroundView]
                [UIImageView]
                [UISearchBarTextFieldLabel] [label:Search] [text:Search]
                [UIAccessibilityTextFieldElement] [label:Search] [text:Search]

You can see in the 9.3 example that the UISearchBarTextField has a label applied

[UISearchBarTextField] [label:Search]

According to the Calabash documentation it will correctly find an element to enter input based on the placeholder or acessibilityLabel. https://github.com/calabash/calabash-ios/wiki/02-Predefined-steps#entering-text

I also tried setting a placeholder text on this element self.searchController.searchBar.placeholder = @"Search";

But that did not help either.

kb920
  • 3,039
  • 2
  • 33
  • 44
kevzettler
  • 4,783
  • 15
  • 58
  • 103

0 Answers0