GithubHelp home page GithubHelp logo

calabash / calabash Goto Github PK

View Code? Open in Web Editor NEW
127.0 127.0 30.0 41.15 MB

Automated Acceptance Testing for Mobile Apps

License: Eclipse Public License 1.0

Ruby 93.28% Shell 0.09% Gherkin 5.37% Makefile 0.05% C 1.21%

calabash's Introduction

master develop versioning license contributing
Build Status Build Status GitHub version License Contributing

Calabash

Automated Acceptance Testing for Mobile Apps.

Rake

TODO Release instructions for Android and iOS.

$ rake -T
rake android:build     # Build the Android test server
rake build             # Build calabash-1.9.9.pre2.gem into the pkg directory
rake ctags             # Generate ctags in ./git/tags
rake install           # Build and install calabash-1.9.9.pre2.gem into system gems
rake release           # Create tag v1.9.9.pre2 and build and push calabash-1.9.9.pre2.gem to Rubygems
rake spec              # Run RSpec code examples
rake unit              # Run RSpec code examples
rake yard              # Generate YARD Documentation
rake yard:publish      # Generate and publish docs

Testing

rspec

$ be rake unit # All unit tests.
$ be guard     # Run unit tests as you develop.

Integration tests

$ rake integration:page-object-model  # Run POM tests
$ rake integration:ruby               # Run tests ensuing correct Ruby interfacing
$ rake integration:cli                # Run command line interface tests

calabash's People

Contributors

ilyabausovakvelon avatar jmoody avatar krukow avatar michaelkirk avatar tobiasroikjer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

calabash's Issues

