calabash 2.0.0.pre11 → 2.0.0.prelegacy
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +17 -5
- data/bin/calabash +4 -3
- data/lib/calabash/android/adb.rb +37 -34
- data/lib/calabash/android/application.rb +1 -1
- data/lib/calabash/android/build/builder.rb +1 -1
- data/lib/calabash/android/build/java_keystore.rb +1 -1
- data/lib/calabash/android/build/resigner.rb +1 -1
- data/lib/calabash/android/device.rb +46 -204
- data/lib/calabash/android/environment.rb +1 -14
- data/lib/calabash/android/gestures.rb +22 -6
- data/lib/calabash/android/interactions.rb +17 -14
- data/lib/calabash/android/legacy.rb +141 -4
- data/lib/calabash/android/lib/.irbrc +1 -9
- data/lib/calabash/android/lib/AndroidManifest.xml +2 -23
- data/lib/calabash/android/lib/TestServer.apk +0 -0
- data/lib/calabash/android/life_cycle.rb +3 -3
- data/lib/calabash/android/orientation.rb +8 -8
- data/lib/calabash/android/physical_buttons.rb +16 -19
- data/lib/calabash/android/server.rb +1 -6
- data/lib/calabash/android/text.rb +12 -12
- data/lib/calabash/android.rb +26 -92
- data/lib/calabash/application.rb +0 -3
- data/lib/calabash/cli/generate.rb +18 -8
- data/lib/calabash/cli/helpers.rb +9 -4
- data/lib/calabash/cli/run.rb +1 -1
- data/lib/calabash/console_helpers.rb +11 -179
- data/lib/calabash/device.rb +19 -4
- data/lib/calabash/gestures.rb +198 -292
- data/lib/calabash/http/retriable_client.rb +3 -18
- data/lib/calabash/http.rb +0 -1
- data/lib/calabash/interactions.rb +40 -3
- data/lib/calabash/ios/conditions.rb +1 -1
- data/lib/calabash/ios/console_helpers.rb +2 -2
- data/lib/calabash/ios/date_picker.rb +8 -10
- data/lib/calabash/ios/device/device_implementation.rb +21 -9
- data/lib/calabash/ios/device/gestures_mixin.rb +55 -53
- data/lib/calabash/ios/device/keyboard_mixin.rb +0 -21
- data/lib/calabash/ios/device/rotation_mixin.rb +65 -3
- data/lib/calabash/ios/device/text_mixin.rb +21 -0
- data/lib/calabash/ios/device.rb +1 -0
- data/lib/calabash/ios/gestures.rb +90 -24
- data/lib/calabash/ios/interactions.rb +6 -1
- data/lib/calabash/ios/lib/.irbrc +2 -9
- data/lib/calabash/ios/orientation.rb +8 -8
- data/lib/calabash/ios/runtime.rb +14 -14
- data/lib/calabash/ios/scroll.rb +17 -25
- data/lib/calabash/ios/slider.rb +18 -11
- data/lib/calabash/ios/text.rb +74 -20
- data/lib/calabash/ios/uia.rb +1 -1
- data/lib/calabash/ios.rb +16 -77
- data/lib/calabash/legacy.rb +6 -9
- data/lib/calabash/lib/skeleton/{Gemfile.skeleton → Gemfile} +0 -0
- data/lib/calabash/lib/skeleton/config/{cucumber.yml.skeleton → cucumber.yml} +0 -0
- data/lib/calabash/lib/skeleton/features/{sample.feature.skeleton → sample.feature} +0 -0
- data/lib/calabash/lib/skeleton/features/step_definitions/{sample_steps.rb.skeleton → calabash_steps.rb} +8 -8
- data/lib/calabash/lib/skeleton/features/support/{dry_run.rb.skeleton → dry_run.rb} +5 -2
- data/lib/calabash/lib/skeleton/features/support/{env.rb.skeleton → env.rb} +8 -2
- data/lib/calabash/lib/skeleton/features/support/hooks.rb +83 -0
- data/lib/calabash/life_cycle.rb +8 -16
- data/lib/calabash/location.rb +15 -14
- data/lib/calabash/orientation.rb +8 -8
- data/lib/calabash/page.rb +4 -1
- data/lib/calabash/screenshot.rb +3 -3
- data/lib/calabash/text.rb +19 -31
- data/lib/calabash/utility.rb +8 -41
- data/lib/calabash/version.rb +1 -1
- data/lib/calabash/wait.rb +192 -177
- data/lib/calabash.rb +10 -53
- metadata +32 -43
- data/lib/calabash/android/device/helper_application.rb +0 -95
- data/lib/calabash/android/lib/HelperApplication.apk +0 -0
- data/lib/calabash/android/lib/HelperApplicationTestServer.apk +0 -0
- data/lib/calabash/android/web.rb +0 -12
- data/lib/calabash/http/forwarding_client.rb +0 -23
- data/lib/calabash/internal.rb +0 -48
- data/lib/calabash/ios/automator/automator.rb +0 -217
- data/lib/calabash/ios/automator/coordinates.rb +0 -37
- data/lib/calabash/ios/automator/device_agent.rb +0 -379
- data/lib/calabash/ios/automator.rb +0 -9
- data/lib/calabash/ios/legacy.rb +0 -6
- data/lib/calabash/ios/web.rb +0 -10
- data/lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton +0 -34
- data/lib/calabash/retry.rb +0 -33
- data/lib/calabash/stubs.rb +0 -21
- data/lib/calabash/web.rb +0 -44
| @@ -5,99 +5,21 @@ module Calabash | |
| 5 5 | 
             
              # Methods you can use in the Calabash console to help you
         | 
