Calabash 0.9.169

0.9.169 changelog

IMPORTANT requires a server update to 0.9.169 see Updating Calabash Server

IMPORTANT recommend an update to hooks see 0.9.169 01_launch.rb Updates

IMPORTANT Ruby 1.8 support has been dropped. We recommend ruby 2.1 or higher, but Calabash still supports ruby 1.9.

Features

Querying by class name

Previously all class name queries without view: were subject to a 'convenient' rewrite: prepend UI and capitalize. For example, label becomes UILabel. This was confusing to many who expected a class name would match all objects of (sub-)type that class. For that reason the following is now implemented:

  1. If the class-name query begins with a lower-case letter, do the re-write. So label is still UILabel.
  2. If the class-name query begins with a capital letter, do not perform the re-write.

This makes it possible to query a class just by typing its name, e.g.,

query("UILabel parent UITableViewCell first")

    [0] {
               "text" => "Cell 0",
               "rect" => {
            "center_x" => 160,
                   "y" => 0,
               "width" => 320,
                   "x" => 0,
            "center_y" => 22,
              "height" => 44
        },
        ...
    }

Potential fix for issue: 351 query language should support exact matching on view classes.

Text property value is now available in query output

See example query above.

Alpha level support for navigating the accessibility view hierarchy

By default, Calabash queries will search through the parent/sub-view hierarchy of UIKit.

This release adds alpha level support for the hierarchy defined by the iOS accessibility protocols (UIAccessibility*).

Specifically it is possible to modify the direction of the query via modifiers acc and accParent.

This is sometimes needed and sometimes more intuitive (even if not strictly needed). It can also lead to more robust queries in some cases.

A classical example would be iOS tab bar:

irb(main):022:0> classes("UITabBar child *")
[
    [0] "UITabBarButton",
    [1] "UITabBarButton",
    [2] "UITabBarButton",
    [3] "UITabBarButton",
    [4] "UIImageView"
]
irb(main):023:0> query("UITabBar child button")
[] #What? confusing! But on iOS, a UITabBarButton is not a subclass of UIButton
# acc to the rescue
irb(main):024:0> query("acc UITabBar button")
[
    [0] {
              "class" => "UITabBarButton",
                 "id" => nil,
               "rect" => {
            "center_x" => 40,
                   "y" => 520,
               "width" => 76,
                   "x" => 2,
            "center_y" => 544,
              "height" => 48
        },
...
]

Another example would be non-UIKit components advertising themselves via UIAccessibility.

Calabash Server and Calabash Gem Compatibility Checks

If your server version is not compatible with your gem version, calabash will warn you at launch.

WARN: server version is not compatible with gem version
please update your server and gem
server version: '0.9.168'
   gem version: '0.9.169'

You can now do a visual check to see what version of the server you have installed.

$ ls -1 calabash.framework/Versions/
0.9.169  <== server version
A
Current

And you can do a programmatic check as well.

$ calabash.framework/Resources/version => 0.9.169

EXPERIMENTAL: Synchronous operation combining waiting, waiting for animations and tapping.

Consider this API experimental. It has some known issues and is subject to change. We're looking for community feedback on this.

A common pattern in testing on iOS is the following 'trio' of actions: tap somthing, wait_for some marker element, wait for animations to finish. This pattern is so common that it should be the high-level methods in Calabash (similarly to page objects). Particularly waiting for animations is a common pit-fall for beginners.

A new method wait_tap combines these three into one synchronous action: wait_for_elements_exist, "wait for element not animating", touch.

Let's use the NavBar sample from Apple.

Short demo

A brief explanation of demo. In the NavBar app, an iOS Table view with a navigation bar is the main view. This uses the classic navigation controller 'push' animation. A common problem is that views on the next screen is considered visible by iOS before the animation completes. So often when you tap a table cell, and then wait for a button to tap on the pushed view, the tap will fail (without warning) because the button is visible but animating. wait_tap, tries to solve this.

Changes

at_exit launch hooks

The Calabash::Cucumber::SimulatorHelper module has been deprecated.

Please replace:

Calabash::Cucumber::SimulatorHelper.stop

with this:

launcher = Calabash::Cucumber::Launcher.new
launcher.simulator_launcher.stop

The most common place to find the deprecated call is in your support/01_launch.rb file.

OLD
at_exit do
  launcher = Calabash::Cucumber::Launcher.new
  if launcher.simulator_target?
    Calabash::Cucumber::SimulatorHelper.stop unless launcher.calabash_no_stop?
  end
end
NEW
at_exit do
  launcher = Calabash::Cucumber::Launcher.new
  if launcher.simulator_target?
    launcher.simulator_launcher.stop unless launcher.calabash_no_stop?
  end
end

Fixes

  • issue 349 launcher.rb DEVICE_TARGET variable semantics are inconsistent in light of Xcode 5.1 changes
  • issue 337 linkedwithcalabash? fails if project path has spaces
    • thanks to @dalewking, @LeonS, @chouti for reporting
  • pull 364 updates the interaction between calabash and the sim_launcher gem
  • pull 359 should be able to reset the simulator content and settings
  • pull 362 _text_from_first_responder should return "" instead of nil when the first responder cannot be determined
    • thanks to @CityTransit
  • pull 357 calabash should enable accessibility automatically and disable the AXAccessibilityInspector
    • thanks to @rpranata for his pull request
    • thanks to @JaniJegoroff for inspiration
  • issue 278 - the output of simulator_helper self.derived_data_dir_for_project should be more tightly controlled with CALABASH_FULL_CONSOLE_OUTPUT
  • issue 275 - the server and gem versions should be more tightly coupled

    • thanks to @AndyKriger for reporting
  • Fix: Non-obvious behaviour for some query strings with whitespace scattred, e.g., query("* text:'View 1'"), query("* text : 'View 1' "), query("* text: 'View 1' ") are now all the same (previously the whitespace changed the parsing).

  • Non-obvious behaviour for some query strings with whitespace scattred, e.g., query("* text:'View 1'"), query("* text : 'View 1' "), query("* text: 'View 1' ") are now all the same (previously the whitespace changed the parsing).

  • thanks to @moredip for the following fixes in sim_launcher

    • https://github.com/moredip/Sim-Launcher/pull/31
    • https://github.com/moredip/Sim-Launcher/pull/30

Deprecated

See https://github.com/calabash/calabash-ios/wiki/Deprecated

NEW
  • since 0.9.169 Calabash::Cucumber::FRAMEWORK_VERSION - no replacement
  • since 0.9.169 Calabash::Cucumber::Device.framework_version - use server_version instead
  • since 0.9.169 Calabash::Cucumber::SimulatorHelper module - use Calabash::Cucumber::SimulatorLauncher instead. The following were not ported over to the new module:
    • get_version
    • ios_version
    • ios_major_version
    • version_check

Other

rspec testing for testing Calabash iOS gem

$ be rake spec

Xamarin Workbook

If it's not already installed, install the Xamarin Workbooks app first. The workbook file should download automatically, but if it doesn't, just click to start the workbook download manually.