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.
Files changed (86) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -5
  3. data/bin/calabash +4 -3
  4. data/lib/calabash/android/adb.rb +37 -34
  5. data/lib/calabash/android/application.rb +1 -1
  6. data/lib/calabash/android/build/builder.rb +1 -1
  7. data/lib/calabash/android/build/java_keystore.rb +1 -1
  8. data/lib/calabash/android/build/resigner.rb +1 -1
  9. data/lib/calabash/android/device.rb +46 -204
  10. data/lib/calabash/android/environment.rb +1 -14
  11. data/lib/calabash/android/gestures.rb +22 -6
  12. data/lib/calabash/android/interactions.rb +17 -14
  13. data/lib/calabash/android/legacy.rb +141 -4
  14. data/lib/calabash/android/lib/.irbrc +1 -9
  15. data/lib/calabash/android/lib/AndroidManifest.xml +2 -23
  16. data/lib/calabash/android/lib/TestServer.apk +0 -0
  17. data/lib/calabash/android/life_cycle.rb +3 -3
  18. data/lib/calabash/android/orientation.rb +8 -8
  19. data/lib/calabash/android/physical_buttons.rb +16 -19
  20. data/lib/calabash/android/server.rb +1 -6
  21. data/lib/calabash/android/text.rb +12 -12
  22. data/lib/calabash/android.rb +26 -92
  23. data/lib/calabash/application.rb +0 -3
  24. data/lib/calabash/cli/generate.rb +18 -8
  25. data/lib/calabash/cli/helpers.rb +9 -4
  26. data/lib/calabash/cli/run.rb +1 -1
  27. data/lib/calabash/console_helpers.rb +11 -179
  28. data/lib/calabash/device.rb +19 -4
  29. data/lib/calabash/gestures.rb +198 -292
  30. data/lib/calabash/http/retriable_client.rb +3 -18
  31. data/lib/calabash/http.rb +0 -1
  32. data/lib/calabash/interactions.rb +40 -3
  33. data/lib/calabash/ios/conditions.rb +1 -1
  34. data/lib/calabash/ios/console_helpers.rb +2 -2
  35. data/lib/calabash/ios/date_picker.rb +8 -10
  36. data/lib/calabash/ios/device/device_implementation.rb +21 -9
  37. data/lib/calabash/ios/device/gestures_mixin.rb +55 -53
  38. data/lib/calabash/ios/device/keyboard_mixin.rb +0 -21
  39. data/lib/calabash/ios/device/rotation_mixin.rb +65 -3
  40. data/lib/calabash/ios/device/text_mixin.rb +21 -0
  41. data/lib/calabash/ios/device.rb +1 -0
  42. data/lib/calabash/ios/gestures.rb +90 -24
  43. data/lib/calabash/ios/interactions.rb +6 -1
  44. data/lib/calabash/ios/lib/.irbrc +2 -9
  45. data/lib/calabash/ios/orientation.rb +8 -8
  46. data/lib/calabash/ios/runtime.rb +14 -14
  47. data/lib/calabash/ios/scroll.rb +17 -25
  48. data/lib/calabash/ios/slider.rb +18 -11
  49. data/lib/calabash/ios/text.rb +74 -20
  50. data/lib/calabash/ios/uia.rb +1 -1
  51. data/lib/calabash/ios.rb +16 -77
  52. data/lib/calabash/legacy.rb +6 -9
  53. data/lib/calabash/lib/skeleton/{Gemfile.skeleton → Gemfile} +0 -0
  54. data/lib/calabash/lib/skeleton/config/{cucumber.yml.skeleton → cucumber.yml} +0 -0
  55. data/lib/calabash/lib/skeleton/features/{sample.feature.skeleton → sample.feature} +0 -0
  56. data/lib/calabash/lib/skeleton/features/step_definitions/{sample_steps.rb.skeleton → calabash_steps.rb} +8 -8
  57. data/lib/calabash/lib/skeleton/features/support/{dry_run.rb.skeleton → dry_run.rb} +5 -2
  58. data/lib/calabash/lib/skeleton/features/support/{env.rb.skeleton → env.rb} +8 -2
  59. data/lib/calabash/lib/skeleton/features/support/hooks.rb +83 -0
  60. data/lib/calabash/life_cycle.rb +8 -16
  61. data/lib/calabash/location.rb +15 -14
  62. data/lib/calabash/orientation.rb +8 -8
  63. data/lib/calabash/page.rb +4 -1
  64. data/lib/calabash/screenshot.rb +3 -3
  65. data/lib/calabash/text.rb +19 -31
  66. data/lib/calabash/utility.rb +8 -41
  67. data/lib/calabash/version.rb +1 -1
  68. data/lib/calabash/wait.rb +192 -177
  69. data/lib/calabash.rb +10 -53
  70. metadata +32 -43
  71. data/lib/calabash/android/device/helper_application.rb +0 -95
  72. data/lib/calabash/android/lib/HelperApplication.apk +0 -0
  73. data/lib/calabash/android/lib/HelperApplicationTestServer.apk +0 -0
  74. data/lib/calabash/android/web.rb +0 -12
  75. data/lib/calabash/http/forwarding_client.rb +0 -23
  76. data/lib/calabash/internal.rb +0 -48
  77. data/lib/calabash/ios/automator/automator.rb +0 -217
  78. data/lib/calabash/ios/automator/coordinates.rb +0 -37
  79. data/lib/calabash/ios/automator/device_agent.rb +0 -379
  80. data/lib/calabash/ios/automator.rb +0 -9
  81. data/lib/calabash/ios/legacy.rb +0 -6
  82. data/lib/calabash/ios/web.rb +0 -10
  83. data/lib/calabash/lib/skeleton/features/support/hooks.rb.skeleton +0 -34
  84. data/lib/calabash/retry.rb +0 -33
  85. data/lib/calabash/stubs.rb +0 -21
  86. data/lib/calabash/web.rb +0 -44
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f3765e67e7cec21052896d43ad8e3b52ab873aa9
4
- data.tar.gz: a25e627e951abd1f87d3aae55745fb3451853a75
3
+ metadata.gz: c9918df9dac58e62b8dd1f98df5e15bc1397e45c
4
+ data.tar.gz: da8b89437c9d0081fd3e95ea87f6f9fdb622a816
5
5
  SHA512:
