Permalink
Browse files

pre-release commit

  • Loading branch information...
1 parent 8fe77a8 commit a0f35ce825e0eab07d4cf34a7005d9a732f7890e @krukow krukow committed Mar 3, 2012
Showing with 4,718 additions and 0 deletions.
  1. +12 −0 .gitignore
  2. +8 −0 LICENSE
  3. +266 −0 README.md
  4. +284 −0 Readme.html
  5. +3 −0 calabash-cucumber/.gitignore
  6. +1 −0 calabash-cucumber/CHANGES.txt
  7. +4 −0 calabash-cucumber/Gemfile
  8. +52 −0 calabash-cucumber/Gemfile.lock
  9. +8 −0 calabash-cucumber/LICENSE
  10. +182 −0 calabash-cucumber/README.md
  11. +2 −0 calabash-cucumber/Rakefile
  12. +54 −0 calabash-cucumber/bin/calabash-ios
  13. +26 −0 calabash-cucumber/bin/calabash-ios-generate.rb
  14. +64 −0 calabash-cucumber/bin/calabash-ios-helpers.rb
  15. +480 −0 calabash-cucumber/bin/calabash-ios-setup.rb
  16. +90 −0 calabash-cucumber/bin/calabash-ios-sim.rb
  17. +27 −0 calabash-cucumber/calabash-cucumber.gemspec
  18. +53 −0 calabash-cucumber/doc/calabash-ios-help.txt
  19. +261 −0 calabash-cucumber/epl-v10.html
  20. +15 −0 calabash-cucumber/features-skeleton/.irbrc
  21. +2 −0 calabash-cucumber/features-skeleton/irb_ios4.sh
  22. +2 −0 calabash-cucumber/features-skeleton/irb_ios5.sh
  23. +8 −0 calabash-cucumber/features-skeleton/my_first.feature
  24. +1 −0 calabash-cucumber/features-skeleton/step_definitions/calabash_steps.rb
  25. +1 −0 calabash-cucumber/features-skeleton/support/env.rb
  26. +17 −0 calabash-cucumber/features-skeleton/support/hooks.rb
  27. +55 −0 calabash-cucumber/features-skeleton/support/launch.rb
  28. 0 calabash-cucumber/lib/calabash-cucumber.rb
  29. +13 −0 calabash-cucumber/lib/calabash-cucumber/calabash_helper.rb
  30. +371 −0 calabash-cucumber/lib/calabash-cucumber/calabash_steps.rb
  31. +13 −0 calabash-cucumber/lib/calabash-cucumber/color_helper.rb
  32. +9 −0 calabash-cucumber/lib/calabash-cucumber/cucumber.rb
  33. +167 −0 calabash-cucumber/lib/calabash-cucumber/launch/simulator_helper.rb
  34. +332 −0 calabash-cucumber/lib/calabash-cucumber/operations.rb
  35. +51 −0 calabash-cucumber/lib/calabash-cucumber/resources/cell_swipe_ios4_ipad.base64
  36. +51 −0 calabash-cucumber/lib/calabash-cucumber/resources/cell_swipe_ios4_iphone.base64
  37. +74 −0 calabash-cucumber/lib/calabash-cucumber/resources/cell_swipe_ios5_ipad.base64
  38. +74 −0 calabash-cucumber/lib/calabash-cucumber/resources/cell_swipe_ios5_iphone.base64
  39. +104 −0 calabash-cucumber/lib/calabash-cucumber/resources/pinch_in_ios4_ipad.base64
  40. +104 −0 calabash-cucumber/lib/calabash-cucumber/resources/pinch_in_ios4_iphone.base64
  41. +144 −0 calabash-cucumber/lib/calabash-cucumber/resources/pinch_in_ios5_ipad.base64
  42. +144 −0 calabash-cucumber/lib/calabash-cucumber/resources/pinch_in_ios5_iphone.base64
  43. +207 −0 calabash-cucumber/lib/calabash-cucumber/resources/pinch_out_ios5_ipad.base64
  44. +207 −0 calabash-cucumber/lib/calabash-cucumber/resources/pinch_out_ios5_iphone.base64
  45. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_ipad.base64
  46. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_down_ios4_iphone.base64
  47. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_ipad.base64
  48. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_down_ios5_iphone.base64
  49. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_ipad.base64
  50. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_left_ios4_iphone.base64
  51. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_ipad.base64
  52. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_left_ios5_iphone.base64
  53. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_ipad.base64
  54. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_right_ios4_iphone.base64
  55. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_ipad.base64
  56. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_right_ios5_iphone.base64
  57. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_ipad.base64
  58. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_up_ios4_iphone.base64
  59. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_ipad.base64
  60. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_left_home_up_ios5_iphone.base64
  61. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_ipad.base64
  62. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_down_ios4_iphone.base64
  63. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_ipad.base64
  64. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_down_ios5_iphone.base64
  65. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_ipad.base64
  66. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_left_ios4_iphone.base64
  67. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_ipad.base64
  68. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_left_ios5_iphone.base64
  69. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_ipad.base64
  70. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_right_ios4_iphone.base64
  71. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_ipad.base64
  72. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_right_ios5_iphone.base64
  73. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_ipad.base64
  74. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_up_ios4_iphone.base64
  75. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_ipad.base64
  76. +2 −0 calabash-cucumber/lib/calabash-cucumber/resources/rotate_right_home_up_ios5_iphone.base64
  77. +15 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_left_hard_ios4_ipad.base64
  78. +15 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_left_hard_ios4_iphone.base64
  79. +18 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_left_ios4_ipad.base64
  80. +18 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_left_ios4_iphone.base64
  81. +17 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_left_ios5_ipad.base64
  82. +17 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_left_ios5_iphone.base64
  83. +17 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_right_hard_ios4_ipad.base64
  84. +17 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_right_hard_ios4_iphone.base64
  85. +13 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_right_ios4_ipad.base64
  86. +13 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_right_ios4_iphone.base64
  87. +17 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_right_ios5_ipad.base64
  88. +17 −0 calabash-cucumber/lib/calabash-cucumber/resources/swipe_right_ios5_iphone.base64
  89. +7 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_done_ios4_ipad.base64
  90. +8 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_done_ios4_iphone.base64
  91. +7 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_done_ios5_ipad.base64
  92. +8 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_done_ios5_iphone.base64
  93. +7 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_ios4_ipad.base64
  94. +7 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_ios4_iphone.base64
  95. +8 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_ios5_ipad.base64
  96. +8 −0 calabash-cucumber/lib/calabash-cucumber/resources/touch_ios5_iphone.base64
  97. +5 −0 calabash-cucumber/lib/calabash-cucumber/version.rb
  98. BIN calabash-cucumber/scripts/data/.GlobalPreferences.plist
  99. BIN calabash-cucumber/scripts/data/com.apple.Accessibility.plist
  100. BIN calabash-cucumber/scripts/reset_simulator.scpt
  101. +8 −0 calabash-jvm/.gitignore
  102. +13 −0 calabash-jvm/README
  103. +2 −0 calabash-jvm/copy_resources.sh
  104. +13 −0 calabash-jvm/project.clj
  105. +40 −0 calabash-jvm/src/calabash_jvm/core.clj
  106. +9 −0 calabash-jvm/src/log4j.properties
  107. +6 −0 calabash-jvm/test/calabash_jvm/test/core.clj
  108. BIN documentation/Frameworks.png
  109. BIN documentation/linker_flags.png
  110. +261 −0 epl-v10.html