iOS Wordpress sample has failing Cucumbers

  Scenario: Signing out               # features/login.feature:19
    Given I am signed in              # features/step_definitions/login_steps.rb.rb:42
    Then I should be able to sign out # features/step_definitions/login_steps.rb.rb:46
      Waited 15 seconds for "WPNUXMainButton marked:'Sign In'" to match a view (Calabash::Wait::ViewNotFoundError)

 @log_in
  Scenario: Deleting a post                       # features/posting.feature:19
    Given I have added a post                     # features/step_definitions/posting_steps.rb.rb:26
    When I view that post                         # features/step_definitions/posting_steps.rb.rb:39
    Then I should be able to delete it            # features/step_definitions/posting_steps.rb.rb:58
      This screen does not have a delete key (RuntimeError)

  @log_in
  Scenario: Editing a post                                     # features/posting.feature:26
    Given I have added a post                                  # features/step_definitions/posting_steps.rb.rb:26
    When I view that post                                      # features/step_definitions/posting_steps.rb.rb:39
    Then I should be able to edit it                           # features/step_definitions/posting_steps.rb.rb:68
    When I give it a new title                                 # features/step_definitions/posting_steps.rb.rb:74
      Could not parse response ': A JSON text must at least contain two octets!' (Calabash::IOS::RouteError)
      /Users/moody/git/calabash/calabash/lib/calabash/ios/device/routes/response_parser.rb:14:in `rescue in parse_response_body'

Should gestures return QueryResult?

The docs do not defined a return value.

If they return a QueryResult, then we should probably capture the :options that were passed to the gesture. For example :at and :from.

Should routes be Classes?

Hi Tobias,

The UIA tap gesture is actually 2 calls:

  1. A call to map to find the coordinates to touch.
  2. A call to UIAutomation to touch the coordinates.

Other UIA gestures will involve one or more calls to map.

I am thinking about converting the MapRoute from a module to a class so it can be used more easily in the UIA gesture API.

I haven't decided one way or the other.

Any thoughts?

`calabash run` should not expect there to be an 'android' or 'ios' profile

I ran into this output:

$ be calabash run ../../spec/resources/android/xtc-android-sample.apk 
Could not find profile: 'android'

Defined profiles in cucumber.yml:
  * app
  * default
  * formatter
  * verbose

This is not a x-platform project.

Do I need to update my support/env.rb and support/hooks.rb? They were generated some time ago.

Screenshot.obtain_screenshot_path! should respect 'SCREENSHOT_DIRECTORY'

If the users says, "Use this directory for screenshots", don't insert test_run_*.

Reproduce

$ be irb
Calabash 2.0.0.pre1 says: 'I'm gonna take this to 11.'
> ENV['CAL_SCREENSHOT_DIR']='/tmp/screenshots'
"/tmp/screenshots"
> Calabash::Screenshot.obtain_screenshot_path!
"screenshots/test_run_26/screenshot_1.png"
> 

Expected

> Calabash::Screenshot.obtain_screenshot_path!
"screenshots/screenshot_1.png"

Announcement: Calabash 2.0

Calabash 2.0 is a merge of the iOS and Android APIs.

Why?

  • A unified API will make cross-platform testing much easier.
  • APIs are difficult to design. Now that we've had several
    years of experience with hundreds of different applications
    on both Android and iOS, we believe we've created an API that is
    easier to use and understand.
  • Both projects have accumulated a lot of behaviors that are
    either broken, no longer relevant, wrong-headed, or dangerous.
    Calabash 2.0 is our opportunity to fix what is broken and
    deprecate what is unnecessary.

Goals

  1. Wherever possible, the Calabash 2.0 API will be cross-platform.
  2. The API and tools will have a high level of test coverage.
  3. The Calabash toolchain will be semantically versioned.

Features

  • Better wait behaviors.
  • Better gestures interface.
  • Better query results.
  • Fewer environment variables.
  • More and better documentation.
  • More example projects.
  • Dropping support for Ruby 1.9.
  • Cucumber 2.0 support.

FAQ

Q1 Are the Calabash 2.0 and Calabash 0.x.x APIs compatible?

The short answer is, no. We've redesigned the API from the bottom. All of the API will be familiar, but many method signatures have changed. You will almost certainly have to refactor some of you code. Ouch! Yeah, we understand, and if it makes you feel better, we're not happy about it.

Q2 Why are the Calabash 2.0 and Calabash 0.x.x APIs not compatible?

There were many inconsistencies between the Android and iOS APIs. We analyzed our options and found that if we made a backward compatible API, we'd be repeating many mistakes and not making much improvement.

Q3 When will Calabash 2.0 be released?

Developers get burned by answering this question all the time. Estimating is hard and no matter how much experience you have, your chances of being correct are very low. Our plan is to start making pre-releases very soon.

Q4 Can I see the new API?
Q5 Can I comment on the API?

The best place to comment is on GitHub, either with a pull request or an issue.

Q6 How will support be handled?

With Calabash 2.0, we plan to merge our support channels. We don't yet know what that will look like. The Google Groups are a difficult place to do support; questions and answers cannot be curated, older posts with incorrect information cannot be deleted, and the support formatted code is almost nil. We have been discussing tools like Vanilla Forums and discuss.io. We'd like to hear from you. Do you know of an awesome support tool? We'll open topics on the Calabash iOS and Android groups where you can weigh in with opinions.

Q7 Why 2.0?

We feel like Calabash is ready for a 2.0 release. This API will feel like a dramatic departure from the old because you will need to refactor your test suites. And we can't release a 1.x version because RubyGems .org already has a Calabash version 1.2.6.

Scaffold Gemfile is inconsistent

Run calabash generate and then try and run bundle install in the directory generated.

 bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/..
Resolving dependencies......
Bundler could not find compatible versions for gem "cucumber":
  In Gemfile:
    calabash (>= 0) ruby depends on
      calabash-android (~> 0.4.9) ruby depends on
        slowhandcuke (>= 0) ruby depends on
          cucumber (>= 0) ruby

    calabash (>= 0) ruby depends on
      calabash-android (~> 0.4.9) ruby depends on
        slowhandcuke (>= 0) ruby depends on
          cucumber (>= 0) ruby

    calabash (>= 0) ruby depends on
      calabash-cucumber (~> 0.9.152) ruby depends on
        cucumber (~> 1.3.0) ruby

    cucumber (= 2.0) ruby
Bundler could not find compatible versions for gem "rubyzip":
  In Gemfile:
    calabash (>= 0) ruby depends on
      calabash-android (~> 0.4.9) ruby depends on
        rubyzip (~> 0.9.9) ruby

    calabash (>= 0) ruby depends on
      xamarin-test-cloud (~> 0.9.23) ruby depends on
        rubyzip (~> 1.1) ruby

AndroidManifest.xml does not exist

Reproduce

  1. pull the latest from develop

$ cd cucumber/android
# Resign if necessary.
$ be calabash console ../../spec/resources/android/xtc-android-sample.apk 

Expected

The console to start.

Found

$ be calabash console ../../spec/resources/android/xtc-android-sample.apk 
Test server does not exist. Creating test server.
/Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1391:in `initialize': No such file or directory @ rb_sysopen - /Users/moody/git/calabash/calabash/lib/calabash/android/lib/AndroidManifest.xml (Errno::ENOENT)
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1391:in `open'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1391:in `copy_file'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:485:in `copy_file'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:402:in `block in cp'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1570:in `block in fu_each_src_dest'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1586:in `fu_each_src_dest0'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:1568:in `fu_each_src_dest'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/fileutils.rb:401:in `cp'
        from /Users/moody/git/calabash/calabash/lib/calabash/android/build/builder.rb:57:in `block (2 levels) in build'
        from /Users/moody/git/calabash/calabash/lib/calabash/android/build/builder.rb:55:in `chdir'
        from /Users/moody/git/calabash/calabash/lib/calabash/android/build/builder.rb:55:in `block in build'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/2.2.0/tmpdir.rb:88:in `mktmpdir'
        from /Users/moody/git/calabash/calabash/lib/calabash/android/build/builder.rb:54:in `build'
        from /Users/moody/git/calabash/calabash/lib/calabash/cli/console.rb:30:in `parse_console_arguments!'
        from /Users/moody/git/calabash/calabash/bin/calabash:70:in `parse_arguments!'
        from /Users/moody/git/calabash/calabash/bin/calabash:25:in `evaluate'
        from /Users/moody/git/calabash/calabash/bin/calabash:99:in `<top (required)>'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bin/calabash:23:in `load'
        from /Users/moody/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/bin/calabash:23:in `<main>'

Notes

I grabbed the AndroidManifest.xml from the calabash-android repo and installed locally.

I was able to start the console.

But what happened? I see this file is git ignored, but part of the gemspec. Should it not be ignored?

ideviceinstaller hooks in Calabash device

ATTN @krukow @TobiasRoikjer

My plan is to implement hooks for ideviceinstaller. If the ideviceinstaller command-line application is available, then we'll use it. If it is not, we'll raise an error.

Here are my various attempts at an API.

Each has their own peculiar problems. The luffa implementation is the 2nd pass.

@kamstrup mentioned this: https://github.com/blueboxsecurity/idevice

It is LGPL, which I think makes it unsuitable for us.

The long-term plan to provide instructions on how to implement hooks for other third-party installers.

Need clarification of TODO on escape_uia_string

        def escape_uia_string(string)
          #TODO escape '\n in query
          escape_single_quotes string
        end

@krukow I am trying to understand this TODO. Does it mean that for UIA serialization, we must escape newlines? Or does it mean that all query strings should escape newlines?

Should Calabash 2.0 require the use of bundler?

In the Rails world, it is common to use bundler, a Gemfile, and the resulting Gemfile.lock to control the gem environment. Internally, we use bundler in all of our projects. Externally, I use bundler when working with my clients.

Many of the problems we see can ultimately be traced back to incompatible gem versions or (in the case of iOS) a stale version of run-loop. This leads to a lot of support.

We believe it is a best practice.

We've demonstrated that it is possible to detect if we are, in fact, running in the context of bundle exec. Should we require bundler to use Calabash 2.0?

One vote against requiring bundler, is that bundler + sudo do not play nice together. MacOS users are forced to use sudo to install gems if they are using the system ruby or are managing their GEM_HOME and GEM_PATH as recommend in the Xamarin documentation.

query("view marked:'does not exist'").first should not raise error

Hey Tobias,

I think you are going to say that this is expected behavior.

I don't think this is a good behavior. If the result of query is supposed to pose as an Array, I should be able to call first on the result and get back nil.

Reproduce

  1. query for an element on the screen that isn't there
  2. ask for the first result

Expected

query("view marked:'does not exist'").first
=> nil

Found

> query("UINavigationBar").first
IndexError: Query result is empty
        from /Users/moody/git/calabash/calabash/lib/calabash/query_result.rb:56:in `ensure_in_bounds'
        from /Users/moody/git/calabash/calabash/lib/calabash/query_result.rb:23:in `first'
        from (irb):5
        from /Users/moody/.rbenv/versions/2.2.2/bin/irb:11:in `<main>'