6
- metadata.gz: b4bf50f53dc792ff9854f068761d3ab3f464a4028c777292529a3172c5dd681a489b74ac1467aec1fa3954073e7425b27b43a39a2cab1e8e30a4a551f5043c06
7
- data.tar.gz: 331293d4107302ccd412ef857d3a274977fe872ad93b642f00eb12689e16a1a889b157c6f13cf80493d34b6ed9c96993f6516ee9ab6ab18a09aae2cb681db537
6
+ metadata.gz: dbf27f752dabd23e53ed70a7562314d6affe0cb14e770d46e97d1c59c4c5836f58c26cdb75cb23ebd38ce50a3e662e9aac7edb6a334dd764169d49d0f80ad0db
7
+ data.tar.gz: fd52b4f6b2d24111cf62d015a833d9eded491b5dd926fa72c114eaf7a2c83598865803e7ddaa960a164db0fd42115c786f862765c3039071ad2a8852c9bb6aee
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  ## Calabash
6
6
 
7
- Automated Acceptance Testing for Mobile Apps.
7
+ Automated Acceptance Testing for Mobile Apps
8
8
 
9
9
  ## Rake
10
10
 
@@ -29,13 +29,25 @@ rake yard:publish # Generate and publish docs
29
29
 
30
30
  ```
31
31
  $ be rake unit # All unit tests.
32
+ $ be rake spec # All tests. Launches iOS Simulators, etc.
32
33
  $ be guard # Run unit tests as you develop.
33
34
  ```
34
35
 
35
- ### Integration tests
36
+ ### Cucumber Android
37
+
38
+ **NOTE** If you find you cannot launch on Android, be sure you run the
39
+ `copy\_repos` and `changing\_old\_files.sh` script.
36
40
 