| 6 6 | 
             
              # interact with your app.
         | 
| 7 7 | 
             
              module ConsoleHelpers
         | 
| 8 | 
            -
                # Reloads all required files that have git changes
         | 
| 9 | 
            -
                def reload_git_files
         | 
| 10 | 
            -
                  files_to_reload =
         | 
| 11 | 
            -
                      (`cd ../../../ && git status`.lines.grep(/modified/).map{|l| l.split(" ").last.gsub('../', '')} +
         | 
| 12 | 
            -
                          `cd ../../../ && git ls-files --others --exclude-standard`.lines).map(&:chomp)
         | 
| 13 | 
            -
             | 
| 14 | 
            -
                  $LOADED_FEATURES.each do |file|
         | 
| 15 | 
            -
                    files_to_reload.each do |reload_name|
         | 
| 16 | 
            -
                      if file.end_with?(reload_name)
         | 
| 17 | 
            -
                        puts "LOADING #{file}"
         | 
| 18 | 
            -
                        load file
         | 
| 19 | 
            -
                        break
         | 
| 20 | 
            -
                      end
         | 
| 21 | 
            -
                    end
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
             | 
| 24 | 
            -
                  true
         | 
| 25 | 
            -
                end
         | 
| 26 | 
            -
             | 
| 27 | 
            -
                # Outputs all calabash methods
         | 
| 28 | 
            -
                def cal_methods
         | 
| 29 | 
            -
                  c = Class.new(BasicObject) do
         | 
| 30 | 
            -
                    include Calabash
         | 
| 31 | 
            -
                  end
         | 
| 32 | 
            -
             | 
| 33 | 
            -
                  ConsoleHelpers.puts_unbound_methods(c, 'cal.')
         | 
| 34 | 
            -
                  true
         | 
| 35 | 
            -
                end
         | 
| 36 | 
            -
             | 
| 37 | 
            -
                # Outputs a calabash method
         | 
| 38 | 
            -
                def cal_method(method)
         | 
| 39 | 
            -
                  c = Class.new(BasicObject) do
         | 
| 40 | 
            -
                    include Calabash
         | 
| 41 | 
            -
                  end
         | 
| 42 | 
            -
             | 
| 43 | 
            -
                  ConsoleHelpers.puts_unbound_method(c, method.to_sym, 'cal.')
         | 
| 44 | 
            -
                  true
         | 
| 45 | 
            -
                end
         | 
| 46 | 
            -
             | 
| 47 | 
            -
                # Outputs all calabash iOS methods
         | 
| 48 | 
            -
                def cal_ios_methods
         | 
| 49 | 
            -
                  c = Class.new(BasicObject) do
         | 
| 50 | 
            -
                    include Calabash::IOSInternal
         | 
| 51 | 
            -
                  end
         | 
| 52 | 
            -
             | 
| 53 | 
            -
                  ConsoleHelpers.puts_unbound_methods(c, 'cal_ios.')
         | 
| 54 | 
            -
                  true
         | 
| 55 | 
            -
                end
         | 
| 56 | 
            -
             | 
| 57 | 
            -
                # Outputs a calabash Android method
         | 
| 58 | 
            -
                def cal_ios_method(method)
         | 
| 59 | 
            -
                  c = Class.new(BasicObject) do
         | 
| 60 | 
            -
                    include Calabash::IOSInternal
         | 
| 61 | 
            -
                  end
         | 
