calabash 1.9.9.pre3 → 2.0.0.prelegacy
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -33
- data/bin/calabash +45 -36
- data/lib/calabash.rb +137 -13
- data/lib/calabash/android.rb +6 -0
- data/lib/calabash/android/adb.rb +25 -1
- data/lib/calabash/android/application.rb +14 -3
- data/lib/calabash/android/build/builder.rb +16 -3
- data/lib/calabash/android/build/java_keystore.rb +10 -0
- data/lib/calabash/android/build/resigner.rb +23 -1
- data/lib/calabash/android/build/test_server.rb +2 -0
- data/lib/calabash/android/defaults.rb +1 -0
- data/lib/calabash/android/device.rb +55 -3
- data/lib/calabash/android/environment.rb +10 -0
- data/lib/calabash/android/interactions.rb +106 -3
- data/lib/calabash/android/legacy.rb +143 -0
- data/lib/calabash/android/lib/TestServer.apk +0 -0
- data/lib/calabash/android/life_cycle.rb +6 -4
- data/lib/calabash/android/physical_buttons.rb +12 -1
- data/lib/calabash/android/screenshot.rb +1 -0
- data/lib/calabash/android/scroll.rb +115 -0
- data/lib/calabash/android/server.rb +3 -1
- data/lib/calabash/android/text.rb +16 -25
- data/lib/calabash/application.rb +29 -0
- data/lib/calabash/cli/build.rb +15 -1
- data/lib/calabash/cli/console.rb +9 -5
- data/lib/calabash/cli/generate.rb +5 -0
- data/lib/calabash/cli/helpers.rb +7 -1
- data/lib/calabash/cli/resign.rb +1 -0
- data/lib/calabash/cli/run.rb +10 -6
- data/lib/calabash/cli/setup_keystore.rb +2 -0
- data/lib/calabash/color.rb +7 -0
- data/lib/calabash/console_helpers.rb +4 -2
- data/lib/calabash/defaults.rb +1 -0
- data/lib/calabash/device.rb +8 -9
- data/lib/calabash/environment.rb +5 -0
- data/lib/calabash/gestures.rb +159 -66
- data/lib/calabash/http/retriable_client.rb +3 -1
- data/lib/calabash/interactions.rb +68 -5
- data/lib/calabash/ios.rb +4 -0
- data/lib/calabash/ios/application.rb +8 -1
- data/lib/calabash/ios/conditions.rb +3 -1
- data/lib/calabash/ios/date_picker.rb +412 -0
- data/lib/calabash/ios/defaults.rb +1 -0
- data/lib/calabash/ios/device.rb +1 -0
- data/lib/calabash/ios/device/device_implementation.rb +33 -16
- data/lib/calabash/ios/device/gestures_mixin.rb +202 -48
- data/lib/calabash/ios/device/ipad_1x_2x_mixin.rb +253 -0
- data/lib/calabash/ios/device/keyboard_mixin.rb +2 -0
- data/lib/calabash/ios/device/rotation_mixin.rb +11 -8
- data/lib/calabash/ios/device/routes/condition_route_mixin.rb +1 -0
- data/lib/calabash/ios/device/routes/handle_route_mixin.rb +5 -1
- data/lib/calabash/ios/device/routes/map_route_mixin.rb +1 -0
- data/lib/calabash/ios/device/routes/response_parser.rb +1 -0
- data/lib/calabash/ios/device/routes/uia_route_mixin.rb +44 -6
- data/lib/calabash/ios/device/runtime_attributes.rb +4 -5
- data/lib/calabash/ios/device/text_mixin.rb +2 -0
- data/lib/calabash/ios/device/uia_keyboard_mixin.rb +9 -0
- data/lib/calabash/ios/device/uia_mixin.rb +1 -0
- data/lib/calabash/ios/gestures.rb +82 -8
- data/lib/calabash/ios/interactions.rb +30 -1
- data/lib/calabash/ios/orientation.rb +21 -21
- data/lib/calabash/ios/runtime.rb +154 -2
- data/lib/calabash/ios/slider.rb +70 -0
- data/lib/calabash/ios/text.rb +11 -47
- data/lib/calabash/ios/uia.rb +24 -2
- data/lib/calabash/legacy.rb +7 -0
- data/lib/calabash/lib/skeleton/config/cucumber.yml +1 -3
- data/lib/calabash/lib/skeleton/features/support/dry_run.rb +8 -0
- data/lib/calabash/lib/skeleton/features/support/env.rb +15 -1
- data/lib/calabash/life_cycle.rb +78 -32
- data/lib/calabash/location.rb +2 -1
- data/lib/calabash/orientation.rb +0 -1
- data/lib/calabash/page.rb +51 -5
- data/lib/calabash/patch.rb +1 -0
- data/lib/calabash/patch/array.rb +7 -7
- data/lib/calabash/query.rb +17 -2
- data/lib/calabash/query_result.rb +14 -0
- data/lib/calabash/screenshot.rb +28 -8
- data/lib/calabash/text.rb +105 -8
- data/lib/calabash/utility.rb +6 -6
- data/lib/calabash/version.rb +1 -1
- data/lib/calabash/wait.rb +37 -11
- metadata +14 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c9918df9dac58e62b8dd1f98df5e15bc1397e45c
|
4
|
+
data.tar.gz: da8b89437c9d0081fd3e95ea87f6f9fdb622a816
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbf27f752dabd23e53ed70a7562314d6affe0cb14e770d46e97d1c59c4c5836f58c26cdb75cb23ebd38ce50a3e662e9aac7edb6a334dd764169d49d0f80ad0db
|
7
|
+
data.tar.gz: fd52b4f6b2d24111cf62d015a833d9eded491b5dd926fa72c114eaf7a2c83598865803e7ddaa960a164db0fd42115c786f862765c3039071ad2a8852c9bb6aee
|
data/README.md
CHANGED
@@ -6,18 +6,6 @@
|
|
6
6
|
|
7
7
|
Automated Acceptance Testing for Mobile Apps
|
8
8
|
|
9
|
-
## Initial workflow
|
10
|
-
|
11
|
-
**TL;DR**
|
12
|
-
|
13
|
-
```
|
14
|
-
$ cd calabash
|
15
|
-
$ ./copy_repos.sh
|
16
|
-
$ ./changing_old_files.sh
|
17
|
-
```
|
18
|
-
|
19
|
-
Before Calabash is ready to be released, the old gems will exist outside version control. To make a change run the script `copy_repos.sh`. This will copy the Android and iOS repositories and extract them as files in the directory `old`. Then execute `changing_old_files.sh`. This script will move old files into their new directories. To make changes to "old files" e.g. move them, add your steps to `changing_old_files.sh` and execute it. To make code changes to old files, change them locally first to ensure they work. Then copy the change to the branch `united` on either iOS or Android. Commit the changes and push them upstream. `copy_repos.sh` will always download the newest files.
|
20
|
-
|
21
9
|
## Rake
|
22
10
|
|
23
11
|
**TODO** Release instructions for Android and iOS.
|
@@ -27,8 +15,6 @@ $ rake -T
|
|
27
15
|
rake android:build # Build the Android test server
|
28
16
|
rake build # Build calabash-1.9.9.pre2.gem into the pkg directory
|
29
17
|
rake ctags # Generate ctags in ./git/tags
|
30
|
-
rake cucumber:android # Run Android cucumber tests
|
31
|
-
rake cucumber:ios # Run iOS cucumber tests
|
32
18
|
rake install # Build and install calabash-1.9.9.pre2.gem into system gems
|
33
19
|
rake release # Create tag v1.9.9.pre2 and build and push calabash-1.9.9.pre2.gem to Rubygems
|
34
20
|
rake spec # Run RSpec code examples
|
@@ -47,30 +33,21 @@ $ be rake spec # All tests. Launches iOS Simulators, etc.
|
|
47
33
|
$ be guard # Run unit tests as you develop.
|
48
34
|
```
|
49
35
|
|
50
|
-
### Cucumber
|
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.
|
51
40
|
|
52
41
|
```
|
53
|
-
$ cd cucumber/ios
|
54
42
|
$ bundle update
|
55
|
-
$ rake
|
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
|
56
47
|
$ be cucumber
|
57
48
|
```
|
58
49
|
|
59
|
-
|
60
|
-
CalSmoke-cal.app. If it exists, it will do nothing. If it does not exist,
|
61
|
-
it will pull the latest sources from the CalSmoke repo, build the
|
62
|
-
CalSmoke-cal.app from the master branch, and install it in the
|
63
|
-
`cucumber/ios` directory.
|
64
|
-
|
65
|
-
If you want to use a different CalSmoke-cal.app, drop it into `cucumber/ios`
|
66
|
-
or call cucumber with `CAL\_APP` set.
|
67
|
-
|
68
|
-
```
|
69
|
-
$ CAL_APP=/path/to/your/CalSmoke-cal.app be cucumber
|
70
|
-
```
|
71
|
-
|
72
|
-
The rake task `ensure_ipa` does the same thing, but for the CalSmoke-cal.ipa.
|
50
|
+
### Cucumber iOS
|
73
51
|
|
74
|
-
|
75
|
-
installed in /usr/local/bin/ideviceinstaller.
|
52
|
+
See `cucumber/ios/README.md`.
|
76
53
|
|
data/bin/calabash
CHANGED
@@ -47,49 +47,58 @@ module Calabash
|
|
47
47
|
def parse_arguments!
|
48
48
|
argument = @arguments.shift
|
49
49
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
platform
|
50
|
+
begin
|
51
|
+
case argument
|
52
|
+
when '-v', '--verbose'
|
53
|
+
@options[:verbose] = true
|
54
|
+
Logger.log_levels += [:debug]
|
55
|
+
parse_arguments!
|
56
|
+
when '--platform'
|
57
|
+
platform = @arguments.shift.downcase
|
57
58
|
|
58
|
-
|
59
|
+
fail("Invalid specified platform '#{platform}'") unless platform == 'android' || platform == 'ios'
|
59
60
|
|
60
|
-
|
61
|
+
set_platform!(platform.to_sym)
|
61
62
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
63
|
+
parse_arguments!
|
64
|
+
when 'version'
|
65
|
+
puts Calabash::VERSION
|
66
|
+
when 'build'
|
67
|
+
parse_build_arguments!
|
68
|
+
when 'resign'
|
69
|
+
parse_resign_arguments!
|
70
|
+
when 'console'
|
71
|
+
parse_console_arguments!
|
72
|
+
when 'generate'
|
73
|
+
parse_generate_arguments!
|
74
|
+
when 'run'
|
75
|
+
parse_run_arguments!
|
76
|
+
when 'setup-keystore'
|
77
|
+
parse_setup_keystore_arguments!
|
78
|
+
when 'help'
|
79
|
+
argument = @arguments.shift
|
79
80
|
|
80
|
-
|
81
|
-
|
82
|
-
else
|
83
|
-
if key_for_command(argument)
|
84
|
-
print_usage_for(key_for_command(argument))
|
81
|
+
if argument.nil?
|
82
|
+
print_usage
|
85
83
|
else
|
86
|
-
|
84
|
+
if key_for_command(argument)
|
85
|
+
print_usage_for(key_for_command(argument))
|
86
|
+
else
|
87
|
+
fail("No such command '#{argument}'")
|
88
|
+
end
|
87
89
|
end
|
88
|
-
|
89
|
-
|
90
|
-
|
90
|
+
when nil
|
91
|
+
print_usage
|
92
|
+
else
|
93
|
+
fail("Invalid command #{argument}.\n For help use 'calabash help'")
|
94
|
+
end
|
95
|
+
rescue => e
|
96
|
+
if Logger.log_levels.include?(:debug)
|
97
|
+
raise e
|
91
98
|
else
|
92
|
-
|
99
|
+
puts "#{Color.red(e.message)}"
|
100
|
+
exit 1
|
101
|
+
end
|
93
102
|
end
|
94
103
|
end
|
95
104
|
end
|
data/lib/calabash.rb
CHANGED
@@ -25,6 +25,7 @@ module Calabash
|
|
25
25
|
require 'calabash/text'
|
26
26
|
require 'calabash/interactions'
|
27
27
|
require 'calabash/defaults'
|
28
|
+
require 'calabash/legacy'
|
28
29
|
require 'calabash/console_helpers'
|
29
30
|
|
30
31
|
|
@@ -45,22 +46,58 @@ module Calabash
|
|
45
46
|
|
46
47
|
require 'calabash/page'
|
47
48
|
|
48
|
-
# Instantiate a page object.
|
49
|
+
# Instantiate a page object for the current platform.
|
50
|
+
#
|
51
|
+
# @note Your pages **must** be in the scope of either Android or IOS. See the
|
52
|
+
# examples for details.
|
49
53
|
#
|
50
54
|
# @example
|
51
|
-
# # android/pages/
|
52
|
-
# class Android::
|
55
|
+
# # android/pages/my_page.rb
|
56
|
+
# class Android::MyPage < Calabash::Page
|
53
57
|
# include Calabash::Android
|
54
58
|
#
|
55
|
-
# [...]
|
59
|
+
# # [...]
|
56
60
|
# end
|
57
61
|
#
|
58
62
|
# # step definition
|
59
|
-
# Given([...]) do
|
63
|
+
# Given(/[...]/) do
|
60
64
|
# # Calabash will determine your platform and pick the Android page.
|
61
|
-
# page(
|
65
|
+
# page(MyPage).method
|
66
|
+
# end
|
67
|
+
#
|
68
|
+
# @example
|
69
|
+
# # This example shows page code sharing across iOS and Android
|
70
|
+
# # Please see the sample 'shared-page-logic' for details.
|
71
|
+
# # pages/abstract_login_page.rb
|
72
|
+
# class AbstractLoginPage < Calabash::Page
|
73
|
+
# def login(username, password)
|
74
|
+
# enter_text_in(username_field, username)
|
75
|
+
# # [...]
|
76
|
+
# end
|
77
|
+
#
|
78
|
+
# private
|
79
|
+
#
|
80
|
+
# def username_field
|
81
|
+
# abstract_method!
|
82
|
+
# end
|
83
|
+
# end
|
84
|
+
#
|
85
|
+
# # pages/android_login_page.rb
|
86
|
+
# class Android::LoginPage < SharedLoginPage
|
87
|
+
# include Calabash::Android
|
88
|
+
#
|
89
|
+
# private
|
90
|
+
#
|
91
|
+
# def username_field
|
92
|
+
# "* marked:'a_username'"
|
93
|
+
# end
|
94
|
+
#
|
95
|
+
# # [...]
|
62
96
|
# end
|
63
97
|
#
|
98
|
+
#
|
99
|
+
# @see #android?
|
100
|
+
# @see #ios?
|
64
101
|
# @param [Class] page_class The page to instantiate
|
65
102
|
# @return [Calabash::Page] An instance of the page class
|
66
103
|
def page(page_class)
|
@@ -76,12 +113,24 @@ module Calabash
|
|
76
113
|
raise ArgumentError, "Expected a 'Class', got '#{page_class.class}'"
|
77
114
|
end
|
78
115
|
|
79
|
-
page_name = page_class.name
|
116
|
+
page_name = page_class.name
|
117
|
+
full_page_name = "#{platform_module}::#{page_name}"
|
80
118
|
|
81
|
-
if
|
119
|
+
if Calabash.is_defined?(full_page_name)
|
82
120
|
page_class = platform_module.const_get(page_name, false)
|
83
121
|
|
84
122
|
if page_class.is_a?(Class)
|
123
|
+
modules = page_class.included_modules.map(&:to_s)
|
124
|
+
|
125
|
+
unless modules.include?("Calabash::#{platform_module}")
|
126
|
+
raise "Page '#{page_class}' does not include Calabash::#{platform_module}"
|
127
|
+
end
|
128
|
+
|
129
|
+
if modules.include?('Calabash::Android') &&
|
130
|
+
modules.include?('Calabash::IOS')
|
131
|
+
raise "Page '#{page_class}' includes both Calabash::Android and Calabash::IOS"
|
132
|
+
end
|
133
|
+
|
85
134
|
page = page_class.send(:new, self)
|
86
135
|
|
87
136
|
if page.is_a?(Calabash::Page)
|
@@ -93,18 +142,26 @@ module Calabash
|
|
93
142
|
raise "Page '#{page_class}' is not a class"
|
94
143
|
end
|
95
144
|
else
|
96
|
-
raise "No such page defined '#{
|
145
|
+
raise "No such page defined '#{full_page_name}'"
|
97
146
|
end
|
98
147
|
end
|
99
148
|
|
100
|
-
# Is the
|
149
|
+
# Is the device under test running Android?
|
150
|
+
#
|
151
|
+
# @return [Boolean] Returns true if
|
152
|
+
# {Calabash::Defaults#default_device Calabash.default_device} is an instance
|
153
|
+
# of {Calabash::Android::Device}.
|
101
154
|
def android?
|
102
|
-
Android.const_defined?(:Device) && Device.default.is_a?(Android::Device)
|
155
|
+
Android.const_defined?(:Device, false) && Device.default.is_a?(Android::Device)
|
103
156
|
end
|
104
157
|
|
105
|
-
# Is the
|
158
|
+
# Is the device under test running iOS?
|
159
|
+
#
|
160
|
+
# @return [Boolean] Returns true if
|
161
|
+
# {Calabash::Defaults#default_device Calabash.default_device} is an instance
|
162
|
+
# of {Calabash::IOS::Device}.
|
106
163
|
def ios?
|
107
|
-
IOS.const_defined?(:Device) && Device.default.is_a?(IOS::Device)
|
164
|
+
IOS.const_defined?(:Device, false) && Device.default.is_a?(IOS::Device)
|
108
165
|
end
|
109
166
|
|
110
167
|
# @!visibility private
|
@@ -159,6 +216,29 @@ module Calabash
|
|
159
216
|
end
|
160
217
|
end
|
161
218
|
|
219
|
+
# @!visibility private
|
220
|
+
def self.is_defined?(string, scope = Object)
|
221
|
+
constant, rest = string.split('::', 2)
|
222
|
+
|
223
|
+
begin
|
224
|
+
scope.const_defined?(constant.to_sym, false) &&
|
225
|
+
(!rest || is_defined?(rest, scope.const_get(constant, false)))
|
226
|
+
rescue NameError => _
|
227
|
+
false
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
# @!visibility private
|
232
|
+
def self.recursive_const_get(string, scope = Object)
|
233
|
+
constant, rest = string.split('::', 2)
|
234
|
+
|
235
|
+
if rest
|
236
|
+
recursive_const_get(rest, scope.const_get(constant.to_sym, false))
|
237
|
+
else
|
238
|
+
scope.const_get(constant.to_sym, false)
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
162
242
|
# @!visibility private
|
163
243
|
def self.on_cucumber_context(base)
|
164
244
|
on_new_context(base)
|
@@ -172,6 +252,7 @@ module Calabash
|
|
172
252
|
@@has_set_embedding_context
|
173
253
|
end
|
174
254
|
|
255
|
+
# @!visibility private
|
175
256
|
def self.new_embed_method(method)
|
176
257
|
define_method(:embed) do |*args|
|
177
258
|
method.call(*args)
|
@@ -180,6 +261,7 @@ module Calabash
|
|
180
261
|
@@has_set_embedding_context = true
|
181
262
|
end
|
182
263
|
|
264
|
+
# @!visibility private
|
183
265
|
def embed(*_)
|
184
266
|
Logger.warn 'Embed is not available in this context. Will not embed.'
|
185
267
|
end
|
@@ -193,3 +275,45 @@ end
|
|
193
275
|
unless Object.const_defined?(:IOS)
|
194
276
|
Object.const_set(:IOS, Module.new)
|
195
277
|
end
|
278
|
+
|
279
|
+
if Calabash::Environment::DEBUG_CALLED_METHODS
|
280
|
+
$stdout.puts "#{Calabash::Color.red('Will print every Calabash method called!')}"
|
281
|
+
$stdout.puts "#{Calabash::Color.red('Warning: This might slow down your test drastically')}"
|
282
|
+
$stdout.puts "#{Calabash::Color.red('and is an experimental feature.')}"
|
283
|
+
|
284
|
+
calabash_file = Calabash.method(:extended).source_location.first
|
285
|
+
$__calabash_dir_name = File.dirname(calabash_file)
|
286
|
+
|
287
|
+
trace_func = lambda do |event, file, line, id, binding, classname|
|
288
|
+
if event == 'call'
|
289
|
+
if classname.to_s.split('::').first == 'Calabash'
|
290
|
+
binding_caller_locations = binding.eval('caller_locations')
|
291
|
+
files = binding_caller_locations[3..-1].map(&:path)
|
292
|
+
|
293
|
+
calabash_not_in_stacktrace = files.none? do |file|
|
294
|
+
file.start_with?($__calabash_dir_name) &&
|
295
|
+
File.basename(file) != 'page.rb'
|
296
|
+
end
|
297
|
+
|
298
|
+
if calabash_not_in_stacktrace
|
299
|
+
unless id == :included || id == :extended || id == :inherited
|
300
|
+
arguments = {}
|
301
|
+
|
302
|
+
binding.eval('local_variables').each do |variable|
|
303
|
+
arguments[variable] = binding.eval(variable.to_s)
|
304
|
+
end
|
305
|
+
|
306
|
+
# The arguments will be in order
|
307
|
+
if arguments.empty?
|
308
|
+
$stdout.puts "Calabash method called: #{id}"
|
309
|
+
else
|
310
|
+
$stdout.puts "Calabash method called: #{id}(#{arguments.values.map(&:inspect).join(', ')})"
|
311
|
+
end
|
312
|
+
end
|
313
|
+
end
|
314
|
+
end
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
set_trace_func(trace_func)
|
319
|
+
end
|
data/lib/calabash/android.rb
CHANGED
@@ -1,8 +1,11 @@
|
|
1
1
|
module Calabash
|
2
2
|
# Contains the Android implementations of the Calabash APIs.
|
3
3
|
module Android
|
4
|
+
# @!visibility private
|
4
5
|
TEST_SERVER_CODE_PATH = File.join(File.dirname(__FILE__), '..', '..', 'android', 'test-server')
|
6
|
+
# @!visibility private
|
5
7
|
UNSIGNED_TEST_SERVER_APK = File.join(File.dirname(__FILE__), 'android', 'lib', 'TestServer.apk')
|
8
|
+
# @!visibility private
|
6
9
|
ANDROID_MANIFEST_PATH = File.join(File.dirname(__FILE__), 'android', 'lib', 'AndroidManifest.xml')
|
7
10
|
|
8
11
|
require 'calabash'
|
@@ -35,6 +38,8 @@ module Calabash
|
|
35
38
|
require 'calabash/android/text'
|
36
39
|
require 'calabash/android/console_helpers'
|
37
40
|
require 'calabash/android/life_cycle'
|
41
|
+
require 'calabash/android/scroll'
|
42
|
+
require 'calabash/android/legacy'
|
38
43
|
|
39
44
|
include Calabash::Android::Gestures
|
40
45
|
include Calabash::Android::Interactions
|
@@ -42,6 +47,7 @@ module Calabash
|
|
42
47
|
include Calabash::Android::Orientation
|
43
48
|
include Calabash::Android::PhysicalButtons
|
44
49
|
include Calabash::Android::Text
|
50
|
+
include Calabash::Android::Scroll
|
45
51
|
|
46
52
|
# @!visibility private
|
47
53
|
def self.binary_location(name, abi, using_pie)
|
data/lib/calabash/android/adb.rb
CHANGED
@@ -17,8 +17,10 @@ module Calabash
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
# @!visibility private
|
20
21
|
PROCESS_WAIT_TIME = 10
|
21
22
|
|
23
|
+
# @!visibility private
|
22
24
|
def self.open_pipe_with_timeout(timeout, *cmd, &block)
|
23
25
|
begin
|
24
26
|
i, o, e, t, pid = nil
|
@@ -52,6 +54,7 @@ module Calabash
|
|
52
54
|
end
|
53
55
|
end
|
54
56
|
|
57
|
+
# @!visibility private
|
55
58
|
def self.open_adb_pipe(*cmd, **options, &block)
|
56
59
|
timeout = options.fetch(:timeout, PROCESS_WAIT_TIME)
|
57
60
|
|
@@ -60,11 +63,23 @@ module Calabash
|
|
60
63
|
end
|
61
64
|
end
|
62
65
|
|
66
|
+
# @!visibility private
|
63
67
|
DAEMON_STARTED_MESSAGE = "* daemon not running. starting it now on port 5037 *\n* daemon started successfully *\n"
|
64
68
|
|
65
69
|
def self.command(*cmd, **args)
|
66
70
|
Logger.debug("ADB Command: #{cmd.join(', ')}")
|
67
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]}")
|
68
83
|
stderr = nil
|
69
84
|
stdout = nil
|
70
85
|
exit_code = nil
|
@@ -121,10 +136,12 @@ module Calabash
|
|
121
136
|
|
122
137
|
attr_reader :serial
|
123
138
|
|
139
|
+
# @!visibility private
|
124
140
|
def initialize(serial)
|
125
141
|
@serial = serial
|
126
142
|
end
|
127
143
|
|
144
|
+
# @!visibility private
|
128
145
|
def command(*argv, **args)
|
129
146
|
cmd = argv.dup
|
130
147
|
|
@@ -135,9 +152,16 @@ module Calabash
|
|
135
152
|
ADB.command(*cmd, args)
|
136
153
|
end
|
137
154
|
|
155
|
+
# @!visibility private
|
156
|
+
def shell(shell_cmd, options={})
|
157
|
+
command('shell', shell_cmd)
|
158
|
+
end
|
159
|
+
|
160
|
+
# @!visibility private
|
138
161
|
END_STRING = '__CAL_END__'
|
139
162
|
|
140
|
-
|
163
|
+
# @!visibility private
|
164
|
+
def old_shell(shell_cmd, options={})
|
141
165
|
if shell_cmd.nil? || shell_cmd.empty?
|
142
166
|
raise ArgumentError, "Invalid shell command '#{shell_cmd}'"
|
143
167
|
end
|