37
41
  ```
38
- $ rake integration:page-object-model # Run POM tests
39
- $ rake integration:ruby # Run tests ensuing correct Ruby interfacing
40
- $ rake integration:cli # Run command line interface tests
42
+ $ bundle update
43
+ $ rake android:build
44
+ $ cd cucumber/android
45
+ $ be calabash resign ../../spec/resources/android/xtc-android-sample.apk
46
+ $ be calabash build ../../spec/resources/android/xtc-android-sample.apk
47
+ $ be cucumber
41
48
  ```
49
+
50
+ ### Cucumber iOS
51
+
52
+ See `cucumber/ios/README.md`.
53
+
data/bin/calabash CHANGED
@@ -11,6 +11,7 @@ module Calabash
11
11
  include Calabash::CLI::Console
12
12
  include Calabash::CLI::Generate
13
13
  include Calabash::CLI::Resign
14
+ include Calabash::CLI::Run
14
15
  include Calabash::CLI::SetupKeystore
15
16
 
16
17
  def initialize(arguments)
@@ -68,12 +69,12 @@ module Calabash
68
69
  parse_resign_arguments!
69
70
  when 'console'
70
71
  parse_console_arguments!
71
- when 'generate-cucumber'
72
+ when 'generate'
72
73
  parse_generate_arguments!
74
+ when 'run'
75
+ parse_run_arguments!
73
76
  when 'setup-keystore'
74
77
  parse_setup_keystore_arguments!
75
- when 'used-bundler' # For testing purposes
76
- puts Calabash::Utility.used_bundler?
77
78
  when 'help'
78
79
  argument = @arguments.shift
79
80
 
@@ -66,10 +66,20 @@ module Calabash
66
66
  # @!visibility private
67
67
  DAEMON_STARTED_MESSAGE = "* daemon not running. starting it now on port 5037 *\n* daemon started successfully *\n"
68
68
 
69
- # @!visibility private
70
69
  def self.command(*cmd, **args)
71
70
  Logger.debug("ADB Command: #{cmd.join(', ')}")
72
71
  Logger.debug("ADB input: #{args[:input]}")
72
+
73
+ cmd_s = "#{Environment.adb_path} #{cmd.join(' ')}"
74
+
75
+ Logger.debug("Going to execute: #{cmd_s}")
76
+ `#{cmd_s}`
77
+ end
78
+
79
+ # @!visibility private
80
+ def self.old_command(*cmd, **args)
81
+ Logger.debug("ADB Command: #{cmd.join(', ')}")
82
+ Logger.debug("ADB input: #{args[:input]}")
73
83
  stderr = nil
74
84
  stdout = nil
75
85
  exit_code = nil
@@ -142,11 +152,16 @@ module Calabash
142
152
  ADB.command(*cmd, args)
143
153
  end
144
154
 
155
+ # @!visibility private
156
+ def shell(shell_cmd, options={})
157
+ command('shell', shell_cmd)
158
+ end
159
+
145
160
  # @!visibility private
146
161
  END_STRING = '__CAL_END__'
147
162
 
148
163
  # @!visibility private
149
- def shell(shell_cmd, options={})
164
+ def old_shell(shell_cmd, options={})
150
165
  if shell_cmd.nil? || shell_cmd.empty?
151
166
  raise ArgumentError, "Invalid shell command '#{shell_cmd}'"
152
167
  end
@@ -182,40 +197,34 @@ module Calabash
182
197
  # exit_code_s =
183
198
  # [6] "0\r\n"
184
199
 
185
- unless shell_name.empty?
186
- index = result.lines.index {|line| line.start_with?(shell_name)}
200
+ index = result.lines.index {|line| line.start_with?(shell_name)}
187
201
 
188
- if index.nil?
189
- raise ADBCallError.new("Could not parse output #{ADB.dot_string(result, 100)}", result)
190
- end
202
+ if index.nil?
203
+ raise ADBCallError.new("Could not parse output #{ADB.dot_string(result, 100)}", result)
204
+ end
191
205
 
192
- # Remove the commands
193
- out = result.lines[index+1..-1]
206
+ # Remove the commands
207
+ out = result.lines[index+1..-1]
194
208
 
195
- last_line = out.last
196
- end_index = nil
209
+ last_line = out.last
210
+ end_index = nil
197
211
 