| 62 | 
            -
             | 
| 63 | 
            -
                  ConsoleHelpers.puts_unbound_method(c, method.to_sym, 'cal_ios.')
         | 
| 64 | 
            -
                  true
         | 
| 65 | 
            -
                end
         | 
| 66 | 
            -
             | 
| 67 | 
            -
                # Outputs all calabash Android methods
         | 
| 68 | 
            -
                def cal_android_methods
         | 
| 69 | 
            -
                  c = Class.new(BasicObject) do
         | 
| 70 | 
            -
                    include Calabash::AndroidInternal
         | 
| 71 | 
            -
                  end
         | 
| 72 | 
            -
             | 
| 73 | 
            -
                  ConsoleHelpers.puts_unbound_methods(c, 'cal_android.')
         | 
| 74 | 
            -
                  true
         | 
| 75 | 
            -
                end
         | 
| 76 | 
            -
             | 
| 77 | 
            -
                # Outputs a calabash Android method
         | 
| 78 | 
            -
                def cal_android_method(method)
         | 
| 79 | 
            -
                  c = Class.new(BasicObject) do
         | 
| 80 | 
            -
                    include Calabash::AndroidInternal
         | 
| 81 | 
            -
                  end
         | 
| 82 | 
            -
             | 
| 83 | 
            -
                  ConsoleHelpers.puts_unbound_method(c, method.to_sym, 'cal_android.')
         | 
| 84 | 
            -
                  true
         | 
| 85 | 
            -
                end
         | 
| 86 8 |  | 
| 87 9 | 
             
                # Outputs all visible elements as a tree.
         | 
| 88 10 | 
             
                def tree
         | 
