testautoa 0.4.4 → 0.4.5
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/testautoa +65 -6
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/version.rb +1 -1
- data/testautoa.gemspecx +26 -0
- metadata +3 -2
data/bin/testautoa
CHANGED
@@ -126,7 +126,10 @@ def run(option)
|
|
126
126
|
serial_number = @settings["device_serialno"].to_s.strip
|
127
127
|
STDOUT.sync = true
|
128
128
|
arguments = ARGV
|
129
|
+
|
129
130
|
cmd = "calabash-android #{option} #{app_package} #{arguments.join(" ")}"
|
131
|
+
apk_info = get_apk_info(app_package)
|
132
|
+
|
130
133
|
env = {}
|
131
134
|
if test_server_port != ''
|
132
135
|
env["TEST_SERVER_PORT"] = test_server_port
|
@@ -134,6 +137,20 @@ def run(option)
|
|
134
137
|
if serial_number != ''
|
135
138
|
env["ADB_DEVICE_ARG"] = serial_number
|
136
139
|
end
|
140
|
+
env["DEVICE_ID"] = serial_number
|
141
|
+
env["DEVICE_CLASS"] = ""
|
142
|
+
env["DEVICE_TYPE"] = ""
|
143
|
+
env["DEVICE_SN"] = adb_shell("getprop ro.boot.serialno").strip
|
144
|
+
env["DEVICE_MFG"] = adb_shell("getprop ro.product.manufacturer").strip
|
145
|
+
env["DEVICE_MODEL"] = adb_shell("getprop ro.product.model").strip
|
146
|
+
env["DEVICE_VERSION"] = adb_shell("getprop ro.product.version").strip
|
147
|
+
env["DEVICE_ANDROID_VERSION"] = adb_shell("getprop ro.build.version.release").strip
|
148
|
+
env["DEVICE_ANDROID_SDK"] = adb_shell("getprop ro.build.version.sdk").strip
|
149
|
+
env["APP_NAME"] = "#{apk_info['label']} (#{apk_info['name']})"
|
150
|
+
env["APP_VERSION"] = "#{apk_info['version_name']} (#{apk_info['version_code']})"
|
151
|
+
if File.exists?(File.join(FileUtils.pwd, "build_drop_dir.txt"))
|
152
|
+
env["BUILD_DROP_DIR"] = IO.read(File.join(FileUtils.pwd, "build_drop_dir.txt"))
|
153
|
+
end
|
137
154
|
result = system(env, cmd)
|
138
155
|
sleep(1)
|
139
156
|
result
|
@@ -285,21 +302,44 @@ def get_build
|
|
285
302
|
end
|
286
303
|
end
|
287
304
|
else
|
305
|
+
home_path = ENV['HOME'] || ENV['HOMEPATH']
|
288
306
|
if ARGV.first == 'trunk'
|
289
307
|
# copy the trunk build
|
290
308
|
release_path = File.join(mount_node, @settings["build_drop_trunk_dir"])
|
309
|
+
cache_path = File.join(home_path, "build_drop_cache", @settings["build_drop_trunk_dir"])
|
291
310
|
else
|
292
311
|
# copy the version build
|
293
312
|
release_path = File.join(mount_node, @settings["build_drop_branch_dir"], "Android#{ARGV.first}/Release")
|
313
|
+
cache_path = File.join(home_path, "build_drop_cache", @settings["build_drop_branch_dir"], "Android#{ARGV.first}/Release")
|
294
314
|
end
|
295
315
|
raise "No builds found in #{release_path}" unless File.directory?(release_path)
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
316
|
+
|
317
|
+
build_dirs = Dir.entries(release_path).reject{|d|d.start_with?('.')}.sort_by{|c| File.stat(File.join(release_path,c)).ctime}
|
318
|
+
|
319
|
+
apk_file = @settings["app_package"]
|
320
|
+
|
321
|
+
# directory could be empty
|
322
|
+
build_dir = nil
|
323
|
+
begin
|
324
|
+
raise "No builds found in #{release_path}" if build_dirs.size == 0
|
325
|
+
if File.exists?(File.join(release_path, build_dirs.last, apk_file))
|
326
|
+
build_dir = build_dirs.last
|
327
|
+
else
|
328
|
+
build_dirs.pop
|
329
|
+
end
|
330
|
+
end while build_dir == nil
|
331
|
+
|
332
|
+
source = File.join(cache_path, build_dir, apk_file)
|
333
|
+
if not File.exists?(source)
|
334
|
+
release_source = File.join(release_path, build_dir, apk_file)
|
335
|
+
FileUtils.mkdir_p(File.dirname(source))
|
336
|
+
FileUtils.copy(release_source, source)
|
337
|
+
puts "Copy the build from #{release_source} to #{source}"
|
338
|
+
end
|
300
339
|
raise "the file '#{source}' does not exist" if not File.exists?(source)
|
301
340
|
FileUtils.copy(source, File.join(FileUtils.pwd, apk_file))
|
302
|
-
puts "Copy the build from #{source}"
|
341
|
+
puts "Copy the build from #{source}"
|
342
|
+
File.open(File.join(FileUtils.pwd, "build_drop_dir.txt"), 'w') {|f| f.write(build_dir) }
|
303
343
|
end
|
304
344
|
|
305
345
|
smb_disconnect(mount_node)
|
@@ -326,6 +366,11 @@ def get_script
|
|
326
366
|
end
|
327
367
|
end
|
328
368
|
|
369
|
+
def aapt_path
|
370
|
+
raise_if_android_home_not_set
|
371
|
+
File.join(ENV['ANDROID_HOME'], 'platform-tools', 'aapt')
|
372
|
+
end
|
373
|
+
|
329
374
|
def adb_path
|
330
375
|
raise_if_android_home_not_set
|
331
376
|
File.join(ENV['ANDROID_HOME'], 'platform-tools', 'adb')
|
@@ -339,7 +384,7 @@ def adb_path_w_sn
|
|
339
384
|
end
|
340
385
|
|
341
386
|
def adb_shell(command)
|
342
|
-
|
387
|
+
`#{adb_path_w_sn} shell #{command}`
|
343
388
|
end
|
344
389
|
|
345
390
|
def android_path
|
@@ -373,6 +418,20 @@ def list_avd
|
|
373
418
|
puts `#{android_path} list avd`
|
374
419
|
end
|
375
420
|
|
421
|
+
def get_apk_info(apk_path)
|
422
|
+
apk_info = {}
|
423
|
+
output = `#{aapt_path} d --values badging #{apk_path}`
|
424
|
+
if output =~ /^package: name='(.*)' versionCode='(.*)' versionName='(.*)'$/
|
425
|
+
apk_info['name'] = $1
|
426
|
+
apk_info['version_code'] = $2
|
427
|
+
apk_info['version_name'] = $3
|
428
|
+
end
|
429
|
+
if output =~ /^application-label:'(.*)'$/
|
430
|
+
apk_info['label'] = $1
|
431
|
+
end
|
432
|
+
apk_info
|
433
|
+
end
|
434
|
+
|
376
435
|
def create_avd
|
377
436
|
android_targets = get_target_names.find_all{ |t| t =~ /android-(\d*)/ }
|
378
437
|
google_targets = get_target_names.find_all{ |t| t =~ /Google Inc.:Google APIs:(\d*)/ }
|
Binary file
|
data/testautoa.gemspecx
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "calabash-android/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "testautoa"
|
7
|
+
s.version = Calabash::Android::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["jimtsay"]
|
10
|
+
s.summary = %q{Summary}
|
11
|
+
s.description = %q{Description}
|
12
|
+
s.files = `git ls-files`.split("\n") + Dir["test-server/calabash-js/src/*.js"] + ["lib/calabash-android/lib/TestServer.apk"]
|
13
|
+
s.executables = ["calabash-android","testautoa"]
|
14
|
+
s.default_executable = "calabash-android"
|
15
|
+
s.require_paths = ["lib"]
|
16
|
+
|
17
|
+
s.add_dependency( "cucumber" )
|
18
|
+
s.add_dependency( "json" )
|
19
|
+
s.add_dependency( "retriable" )
|
20
|
+
s.add_dependency( "slowhandcuke" )
|
21
|
+
s.add_dependency( "rubyzip" )
|
22
|
+
s.add_dependency( "awesome_print" )
|
23
|
+
s.add_dependency( "rest-client" )
|
24
|
+
s.add_dependency( "nokogiri" )
|
25
|
+
|
26
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testautoa
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-08-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -864,6 +864,7 @@ files:
|
|
864
864
|
- test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/TokenBuffer.java
|
865
865
|
- test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/VersionUtil.java
|
866
866
|
- test-server/instrumentation-backend/src/sh/calaba/org/codehaus/jackson/util/package-info.java
|
867
|
+
- testautoa.gemspecx
|
867
868
|
- test-server/calabash-js/src/calabash.js
|
868
869
|
- test-server/calabash-js/src/set_text.js
|
869
870
|
- lib/calabash-android/lib/TestServer.apk
|