View
@@ -0,0 +1,12 @@
+calabash-cucumber/pkg
+calabash-cucumber/Markdown.pl
+calabash-cucumber/.idea
+examples/LPSimpleExample.xcodeproj/project.xcworkspace
+examples/LPSimpleExample.xcodeproj/xcuserdata/krukow.xcuserdatad
+examples/LPSimpleExample.xcodeproj/project.xcworkspace/xcuserdata
+examples/LPSimpleExample.xcodeproj/xcuserdata/krukow.xcuserdatad
+.idea/*
+examples/LPSimpleExample.xcodeproj/xcuserdata
+examples/LPSimpleExample.xcodeproj/project.xcworkspace/xcuserdata/krukow.xcuserdatad/UserInterfaceState.xcuserstate
+Markdown.pl
+examples_development
View
@@ -0,0 +1,8 @@
+Calabash-ios Copyright (2012) Karl Krukow. All rights reserved.
+The use and distribution terms for this software are covered by the
+Eclipse Public License 1.0
+(http://opensource.org/licenses/eclipse-1.0.php) which can be found in
+the file epl-v10.html at the root of this distribution. By using this
+software in any fashion, you are agreeing to be bound by the terms of
+this license. You must not remove this notice, or any other, from
+this software.
View
266 README.md
@@ -0,0 +1,266 @@
+This guide explains how to setup and use Calabash for iOS.
+=============================================================
+
+After completing this guide you will be able to run
+tests locally against the iOS Simulator. You can also
+interactively explore your applications using the Ruby
+irb console.
+
+Finally, you will be able to test your app on real, non-jailbroken iOS
+devices via [the LessPainful service](http://www.lesspainful.com/).
+
+If you have any questions, please use the google group
+
+[http://groups.google.com/group/calabash-ios](http://groups.google.com/group/calabash-ios)
+
+This guide aims at XCode 4.2, but should also work for XCode versions >= 4.0.
+It takes approximately 10-15 minutes to complete.
+
+Preparing your application.
+---------------------------
+
+To use Calabash for iOS in your app, you must create a new target
+for your app. This target links with a couple of frameworks, as
+described here.
+
+*Note*: it is important that you create a *separate* target as a copy
+ of your "production" target (i.e., the target you usually use when
+ distributing you app to your testers) Don't link with our framework in
+ your production app - this may cause app rejection by Apple since we
+ are using private APIs.
+
+Instructions:
+
+* Step 1/3: Duplicate target.
+ - Select your project in XCode and select your production target for your app.
+ - Right click (or two-finger tap) your target and select "Duplicate target"
+ - Select "Duplicate only" (not transition to iPad)
+ - Rename your new target from ".. copy" to "..-LP"
+ - From the menu select Edit Scheme and select manage schemes.
+ - Rename the new scheme from ".. copy" to "..-LP"
+
+* Step 2/3: Link with framework.
+ - Download the latest version of calabash-ios either by cloning the
+ [git repo](https://github.com/calabash/calabash-ios) or going to [https://github.com/calabash/calabash-ios/downloads](https://github.com/calabash/calabash-ios/downloads).
+ - Use Finder to open the folder that contains `calabash.framework`.
+ - Drag `calabash.framework` from finder into you project's
+ `Frameworks` folder. Make sure that (i) `Copy items into
+ destination group's folder (if needed)` is checked and (ii) _only_
+ your "-LP " target is checked in `Add to targets`.
+![Linking with calabash.framework](https://github.com/calabash/calabash-ios/raw/master/documentation/Frameworks.png "Linking with frameworks")
+
+ - You must also link you -LP target with `CFNetwork.framework`
+ (unless your production target is already linking with
+ `CFNetwork`). To do this click on your -LP target in XCode. Click
+ on Build Phases, expand Link Binary with Libraries, click `+` to
+ add `CFNetwork.framework`.
+
+
+* Step 3/3: LP-Target Build Settings
+ - Click on your project and select your new "-LP" target.
+ - Select "Build Settings".
+ - Ensure that "All" and not "Basic" settings are selected in "build settings".
+ - Find "Other Linker Flags" (you can type "other link" in the search field).
+ - Ensure that "Other linker flags" contains: `-force_load "$(SRCROOT)/calabash.framework/calabash" -lstdc++`
+
+*Note*: Now that you have created a separate target, new files that you add to your project are not automatically added to your -LP target. Make sure that any new files you add to your production target are also added to your -LP target.
+
+
+This screenshot is a reference for you build settings.
+
+![Build settings](https://github.com/calabash/calabash-ios/raw/master/documentation/linker_flags.png "Build settings")
+
+
+### Test that `calabash.framework` is loaded.
+
+Make sure you select your "..-LP" scheme and then run you app on 4.x/5 simulator.
+
+Verify that you see console output like
+
+ 2012-01-19 LPSimpleExample[4318:11603] Creating the server: <HTTPServer: 0x7958d70>
+ 2012-01-19 LPSimpleExample[4318:11603] HTTPServer: Started HTTP server on port 37265
+ 2012-01-19 LPSimpleExample[4318:13903] Bonjour Service Published: domain(local.) type(_http._tcp.) name(Calabash Server)
+
+
+You should now be able to explore Calabash with your application by
+installing the client as described below.
+
+If you are having problems don't waste time! Contact `karl@lesspainful.com` ASAP :)
+
+Installing the client.
+----------------------
+
+### Prerequisites
+
+You need to have Ruby 1.9.2+ installed, and a recent RubyGems
+installation. I use RVM to manage my Ruby installations.
+
+For RVM, see:
+
+ [http://beginrescueend.com/](http://beginrescueend.com/)
+
+
+### Installation
+
+* Make sure ruby and ruby gems is on your path.
+
+ krukow:~/examples$ ruby -v
+ ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin11.1.0]
+ krukow:~/examples$ gem -v
+ 1.8.10
+
+* Install the `calabash-cucumber` gem.
+
+ krukow:~$ gem install calabash-cucumber
+ Fetching: calabash-cucumber-0.9.2.gem (100%)
+ Successfully installed calabash-cucumber-0.9.2
+ 1 gem installed
+ Installing ri documentation for calabash-cucumber-0.9.2...
+ Installing RDoc documentation for calabash-cucumber-0.9.2...
+
+Exploring the sample application (or your app).
+-----------------------------------------------
+
+Start your app with the -LP target in simulator. Alternatively if you
+want to start with the sample app, make sure you clone the git
+repository and open the LPSimpleExample project in the `examples`
+folder.
+
+### Run it
+CMD-R to run. Look at the log output and verify that you see:
+
+ LPSimpleExample[11298:13703] HTTPServer: Started HTTP server on port 37265
+
+If that message is there, you're good to go.
+
+### Writing tests.
+
+Test are run using [Cucumber](http://cukes.info/) and written in a
+special and particularly readable language: Gherkin.
+
+In your project directory you can run the following command to setup a test directory.
+
+ krukow:~/tmp/test$ calabash
+ I'm about to create a subdirectory called features.
+ features will contain all your calabash tests.
+ Please hit return to confirm that's what you want.
+
+ <RETURN>
+
+ features subdirectory created. Try starting you app in the iOS simulator
+ using the Calabash/-LP target.
+
+ Then try executing
+
+ STEP_PAUSE=2 OS=ios5 DEVICE=iphone cucumber
+
+ (replace ios5 with ios4 if running iOS 4.x simulator.
+ Replace iphone with ipad if running iPad simulator.).
+
+This generates a features directory containing a single test that
+simply takes a screenshot.
+
+Try running it with cucumber (`OS=ios4` if running iOS 4).
+
+ krukow:~/tmp/test$ STEP_PAUSE=2 OS=ios5 DEVICE=iphone cucumber
+ Feature: Running a test
+ As an iOS developer
+ I want to have a sample feature file
+ So I can begin testing quickly
+
+ Scenario: Example steps # features/my_first.feature:6
+ Given the app is running # calabash-cucumber-0.9.2/lib/calabash-cucumber/calabash_steps.rb:6
+ Then take picture # calabash-cucumber-0.9.2/lib/calabash-cucumber/calabash_steps.rb:165
+ Saved screenshot: screenshot_8.png
+
+ 1 scenario (1 passed)
+ 2 steps (2 passed)
+ 0m2.036s
+ krukow:~/tmp/test$ open screenshot_8.png
+
+To see what steps are available and how they are implemented using the
+Ruby API see [Step definition wiki](https://github.com/calabash/calabash-ios/wiki/Predefined,-canned-steps).
+
+Again, please contact `karl@lesspainful.com` with any questions or problems.
+
+
+### Explore interactively!
+
+A nice way to use calabash is to explore it interactively.
+The easy way is to just run one of the irb scripts: `irb_ios4.sh` or
+`irb_ios5.sh`. These are included in the `examples` folder in the
+[git repo](https://github.com/calabash/calabash-ios).
+
+From this console you can explore your application interactively.
+
+You can query, touch, scroll, etc from the irb session. You'll see how below.
+
+### Query
+If you're running the iOS5 iPhone simulator run `irb_ios5.sh` otherwise: `irb_ios4.sh`.
+(if you're running iPad edit the appropriate script and change `iphone` to `ipad`).
+
+Notice that the sample app has a button: "Login".
+Now try this from the irb:
+
+ ruby-1.9.2-p290 :003 > query("button")
+
+You should see something like this:
+
+ => ["<UIRoundedRectButton: 0x6567e00; frame = (109 215; 73 37); opaque = NO; autoresize = RM+BM; layer = <CALayer: 0x6567ef0>>"]
+
+The `query` function takes a string query as an argument. They query argument is similar to a css selector, for example we can do:
+
+ ruby-1.9.2-p290 :009 > query("button label")
+ => ["<UIButtonLabel: 0x6624f40; frame = (16 9; 40 19); text = 'Login'; clipsToBounds = YES; opaque = NO; userInteractionEnabled = NO; layer = <CALayer: 0x6645ec0>>"]
+
+It may also take parameters that are mapped to Objective-C selectors on the found object.
+
+ ruby-1.9.2-p290 :010 > query("button label", :text)
+ => ["Login"]
+
+### Touch
+
+Anything that can be found using query can also be touched.
+Try this while you watch the iOS Simulator:
+
+ ruby-1.9.2-p290 :011 > touch("button")
+
+Notice that the button is touched (turns blue), although this button doesn't do anything.
+
+You can also touch the tab bars:
+
+ ruby-1.9.2-p290 :016 > touch("tabBarButton index:1")
+
+The filter: `index:1` means that it is the second tab-bar button that should be touched.
+
+### Accessibility
+
+In general UI views are found using accesibility labels. To use those in the simulator they must be enabled.
+
+* Press the "home-screen" button in the iOS Simulator
+* Scroll left and open the Settings app insied iOS Simulator
+* Select `General` > `Accessibility` > `Accessibility Inspector` : On.
+* Re-run the sample app from XCode.
+
+In your irb session try this:
+
+ ruby-1.9.2-p290 :025 > query("view marked:'switch'")
+
+This command finds a view with accessibility label 'switch' (not that we use single quotes to delimit the accessibility label.
+
+In general, many views have accessibility labels that "make sense". For example the tab bar buttons have accessibility labels:
+
+ ruby-1.9.2-p290 :029 > touch("tabBarButton marked:'second'")
+
+To control accessibility labels on your views use:
+`isAccessibilityElement = YES, and accessibilityLabel = @"somelbl";` This can be done in interface builder or programmatically:
+
+ (void) viewDidLoad {
+ [super viewDidLoad];
+ self.uiswitch.isAccessibilityElement = YES;
+ self.uiswitch.accessibilityLabel = @"switch";
+ }
+
+### Advanced commands
+
+Surprisingly, these commands are enough to navigate fairly many iOS apps. However, there are many more commands available. Consult the [Step definition wiki](https://github.com/calabash/calabash-ios/wiki/Predefined,-canned-steps).
Oops, something went wrong.

0 comments on commit a0f35ce

Please sign in to comment.