198
- 15.times do |i|
199
- if last_line[-(END_STRING.length+i-1)..-i] == END_STRING
200
- end_index = -i
201
- break
202
- end
212
+ 15.times do |i|
213
+ if last_line[-(END_STRING.length+i-1)..-i] == END_STRING
214
+ end_index = -i
215
+ break
203
216
  end
217
+ end
204
218
 
205
- if end_index.nil?
206
- raise ADBCallError.new("Could not parse output #{ADB.dot_string(result, 100)}", result)
207
- end
219
+ if end_index.nil?
220
+ raise ADBCallError.new("Could not parse output #{ADB.dot_string(result, 100)}", result)
221
+ end
208
222
 
209
- # Get the result from the command
210
- command_result = out[0..-2].join + last_line[0..(end_index - END_STRING.length)]
223
+ # Get the result from the command
224
+ command_result = out[0..-2].join + last_line[0..(end_index - END_STRING.length)]
211
225
 
212
- # Get the exit code
213
- exit_code_s = out[-1][end_index+1..-1]
214
- else # Some devices (like Android N) have started just giving us the result without all the spam
215
- out = result.lines
216
- command_result = out[0..-2].join
217
- exit_code_s = out[-1][END_STRING.length..-1]
218
- end
226
+ # Get the exit code
227
+ exit_code_s = out[-1][end_index+1..-1]
219
228
 
220
229
  unless options[:no_exit_code_check]
221
230
  unless exit_code_s.to_i.to_s == exit_code_s.chomp
@@ -277,12 +286,6 @@ module Calabash
277
286
 
278
287
  #result.lines.index {|line| !line.start_with?('echo')}
279
288
 
280
- # Some devices (like Android N) have started just giving us the results
281
- if result.strip == "test"
282
- @shell_name = ""
283
- return @shell_name
284
- end
285
-
286
289
  # "shell@hammerhead:/ $ echo \"foo\"; exit 0\r\r\n"
287
290
  shell_name_line = result.lines[-2]
288
291
 
@@ -29,7 +29,7 @@ module Calabash
29
29
 
30
30
  unless File.exist?(test_server_path)
31
31
  Logger.error "Test-server '#{test_server_path}' does not exist."
32
- Logger.error "Build it using: '#{Calabash::Utility.bundle_exec_prepend}calabash build \"#{application_path}\"'"
32
+ Logger.error "Build it using: 'calabash build \"#{application_path}\"'"
33
33
  Logger.error ''
34
34
  raise "Test-server '#{test_server_path}' does not exist."
35
35
  end
@@ -38,7 +38,7 @@ module Calabash
38
38
  end
39
39
  @logger.log ""
40
40
  @logger.log "You can resign the app with #{keystores.first.location} by running:
41
- #{Calabash::Utility.bundle_exec_prepend}calabash resign \"#{@application_path}\""
41
+ calabash resign \"#{@application_path}\""
42
42
 
43
43
  @logger.log ""
44
44
  @logger.log "Notice that resigning an app might break some functionality."
@@ -155,7 +155,7 @@ module Calabash
155
155
  begin
156
156
  keystore = JSON.parse(IO.read(CALABASH_KEYSTORE_SETTINGS_FILENAME))
157
157
  rescue JSON::ParserError => e
158
- Logger.error("Could not parse keystore settings. Please run #{Calabash::Utility.bundle_exec_prepend}calabash setup-keystore again")
158
+ Logger.error('Could not parse keystore settings. Please run calabash setup-keystore again')
159
159
 
160
160
  raise e
161
161
  end
@@ -67,7 +67,7 @@ module Calabash
67
67
  java_keystore = JavaKeystore.get_keystores.first
68
68
 
69
69
  if java_keystore.nil?
70
- raise "No keystores found. You can specify the keystore location and credentials using #{Calabash::Utility.bundle_exec_prepend}calabash setup-keystore"
70
+ raise 'No keystores found. You can specify the keystore location and credentials using calabash setup-keystore'
71
71
  end
72
72
 
73
73
  java_keystore.sign_apk(app_path, dest_path)