calabash-android 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +8 -0
- data/features-skeleton/support/app_installation_hooks.rb +3 -2
- data/lib/calabash-android/operations.rb +10 -11
- data/lib/calabash-android/version.rb +2 -2
- data/test-server/build.xml +1 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java +20 -6
- metadata +4 -4
data/CHANGES.txt
CHANGED
@@ -17,11 +17,12 @@ Before do |scenario|
|
|
17
17
|
end
|
18
18
|
|
19
19
|
at_exit do
|
20
|
-
|
20
|
+
require 'net/http'
|
21
|
+
Net::HTTP.get(URI.parse("http://127.0.0.1:34777/kill"))
|
21
22
|
end
|
22
23
|
|
23
24
|
FeatureNameMemory = Class.new
|
24
25
|
class << FeatureNameMemory
|
25
26
|
@feature_name = nil
|
26
27
|
attr_accessor :feature_name
|
27
|
-
end
|
28
|
+
end
|
@@ -116,17 +116,6 @@ module Operations
|
|
116
116
|
|
117
117
|
puts "#{adb_command} forward tcp:b#{server_port} tcp:7102"
|
118
118
|
log `#{adb_command} forward tcp:#{server_port} tcp:7102`
|
119
|
-
=begin
|
120
|
-
begin
|
121
|
-
Timeout::timeout(15) do
|
122
|
-
puts http("/ping")
|
123
|
-
end
|
124
|
-
rescue Timeout::Error
|
125
|
-
msg = "Unable to make connection to Calabash Test Server at http://127.0.0.1:#{@server_port}/\n"
|
126
|
-
msg << "Please check the logcat output for more info about what happened\n"
|
127
|
-
raise msg
|
128
|
-
end
|
129
|
-
=end
|
130
119
|
end
|
131
120
|
|
132
121
|
def reinstall_apps()
|
@@ -245,6 +234,16 @@ module Operations
|
|
245
234
|
else
|
246
235
|
`#{cmd} 1>&2 &`
|
247
236
|
end
|
237
|
+
|
238
|
+
begin
|
239
|
+
Timeout::timeout(15) do
|
240
|
+
puts http("/ping")
|
241
|
+
end
|
242
|
+
rescue Timeout::Error
|
243
|
+
msg = "Unable to make connection to Calabash Test Server at http://127.0.0.1:#{@server_port}/\n"
|
244
|
+
msg << "Please check the logcat output for more info about what happened\n"
|
245
|
+
raise msg
|
246
|
+
end
|
248
247
|
end
|
249
248
|
|
250
249
|
def log(message)
|
data/test-server/build.xml
CHANGED
@@ -1,9 +1,14 @@
|
|
1
1
|
package sh.calaba.instrumentationbackend.actions;
|
2
2
|
|
3
|
+
import java.io.ByteArrayInputStream;
|
4
|
+
import java.io.ByteArrayOutputStream;
|
3
5
|
import java.io.File;
|
4
6
|
import java.util.Properties;
|
5
7
|
|
8
|
+
import android.graphics.Bitmap;
|
9
|
+
import android.view.View;
|
6
10
|
import sh.calaba.instrumentationbackend.Command;
|
11
|
+
import sh.calaba.instrumentationbackend.InstrumentationBackend;
|
7
12
|
import sh.calaba.instrumentationbackend.Result;
|
8
13
|
import sh.calaba.org.codehaus.jackson.map.DeserializationConfig.Feature;
|
9
14
|
import sh.calaba.org.codehaus.jackson.map.ObjectMapper;
|
@@ -13,25 +18,34 @@ public class HttpServer extends NanoHTTPD {
|
|
13
18
|
private static final String TAG = "IntrumentationBackend";
|
14
19
|
private boolean running = true;
|
15
20
|
|
16
|
-
private ObjectMapper mapper;
|
21
|
+
private final ObjectMapper mapper = createJsonMapper();
|
17
22
|
|
18
23
|
public HttpServer() {
|
19
24
|
super(7102, new File("/"));
|
20
|
-
|
21
|
-
mapper = createJsonMapper();
|
22
25
|
}
|
23
26
|
|
24
27
|
public Response serve( String uri, String method, Properties header, Properties params, Properties files )
|
25
28
|
{
|
26
29
|
System.out.println("URI: " + uri);
|
27
|
-
if ("/ping"
|
30
|
+
if (uri.endsWith("/ping")) {
|
28
31
|
return new NanoHTTPD.Response( HTTP_OK, MIME_HTML, "pong");
|
29
|
-
} else if ("/kill"
|
32
|
+
} else if (uri.endsWith("/kill")) {
|
30
33
|
running = false;
|
31
34
|
System.out.println("Stopping test server");
|
32
35
|
stop();
|
33
36
|
return new NanoHTTPD.Response( HTTP_OK, MIME_HTML, "Affirmative!");
|
34
|
-
|
37
|
+
|
38
|
+
} else if (uri.endsWith("/screenshot")) {
|
39
|
+
Bitmap bitmap;
|
40
|
+
View v1 = InstrumentationBackend.solo.getViews().get(0).getRootView();
|
41
|
+
v1.setDrawingCacheEnabled(true);
|
42
|
+
bitmap = Bitmap.createBitmap(v1.getDrawingCache());
|
43
|
+
v1.setDrawingCacheEnabled(false);
|
44
|
+
|
45
|
+
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
46
|
+
bitmap.compress(Bitmap.CompressFormat.PNG, 90, out);
|
47
|
+
return new NanoHTTPD.Response( HTTP_OK, "image/png", new ByteArrayInputStream(out.toByteArray()));
|
48
|
+
}
|
35
49
|
|
36
50
|
String commandString = params.getProperty("command");
|
37
51
|
System.out.println("command: "+ commandString);
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-android
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 7
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 8
|
10
|
+
version: 0.2.8
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonas Maturana Larsen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-08-
|
18
|
+
date: 2012-08-09 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|