calabash-android 0.4.2 → 0.4.3.pre1
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.
- data/bin/calabash-android-build.rb +4 -0
- data/bin/calabash-android-console.rb +0 -4
- data/bin/calabash-android-run.rb +1 -2
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/operations.rb +10 -5
- data/lib/calabash-android/version.rb +1 -1
- data/test-server/AndroidManifest.xml +1 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java +1 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java +4 -10
- metadata +5 -5
@@ -22,6 +22,10 @@ def calabash_build(app)
|
|
22
22
|
raise "Could not replace package name in manifest"
|
23
23
|
end
|
24
24
|
|
25
|
+
unless system %Q{"#{RbConfig.ruby}" -pi.bak -e "gsub(/#testPackage#/, '#{package_name(app)}.test')" AndroidManifest.xml}
|
26
|
+
raise "Could not replace test package name in manifest"
|
27
|
+
end
|
28
|
+
|
25
29
|
unless system %Q{"#{ENV["ANDROID_HOME"]}/platform-tools/aapt" package -M AndroidManifest.xml -I "#{android_platform}/android.jar" -F dummy.apk}
|
26
30
|
raise "Could not create dummy.apk"
|
27
31
|
end
|
@@ -7,10 +7,6 @@ def calabash_console(app_path = nil)
|
|
7
7
|
|
8
8
|
ENV["IRBRC"] = File.join(File.dirname(__FILE__), '..', 'irbrc')
|
9
9
|
|
10
|
-
unless ENV["PACKAGE_NAME"]
|
11
|
-
ENV["PACKAGE_NAME"] = package_name(app_path)
|
12
|
-
end
|
13
|
-
|
14
10
|
unless ENV["MAIN_ACTIVITY"]
|
15
11
|
ENV["MAIN_ACTIVITY"] = main_activity(app_path)
|
16
12
|
end
|
data/bin/calabash-android-run.rb
CHANGED
@@ -21,8 +21,7 @@ def calabash_run(app_path = nil)
|
|
21
21
|
else
|
22
22
|
test_server_port = "34777"
|
23
23
|
end
|
24
|
-
env = "
|
25
|
-
"MAIN_ACTIVITY=#{main_activity(app_path)} "\
|
24
|
+
env = "MAIN_ACTIVITY=#{main_activity(app_path)} "\
|
26
25
|
"APP_PATH=\"#{app_path}\" "\
|
27
26
|
"TEST_APP_PATH=\"#{test_server_path}\" "\
|
28
27
|
"TEST_SERVER_PORT=#{test_server_port}"
|
Binary file
|
@@ -59,8 +59,8 @@ module Operations
|
|
59
59
|
end
|
60
60
|
|
61
61
|
def uninstall_apps
|
62
|
-
default_device.uninstall_app(
|
63
|
-
default_device.uninstall_app(
|
62
|
+
default_device.uninstall_app(package_name(default_device.test_server_path))
|
63
|
+
default_device.uninstall_app(package_name(default_device.app_path))
|
64
64
|
end
|
65
65
|
|
66
66
|
def wake_up
|
@@ -148,15 +148,18 @@ module Operations
|
|
148
148
|
end
|
149
149
|
|
150
150
|
class Device
|
151
|
+
attr_reader :app_path, :test_server_path, :serial, :server_port, :test_server_port
|
152
|
+
|
153
|
+
def initialize(cucumber_world, serial, server_port, app_path, test_server_path, test_server_port = 7102)
|
151
154
|
|
152
|
-
def initialize(cucumber_world, serial, server_port, app_path, test_server_path)
|
153
155
|
@cucumber_world = cucumber_world
|
154
156
|
@serial = serial
|
155
157
|
@server_port = server_port
|
156
158
|
@app_path = app_path
|
157
159
|
@test_server_path = test_server_path
|
160
|
+
@test_server_port = test_server_port
|
158
161
|
|
159
|
-
forward_cmd = "#{adb_command} forward tcp:#{server_port} tcp
|
162
|
+
forward_cmd = "#{adb_command} forward tcp:#{@server_port} tcp:#{@test_server_port}"
|
160
163
|
log forward_cmd
|
161
164
|
log `#{forward_cmd}`
|
162
165
|
end
|
@@ -316,8 +319,10 @@ module Operations
|
|
316
319
|
wake_up
|
317
320
|
end
|
318
321
|
|
322
|
+
puts "app_path: #{@app_path}"
|
319
323
|
env_options = {:target_package => options[:target_package] || package_name(@app_path),
|
320
324
|
:main_activity => options[:main_activity] || main_activity(@app_path),
|
325
|
+
:test_server_port => @test_server_port,
|
321
326
|
:debug => options[:debug] || false,
|
322
327
|
:class => options[:class] || "sh.calaba.instrumentationbackend.InstrumentationBackend"}
|
323
328
|
|
@@ -329,7 +334,7 @@ module Operations
|
|
329
334
|
cmd_arr << val.to_s
|
330
335
|
end
|
331
336
|
|
332
|
-
cmd_arr << "
|
337
|
+
cmd_arr << "#{package_name(@test_server_path)}/sh.calaba.instrumentationbackend.CalabashInstrumentationTestRunner"
|
333
338
|
|
334
339
|
cmd = cmd_arr.join(" ")
|
335
340
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<?xml version="1.0" encoding="utf-8"?>
|
2
2
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
3
|
-
package="
|
3
|
+
package="#testPackage#"
|
4
4
|
android:versionCode="3"
|
5
5
|
android:versionName="0.3.0">
|
6
6
|
<application android:label="instrumentation_backend">
|
@@ -21,7 +21,7 @@ public class CalabashInstrumentationTestRunner extends InstrumentationTestRunner
|
|
21
21
|
}
|
22
22
|
|
23
23
|
// Start the HttpServer as soon as possible in a not-ready state
|
24
|
-
HttpServer.instantiate();
|
24
|
+
HttpServer.instantiate(Integer.parseInt(arguments.getString("test_server_port")));
|
25
25
|
|
26
26
|
InstrumentationBackend.testPackage = arguments.getString("target_package");
|
27
27
|
|
@@ -42,20 +42,14 @@ public class HttpServer extends NanoHTTPD {
|
|
42
42
|
*
|
43
43
|
* Can only be called once. Otherwise, you'll get an IllegalStateException.
|
44
44
|
*/
|
45
|
-
public synchronized static HttpServer instantiate() {
|
45
|
+
public synchronized static HttpServer instantiate(int testServerPort) {
|
46
46
|
if (instance != null) {
|
47
47
|
throw new IllegalStateException("Can only instantiate once!");
|
48
48
|
}
|
49
|
-
instance = new HttpServer();
|
49
|
+
instance = new HttpServer(testServerPort);
|
50
50
|
return instance;
|
51
51
|
}
|
52
52
|
|
53
|
-
/**
|
54
|
-
* Returns the singleton instance for HttpServer.
|
55
|
-
*
|
56
|
-
* If {@link #instantiate()} hasn't already been called, an
|
57
|
-
* IllegalStateException is thrown.
|
58
|
-
*/
|
59
53
|
public synchronized static HttpServer getInstance() {
|
60
54
|
if (instance == null) {
|
61
55
|
throw new IllegalStateException("Must be initialized!");
|
@@ -63,8 +57,8 @@ public class HttpServer extends NanoHTTPD {
|
|
63
57
|
return instance;
|
64
58
|
}
|
65
59
|
|
66
|
-
private HttpServer() {
|
67
|
-
super(
|
60
|
+
private HttpServer(int testServerPort) {
|
61
|
+
super(testServerPort, new File("/"));
|
68
62
|
}
|
69
63
|
|
70
64
|
@SuppressWarnings("rawtypes")
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-android
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
5
|
-
prerelease:
|
4
|
+
version: 0.4.3.pre1
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Jonas Maturana Larsen
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-02-
|
12
|
+
date: 2013-02-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: cucumber
|
@@ -844,9 +844,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
844
844
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
845
845
|
none: false
|
846
846
|
requirements:
|
847
|
-
- - ! '
|
847
|
+
- - ! '>'
|
848
848
|
- !ruby/object:Gem::Version
|
849
|
-
version:
|
849
|
+
version: 1.3.1
|
850
850
|
requirements: []
|
851
851
|
rubyforge_project:
|
852
852
|
rubygems_version: 1.8.23
|