Should we use Thor for our command-line tool.

Cons

  • Difficult to grok at first.
  • Another dependency to manage with test-cloud-command-line and run-loop.
  • Help is difficult to format: run-loop example
  • It is a box that you have to live in.

Pro

  • Uniform help and command line interface.
  • Nice abstraction that is pretty easy to test.
  • Parses arguments.

I like (no surprise) briar's help

2015-06-04_11-11-50

Is having the binaries in the features/prebuilt a good practice?

See samples/wordpress

I am concerned that it will lead to the binary being uploaded 2x to the XTC - once because it was passed as an argument and again because it is in features/.

From a workflow perspective it is not great when using tools like vim and emacs - too many autocomplete matches (control-p on vim, c-x c-f on emacs).

It is also confusing because I believe the expectation is that the binaries will be outside the features directory. Walking up to the repo, I didn't know where the binaries where. A README.md will sort that (I will write one now).

@krukow @olefriis Can you comment on the uploading 2x issue?

cc @TobiasRoikjer

Android: cannot launch workpress example - can launch in Calabash Android 0.5.13.pre1

Reproduce

  1. One Android device connected and on the same network.
  2. Pulled the latest from develop.
$ cd samples/wordpress
$ bundle
$ be calabash build features/prebuilt/wordpress_android.apk
$ CAL_DEBUG=1 be cucumber -p android