| 89 | 
            -
                  ConsoleHelpers.dump( | 
| 11 | 
            +
                  ConsoleHelpers.dump(Device.default.dump)
         | 
| 90 12 | 
             
                  true
         | 
| 91 13 | 
             
                end
         | 
| 92 14 |  | 
| 93 15 | 
             
                # List the visible element classes.
         | 
| 94 16 | 
             
                def classes
         | 
| 95 | 
            -
                   | 
| 17 | 
            +
                  query("*").map{|e| e['class']}.uniq
         | 
| 96 18 | 
             
                end
         | 
| 97 19 |  | 
| 98 20 | 
             
                # List the visible element ids.
         | 
| 99 21 | 
             
                def ids
         | 
| 100 | 
            -
                   | 
| 22 | 
            +
                  query("*").map{|e| e['id']}.compact
         | 
| 101 23 | 
             
                end
         | 
| 102 24 |  | 
| 103 25 | 
             
                # Copy all the commands entered in the current console session into the OS
         | 
| @@ -170,31 +92,14 @@ module Calabash | |
| 170 92 | 
             
                # @!visibility private
         | 
| 171 93 | 
             
                def puts_console_details
         | 
| 172 94 | 
             
                  puts ''
         | 
| 173 | 
            -
                  puts '#             =>  Useful  | 
| 174 | 
            -
                  puts Color.cyan('> | 
| 175 | 
            -
                  puts Color.cyan('> | 
| 176 | 
            -
                  puts Color.cyan("> | 
| 177 | 
            -
                  puts Color.cyan('> | 
| 178 | 
            -
                  puts Color.cyan('> | 
| 179 | 
            -
                  puts Color.cyan('> | 
| 180 | 
            -
                  puts Color.cyan('> | 
| 181 | 
            -
                  puts Color.cyan('> cal_methods => Print all cross-platform Calabash methods.')
         | 
| 182 | 
            -
                  puts Color.cyan('> cal_method(method) => Print all information about a Calabash method')
         | 
| 183 | 
            -
             | 
| 184 | 
            -
                  if defined?(Calabash::AndroidInternal)
         | 
| 185 | 
            -
                    puts ''
         | 
| 186 | 
            -
                    puts 'Android specific'
         | 
| 187 | 
            -
                    puts Color.cyan('> cal_android_methods => Print all Android-specific Calabash methods.')
         | 
| 188 | 
            -
                    puts Color.cyan('> cal_android_method(method) => Print all information about an Android-specific Calabash method.')
         | 
| 189 | 
            -
                  end
         | 
| 190 | 
            -
             | 
| 191 | 
            -
                  if defined?(Calabash::IOSInternal)
         | 
| 192 | 
            -
                    puts ''
         | 
| 193 | 
            -
                    puts 'iOS specific'
         | 
| 194 | 
            -
                    puts Color.cyan('> cal_ios_methods => Print all iOS-specific Calabash methods.')
         | 
| 195 | 
            -
                    puts Color.cyan('> cal_ios_method(method) => Print all information about an ios-specific Calabash method.')
         | 
| 196 | 
            -
                  end
         | 
| 197 | 
            -
             | 
| 95 | 
            +
                  puts Color.blue('#             =>  Useful Methods  <=              #')
         | 
| 96 | 
            +
                  puts Color.cyan('>     ids => List all the visible ids.')
         | 
| 97 | 
            +
                  puts Color.cyan('> classes => List all the visible classes.')
         | 
| 98 | 
            +
                  puts Color.cyan(">    tree => The app's visible view hierarchy.")
         | 
| 99 | 
            +
                  puts Color.cyan('>    copy => Copy console commands to the Clipboard.')
         | 
| 100 | 
            +
                  puts Color.cyan('>   clear => Clear the console.')
         | 
| 101 | 
            +
                  puts Color.cyan('> verbose => Turn debug logging on.')
         | 
| 102 | 
            +
                  puts Color.cyan('>   quiet => Turn debug logging off.')
         | 
| 198 103 | 
             
                  puts ''
         | 
| 199 104 | 
             
                end
         | 
| 200 105 |  | 
| @@ -286,78 +191,5 @@ module Calabash | |
| 286 191 | 
             
                def self.visible?(data)
         | 
| 287 192 | 
             
                  raise AbstractMethodError
         | 
| 288 193 | 
             
                end
         | 
| 289 | 
            -
             | 
| 290 | 
            -
                # @!visibility private
         | 
| 291 | 
            -
                def self.puts_unbound_methods(clazz, prefix)
         | 
| 292 | 
            -
                  (clazz.instance_methods - BasicObject.instance_methods).each do |method_sym|
         | 
| 293 | 
            -
                    signature,description = method_signature(clazz.instance_method(method_sym))
         | 
| 294 | 
            -
             | 
| 295 | 
            -
                    puts_method(signature, description, prefix)
         | 
| 296 | 
            -
                  end
         | 
| 297 | 
            -
                end
         | 
| 298 | 
            -
             | 
| 299 | 
            -
                # @!visibility private
         | 
| 300 | 
            -
                def self.puts_unbound_method(clazz, method, prefix)
         | 
| 301 | 
            -
                  signature,description = method_signature(clazz.instance_method(method), true)
         | 
| 302 | 
            -
             | 
| 303 | 
            -
                  puts_method(signature, description, prefix)
         | 
| 304 | 
            -
                end
         | 
| 305 | 
            -
             | 
| 306 | 
            -
                # @!visibility private
         | 
| 307 | 
            -
                def self.puts_method(signature, description, prefix)
         | 
| 308 | 
            -
                  if signature != nil
         | 
| 309 | 
            -
                    puts Color.yellow(description)
         | 
| 310 | 
            -
                    puts Color.blue("#{prefix}#{signature}")
         | 
| 311 | 
            -
                    puts ''
         | 
| 312 | 
            -
                  end
         | 
| 313 | 
            -
                end
         | 
| 314 | 
            -
             | 
| 315 | 
            -
                # @!visibility private
         | 
| 316 | 
            -
                def self.method_signature(method, full_description = false)
         | 
| 317 | 
            -
                  file_name, line = method.source_location
         | 
| 318 | 
            -
             | 
| 319 | 
            -
                  file = File.open(file_name, 'r')
         | 
| 320 | 
            -
             | 
| 321 | 
            -
                  description = nil
         | 
| 322 | 
            -
                  read_next_lines = false
         | 
| 323 | 
            -
             | 
| 324 | 
            -
                  (line-1).times do
         | 
| 325 | 
            -
                    line = file.gets.strip
         | 
| 326 | 
            -
             | 
| 327 | 
            -
                    if line.start_with?('#')
         | 
| 328 | 
            -
                      if line.length == 1 || line.start_with?("# @")
         | 
| 329 | 
            -
                        read_next_lines = false
         | 
| 330 | 
            -
                      end
         | 
| 331 | 
            -
             | 
| 332 | 
            -
                      if description.nil?
         | 
| 333 | 
            -
                        description = line[2..-1]
         | 
| 334 | 
            -
                        read_next_lines = true
         | 
| 335 | 
            -
                      elsif read_next_lines || full_description
         | 
| 336 | 
            -
                        description = "#{description}\n#{line[2..-1]}"
         | 
| 337 | 
            -
                      end
         | 
| 338 | 
            -
                    else
         | 
| 339 | 
            -
                      description = nil
         | 
| 340 | 
            -
                    end
         | 
| 341 | 
            -
                  end
         | 
| 342 | 
            -
             | 
| 343 | 
            -
                  signature = file.gets.strip[4..-1]
         | 
| 344 | 
            -
             | 
| 345 | 
            -
                  method_name = if signature.index('(')
         | 
| 346 | 
            -
                                  signature[0,signature.index('(')]
         | 
| 347 | 
            -
                                else
         | 
| 348 | 
            -
                                  signature
         | 
| 349 | 
            -
                                end
         | 
| 350 | 
            -
             | 
| 351 | 
            -
                  # Remove alias'ed methods
         | 
| 352 | 
            -
                  if method_name != method.name.to_s
         | 
| 353 | 
            -
                    signature = nil
         | 
| 354 | 
            -
                  end
         | 
| 355 | 
            -
             | 
| 356 | 
            -
                  if description && description.start_with?("@!visibility private")
         | 
| 357 | 
            -
                    signature = nil
         | 
| 358 | 
            -
                  end
         | 
| 359 | 
            -
             | 
| 360 | 
            -
                  [signature,description]
         | 
| 361 | 
            -
                end
         | 
| 362 194 | 
             
              end
         | 
| 363 195 | 
             
            end
         | 
    
        data/lib/calabash/device.rb
    CHANGED
    
    | @@ -5,7 +5,7 @@ module Calabash | |
| 5 5 | 
             
                include Utility
         | 
| 6 6 |  | 
| 7 7 | 
             
                # @!visibility private
         | 
| 8 | 
            -
                @@default  | 
| 8 | 
            +
                @@default = nil
         | 
| 9 9 |  | 
| 10 10 | 
             
                # @!visibility private
         | 
| 11 11 | 
             
                def self.default
         | 
| @@ -180,14 +180,29 @@ module Calabash | |
| 180 180 | 
             
                # @see Calabash::Gestures#pan
         | 
| 181 181 | 
             
                # @!visibility private
         | 
| 182 182 | 
             
                def pan(query, from, to, options={})
         | 
| 183 | 
            -
                   | 
| 183 | 
            +
                  Query.ensure_valid_query(query)
         | 
| 184 | 
            +
             | 
| 185 | 
            +
                  ensure_valid_swipe_params(from, to)
         | 
| 186 | 
            +
             | 
| 187 | 
            +
                  gesture_options = options.dup
         | 
| 188 | 
            +
                  gesture_options[:duration] ||= 0.5
         | 
| 189 | 
            +
                  gesture_options[:timeout] ||= Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT
         | 
| 190 | 
            +
             | 
| 191 | 
            +
                  _pan(query, from, to, gesture_options)
         | 
| 184 192 | 
             
                end
         | 
| 185 193 |  | 
| 186 194 | 
             
                # Performs a `pan` between two elements.
         | 
| 187 195 | 
             
                # @see Calabash::Gestures#pan_between
         | 
| 188 196 | 
             
                # @!visibility private
         | 
| 189 197 | 
             
                def pan_between(query_from, query_to, options={})
         | 
| 190 | 
            -
                   | 
| 198 | 
            +
                  Query.ensure_valid_query(query_from)
         | 
| 199 | 
            +
                  Query.ensure_valid_query(query_to)
         | 
| 200 | 
            +
             | 
| 201 | 
            +
                  gesture_options = options.dup
         | 
| 202 | 
            +
                  gesture_options[:duration] ||= 1
         | 
| 203 | 
            +
                  gesture_options[:timeout] ||= Calabash::Gestures::DEFAULT_GESTURE_WAIT_TIMEOUT
         | 
| 204 | 
            +
             | 
| 205 | 
            +
                  _pan_between(query_from, query_to, gesture_options)
         | 
| 191 206 | 
             
                end
         | 
| 192 207 |  | 
| 193 208 | 
             
                # Performs a `flick` on the (first) view that matches `query`.
         | 
| @@ -224,7 +239,7 @@ module Calabash | |
| 224 239 | 
             
                # Enter `text` into the currently focused view.
         | 
| 225 240 | 
             
                # @see Calabash::Text#enter_text
         | 
| 226 241 | 
             
                # @!visibility private
         | 
| 227 | 
            -
                def enter_text(text | 
| 242 | 
            +
                def enter_text(text)
         | 
| 228 243 | 
             
                  abstract_method!
         | 
| 229 244 | 
             
                end
         | 
| 230 245 |  |