Expected

The app to launch.

Found

Ensuring /Users/moody/git/calabash/calabash/samples/wordpress/test_servers/4eeff36cdcf5fb8ff1847c0559df688c_1.9.9.pre2.apk is installed
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
Application is already installed. Ensuring right checksum
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages -f; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["md5 '/data/app/org.wordpress.android.test-1.apk'; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["am start -e method clear -n org.wordpress.android.test/sh.calaba.instrumentationbackend.StatusReporterActivity; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
Starting 'sh.calaba.instrumentationbackend.ClearAppData2' using: 'am instrument  org.wordpress.android.test/sh.calaba.instrumentationbackend.ClearAppData2'
ADB Command: -s, 015d168974380006, shell
ADB input: ["am instrument  org.wordpress.android.test/sh.calaba.instrumentationbackend.ClearAppData2; echo \"__CAL_END__$?\"; exit 0"]
Adb shell command exited with 1
Error message from ADB: 
android.util.AndroidException: INSTRUMENTATION_FAILED: org.wordpress.android.test/sh.calaba.instrumentationbackend.ClearAppData2
        at com.android.commands.am.Am.runInstrument(Am.java:865)
        at com.android.commands.am.Am.onRun(Am.java:282)
        at com.android.internal.os.BaseCommand.run(BaseCommand.java:47)
        at com.android.commands.am.Am.main(Am.java:76)
        at com.android.internal.os.RuntimeInit.nativeFinishInit(Native Method)
        at com.android.internal.os.RuntimeInit.main(RuntimeInit.java:243)
        at dalvik.system.NativeStart.main(Native Method)

  Failed to clear app data: Adb shell command exited with 1: android.util.AndroidException: INSTRUMENTATION_FAILED: org.wordpress.android.test/sh.calaba.instr... (RuntimeError)
  /Users/moody/git/calabash/calabash/lib/calabash/android/device.rb:591:in `rescue in ts_clear_app_data'
  /Users/moody/git/calabash/calabash/lib/calabash/android/device.rb:588:in `ts_clear_app_data'
  /Users/moody/git/calabash/calabash/lib/calabash/android/device.rb:639:in `_clear_app_data'
  /Users/moody/git/calabash/calabash/lib/calabash/device.rb:78:in `clear_app_data'
  /Users/moody/git/calabash/calabash/lib/calabash/life_cycle.rb:91:in `clear_app_data'
  /Users/moody/git/calabash/calabash/samples/wordpress/features/support/hooks.rb:86:in `reset'
  /Users/moody/git/calabash/calabash/samples/wordpress/features/support/hooks.rb:53:in `on_new_scenario'
  /Users/moody/git/calabash/calabash/samples/wordpress/features/support/hooks.rb:8:in `Before'

Notes

The Wordpress app did install.

Trying to launch from the console, results in an indefinite hang:

$ be calabash console features/prebuilt/wordpress_android.apk 

I also could not launch the spec/resources/android/xtc-android-sample.apk.

I am able to launch both apps with 0.5.13.pre1

Wordpress: "Adding a self-hosted site" Scenario is flickering

Hey Tobias,

This fails in landscape and portrait on my Nexus.

Is it a timing issue?

 Scenario: Adding a self-hosted site               # features/login.feature:6
    Given I am on the login screen                  # features/step_definitions/login_steps.rb.rb:29
    Then I should be able to add a self-hosted site # features/step_definitions/login_steps.rb.rb:34
      Failed to perform gesture. java.lang.SecurityException: Injecting to another application requires INJECT_EVENTS permission (RuntimeError)
      ./features/android/pages/login_page.rb:49:in `toggle_self_hosted_site'
      ./features/android/pages/login_page.rb:34:in `enable_self_hosted_site'
      ./features/step_definitions/login_steps.rb.rb:35:in `/^I should be able to add a self\-hosted site$/'
      features/login.feature:8:in `Then I should be able to add a self-hosted site'

Cannot launch cucumber/android project

Reproduce

  1. Follow these instructions.
$ bundle update
$ ./copy_repos.sh
$ ./changing_old_files.sh
$ rake android:build
$ cd cucumber/android
$ be calabash resign ../../spec/resources/android/xtc-android-sample.apk
$ be calabash build ../../spec/resources/android/xtc-android-sample.apk
$ be cucumber

Notes

I tried:

$ be calabash run ../../spec/resources/android/xtc-android-sample.apk

but ran into Expected behavior of $ be calabash run ../app.apk #209

Which I think can be resolved by updating the env.rb and hooks.rb?

Expected

To be able to run the cucumber. This worked at one point.

Found

$ CAL_DEBUG=1 be cucumber                                                                                                                                                                                                 
Setting Android SDK location to $ANDROID_HOME
Android SDK location set to '/usr/local/opt/android-sdk'
Set aapt path to '/usr/local/opt/android-sdk/build-tools/22.0.1/aapt'
Set zipalign path to '/usr/local/opt/android-sdk/build-tools/22.0.1/zipalign'
Set adb path to '/usr/local/opt/android-sdk/platform-tools/adb'
Set android jar path to '/usr/local/opt/android-sdk/platforms/android-MNC/android.jar'
Java SDK location set to ''
Found java on PATH
Set java path to '/usr/bin/java'
Found keytool on PATH
Set keytool path to '/usr/bin/keytool'
Found jarsigner on PATH
Set jarsigner path to '/usr/bin/jarsigner'
ADB Command: devices
ADB input: 
Using the default, app and formatter profiles...
Feature: Home Page
  In order to test the Android query and wait APIs
  As a Calabash developer
  I want a set of Scenarios that interact with the Home page.

Ensuring /Users/moody/git/calabash/calabash/spec/resources/android/xtc-android-sample.apk is installed
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["echo \"test\"; exit 0"]
Application is already installed. Ensuring right checksum
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages -f; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["md5; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["md5 '/data/app/com.xamarin.xtcandroidsample-1.apk'; echo \"__CAL_END__$?\"; exit 0"]
Ensuring the test-server is installed as well
Ensuring /Users/moody/git/calabash/calabash/cucumber/android/test_servers/dd25a450912b6d1b9bb602f64f180bb9_1.9.9.pre2.apk is installed
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
Application is already installed. Ensuring right checksum
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages -f; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["md5 '/data/app/com.xamarin.xtcandroidsample.test-1.apk'; echo \"__CAL_END__$?\"; exit 0"]                                                                                                         [100/10949]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages -f; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["md5 '/data/app/com.xamarin.xtcandroidsample-1.apk'; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages -f; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["md5 '/data/app/com.xamarin.xtcandroidsample.test-1.apk'; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["getprop ro.build.version.release; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["getprop ro.build.version.sdk; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["getprop ro.product.name; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["getprop ro.product.model; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["getprop ro.product.cpu.abi; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["cat /proc/cpuinfo; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["getprop ro.product.manufacturer; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["dumpsys input_method; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["dumpsys input_method; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["am start -e method clear -n com.xamarin.xtcandroidsample.test/sh.calaba.instrumentationbackend.StatusReporterActivity; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, forward, tcp:33765, tcp:33765
ADB input: 
Getting: http://127.0.0.1:33765/ping
Http error: HTTPClient::KeepAliveDisconnected: 
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
ADB Command: -s, 015d168974380006, shell
ADB input: ["pm list packages; echo \"__CAL_END__$?\"; exit 0"]
Starting 'sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner' using: 'am instrument  -e "test_server_port" "33765" -e "target_package" "com.xamarin.xtcandroidsample" -e "class" "sh.calaba.instrumentatio
nbackend.InstrumentationBackend" com.xamarin.xtcandroidsample.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner'
ADB Command: -s, 015d168974380006, shell
ADB input: ["am instrument  -e \"test_server_port\" \"33765\" -e \"target_package\" \"com.xamarin.xtcandroidsample\" -e \"class\" \"sh.calaba.instrumentationbackend.InstrumentationBackend\" com.xamarin.xtcandroidsample
.test/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner; echo \"__CAL_END__$?\"; exit 0"]
Getting: http://127.0.0.1:33765/ping
Http error: HTTPClient::KeepAliveDisconnected: 
ADB Command: -s, 015d168974380006, shell
ADB input: ["ls /data/data/com.xamarin.xtcandroidsample.test/files/calabash_failure.out; echo \"__CAL_END__$?\"; exit 0"]
Getting: http://127.0.0.1:33765/ping
Http error: HTTPClient::KeepAliveDisconnected: 
ADB Command: -s, 015d168974380006, shell
ADB input: ["ls /data/data/com.xamarin.xtcandroidsample.test/files/calabash_failure.out; echo \"__CAL_END__$?\"; exit 0"]
Getting: http://127.0.0.1:33765/ping
Http error: HTTPClient::KeepAliveDisconnected: 
ADB Command: -s, 015d168974380006, shell
ADB input: ["ls /data/data/com.xamarin.xtcandroidsample.test/files/calabash_failure.out; echo \"__CAL_END__$?\"; exit 0"]
Getting: http://127.0.0.1:33765/ping
Http error: HTTPClient::KeepAliveDisconnected: 

Understanding the pan_* methods

  # Performs a `pan` heading `left` on the screen.
    # @see pan_left
    def pan_screen_left(options={})
      pan_left('*', options)
    end

    # Performs a `pan` heading `right` on the screen.
    # @see pan_right
    def pan_screen_right(options={})
      pan_right('*', options)
    end

    # Performs a `pan` heading `up` on the screen.
    # @see pan_up
    def pan_screen_up(options={})
      _pan_screen_up(options)
    end

    # Performs a `pan` heading `down` on the screen.
    # @see pan_down
    def pan_screen_down(options={})
      _pan_screen_down(options)
    end

Why are _pan_screen_down and _pan_screen_up abstract methods? Why aren't the implemented like pan_right and pan_left?

def pan_screen_down(options)
  pan('*', {x:50, y:10}, {x:50, y:90}, options)
end

Gesture API proposal: replace tap with touch

I am bringing this up for two reasons:

  1. I prefer touch over tap because the UIKit APIs refer to touch and touches. See the UIControlEvent API and UIGestureRecognizers. I realize the UIAutomation JavaScript API uses tap through the docs.
  2. tap is a Ruby Kernel method. Some tools, like RubyMine, can't figure out that tap is defined in the Cucumber World. I can already hear the protests that we shouldn't change our API to accommodate a third-party tool. The reality is that many people use RubyMine and many people use RubyMine's Intentions feature that does static analysis of code. All tap calls are being marked as having incorrect parameters.

I know that tap is favored over touch and I have little chance of influencing opinions. What I hope is that we can document why we are choosing tap over touch.

Wait::wait_for arguments seem wrong - the timeout parameter should come from the defaults.

    # Evaluates the given block until the block evaluates to truthy. If the
    # block raises an error, it is **not** rescued.
    # If the block does not evaluate to truthy within the given `timeout`
    # an TimeoutError will be raised.
    #
    # @param [Number] timeout The time before failing
    # @param [String, Proc] timeout_message The error message if timed out
    # @see Calabash::Wait#with_timeout
    # @return The returned value of `block` if it is truthy
    def wait_for(timeout, timeout_message, options={}, &block)
      wait_options = Wait.default_options.merge(options)

I propose the following change:

def wait_for(timeout_message, options = {}, &block)

Support JRuby

We support JRuby?

  • Update .travis.yml
  • Update 'we support' documentation
  • Can we require MRI ruby 2.0 and JRuby 1.9?

Handling adb "rm failed for -f. No such file or directory"

As you may recall, my Samsung S3 is having a problem installing apps.

irb(main):003:0> ensure_app_installed
RuntimeError: Could not install app 'com.xamarin.xtcandroidsample.test': rm failed for -f, No such file or directory
        from /Users/moody/git/calabash/calabash/lib/calabash/android/device.rb:849:in `adb_install_app'
        from /Users/moody/git/calabash/calabash/lib/calabash/android/device.rb:682:in `_ensure_app_installed'
        from /Users/moody/git/calabash/calabash/lib/calabash/device.rb:66:in `ensure_app_installed'
        from /Users/moody/git/calabash/calabash/lib/calabash/android/device.rb:688:in `_ensure_app_installed'
        from /Users/moody/git/calabash/calabash/lib/calabash/device.rb:66:in `ensure_app_installed'
        from /Users/moody/git/calabash/calabash/lib/calabash/life_cycle.rb:57:in `ensure_app_installed'
        from (irb):3
        from /Users/moody/.rbenv/versions/2.2.2/bin/irb:11:in `<main>'

Can we catch this message in adb.command?

Some iOS map routes don't take a query - how should handle this?

An example of this is the /orientation route.

map_route(nil, :orientation, :status_bar)

The generic route handling code returns a QueryResult, but a nil query raises an error (see below).

Proposal

1. map_route('/orientation', :orientation, :status_bar)

If not '/orientation', then some other indication of what generated the result.

2. map_route('', ...)

YAGNI - would we ever need or want to know that it was call to the /orientation route? This would probably be important if our routes were versioned e.g. /api/v2/orientation. What version of the API did this hit to produce this result.

3. Don't return a QueryResult

Breaks the current model. @TobiasRoikjer has already expressed concerns about returning a QueryResult.

nil-query error

TypeError: can't dup NilClass
    from /Users/moody/git/calabash/lib/calabash/query.rb:92:in `dup'
    from /Users/moody/git/calabash/lib/calabash/query.rb:92:in `new'
    from /Users/moody/git/calabash/lib/calabash/query_result.rb:19:in `initialize'
    from /Users/moody/git/calabash/lib/calabash/query_result.rb:8:in `new'
    from /Users/moody/git/calabash/lib/calabash/query_result.rb:8:in `create'
    from /Users/moody/git/calabash/lib/calabash/ios/routes/route_mixin.rb:53:in `route_success'
    from /Users/moody/git/calabash/lib/calabash/ios/routes/route_mixin.rb:30:in `route_handle_response'
    from /Users/moody/git/calabash/lib/calabash/ios/routes/map_route.rb:9:in `map_route'

Proposed API change: _clear_app_data and _uninstall_app should take application as argument

Hey Tobias,

I think I advocated for these methods to take an identifier. Now I think they should take an application argument.

What do you think?

    # Do not modify
    def uninstall_app(path_or_application)
      application = parse_path_or_app_parameters(path_or_application)

      if Managed.managed?
        Managed.uninstall_app(application.identifier, self)
      else
        _uninstall_app(application.identifier)
      end
    end

    # Do not modify
    def clear_app_data(path_or_application)
      application = parse_path_or_app_parameters(path_or_application)

      if Managed.managed?
        Managed.clear_app_data(application.identifier, self)
      else
        _clear_app_data(application.identifier)
      end
    end

Can we remove the temporary .gitignores?

# Temporary git ignores. Remove these when changing repos
android/test-server
playground/
# End of temporary git ignores

Playground doesn't need to be temporary does it? It can just be ignored?

Remove :post_timeout from Wait options or implement it.

Why should we wait after?

Pro: I do this all the time in my own tests. I find it convenient. Maybe it is a bad practice?

Con: It is really easy to hide sleeps.

At the moment :post_timeout is not implemented in the Wait module.

   @@default_options =
        {
            # default upper limit on how long to wait
            timeout: Environment::WAIT_TIMEOUT,
            # default message (String or Proc) if timeout occurs
            message: lambda do |options|
              "Timed out after waiting for #{options[:timeout]} seconds..."
            end,
            # default polling frequency for waiting
            retry_frequency: 0.3,
            # default extra wait after the condition becomes true
            post_timeout: 0,
            # default exception type to raise when the timeout is exceeded
            exception_class: Calabash::Wait::TimeoutError,
            # whether to embed a screenshot on failure
            screenshot_on_error: true
        }

Where should the `escape_quotes` method live?

I slapped this into Calabash::Operations, but decided it did not belong there.

It is useful both to the user and to Calabash internally.

        # @todo Move this to somewhere public because it is useful to users.
        # Escapes single quotes in `string`.
        #
        # @example
        #   > escape_quotes("Let's get this done.")
        #   => "Let\\'s get this done."
        # @param [String] string The string to escape.
        # @return [String] A string with its single quotes properly escaped.
        def escape_single_quotes(string)
          string.gsub("'", "\\\\'")
        end

Environment.set_variable! needs to be removed

    # Utility method to set the value of an environment variable.
    #
    # @param [String] name of the environment variable
    # @param [Object] value of the environment variable
    def self.set_variable!(name, value)
      Logger.debug("Setting environment variable '#{name}' to '#{value}'")
      ENV[name] = value
    end

This works to set the variable, but the constant still has the old value.

@TobiasRoikjer Any clever ideas for dealing with this?

Should we remove this method? It only seems to have value for testing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.