calabash-android 0.4.19.pre2 → 0.4.19.pre3
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -3
- data/Rakefile +1 -1
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/version.rb +1 -1
- data/test-server/calabash-js/src/calabash.js +4 -7
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/CalabashChromeClient.java +25 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/QueryHelper.java +11 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: defa8cb4b262a40357f1f00a8c76c7155629952f
|
4
|
+
data.tar.gz: 353e205839ac2e5055d5792400437ba6e6c5c945
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 314abb26cf7d23bdd0020b971c6eb7b474397639fab09f67a699860816a36af9e5dc2066b62c3dd2bcb4824690d5cd558d306d118d655479598fb269439cca45
|
7
|
+
data.tar.gz: 8f554170e76f87e4e33a6d160969e8b84dd03c1febd3c91b969fab036d63bb19c1ec6eed1a696693e19454ae02cf053e40ab4e96c318e87e677d5f50e5258991
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
calabash-android (0.4.
|
4
|
+
calabash-android (0.4.19.pre3)
|
5
5
|
awesome_print
|
6
6
|
cucumber
|
7
7
|
escape (~> 0.0.4)
|
@@ -17,7 +17,7 @@ GEM
|
|
17
17
|
specs:
|
18
18
|
awesome_print (1.2.0)
|
19
19
|
builder (3.2.2)
|
20
|
-
cucumber (1.3.
|
20
|
+
cucumber (1.3.10)
|
21
21
|
builder (>= 2.1.2)
|
22
22
|
diff-lcs (>= 1.1.3)
|
23
23
|
gherkin (~> 2.12)
|
@@ -31,7 +31,7 @@ GEM
|
|
31
31
|
json (1.8.1)
|
32
32
|
mime-types (2.0)
|
33
33
|
multi_json (1.8.2)
|
34
|
-
multi_test (0.0.
|
34
|
+
multi_test (0.0.3)
|
35
35
|
rake (10.1.0)
|
36
36
|
rest-client (1.6.7)
|
37
37
|
mime-types (>= 1.16)
|
data/Rakefile
CHANGED
Binary file
|
@@ -10,7 +10,7 @@
|
|
10
10
|
(!!(t==='object' && object[property])) ||
|
11
11
|
t==='unknown';
|
12
12
|
}
|
13
|
-
|
13
|
+
/*http://www.w3.org/TR/DOM-Level-2-Core/core.html*/
|
14
14
|
var NODE_TYPES = {
|
15
15
|
/*ELEMENT_NODE : */ 1 : 'ELEMENT_NODE',
|
16
16
|
/*ATTRIBUTE_NODE : */ 2: 'ATTRIBUTE_NODE',
|
@@ -75,14 +75,14 @@
|
|
75
75
|
|
76
76
|
|
77
77
|
}
|
78
|
-
else if (object instanceof Node)
|
78
|
+
else if (object instanceof Node)
|
79
79
|
{
|
80
80
|
res = computeRectForNode(object);
|
81
81
|
}
|
82
|
-
else if (object instanceof NodeList ||
|
82
|
+
else if (object instanceof NodeList ||
|
83
83
|
(typeof object=='object' && object &&
|
84
84
|
typeof object.length === 'number' &&
|
85
|
-
object.length > 0
|
85
|
+
object.length > 0
|
86
86
|
&& typeof object[0] !== 'undefined'))
|
87
87
|
{
|
88
88
|
res = [];
|
@@ -97,9 +97,6 @@
|
|
97
97
|
}
|
98
98
|
return res;
|
99
99
|
}
|
100
|
-
///TODO: no support for now frames
|
101
|
-
//idea would be map XPath across window.frames
|
102
|
-
//must take care of visibility questions
|
103
100
|
|
104
101
|
var exp = '%@'/* dynamic */,
|
105
102
|
queryType = '%@',
|
@@ -1,5 +1,7 @@
|
|
1
1
|
package sh.calaba.instrumentationbackend.actions.webview;
|
2
2
|
|
3
|
+
import java.io.IOException;
|
4
|
+
import java.lang.RuntimeException;
|
3
5
|
import java.lang.reflect.Field;
|
4
6
|
import java.lang.reflect.Method;
|
5
7
|
import java.util.ArrayList;
|
@@ -13,10 +15,14 @@ import java.util.concurrent.TimeoutException;
|
|
13
15
|
|
14
16
|
import android.os.Looper;
|
15
17
|
import sh.calaba.instrumentationbackend.InstrumentationBackend;
|
18
|
+
import sh.calaba.org.codehaus.jackson.map.ObjectMapper;
|
19
|
+
import sh.calaba.org.codehaus.jackson.type.TypeReference;
|
20
|
+
|
16
21
|
import android.os.Build;
|
17
22
|
import android.os.ConditionVariable;
|
18
23
|
import android.view.View;
|
19
24
|
import android.webkit.JsPromptResult;
|
25
|
+
import android.webkit.ValueCallback;
|
20
26
|
import android.webkit.WebChromeClient;
|
21
27
|
import android.webkit.WebView;
|
22
28
|
|
@@ -144,7 +150,25 @@ public class CalabashChromeClient extends WebChromeClient {
|
|
144
150
|
return scriptFuture;
|
145
151
|
}
|
146
152
|
|
147
|
-
|
153
|
+
public void evaluateCalabashScript(String script) {
|
154
|
+
webView.evaluateJavascript(script, new ValueCallback<String>() {
|
155
|
+
public void onReceiveValue(String rawResponseJSON) {
|
156
|
+
String jsonResponse = null;
|
157
|
+
|
158
|
+
try {
|
159
|
+
jsonResponse = new ObjectMapper().readValue(
|
160
|
+
rawResponseJSON, new TypeReference<String>() {
|
161
|
+
});
|
162
|
+
} catch (IOException e) {
|
163
|
+
throw new RuntimeException("Incorrect JSON format returned from javascript: " + rawResponseJSON, e);
|
164
|
+
}
|
165
|
+
|
166
|
+
scriptFuture.setResult(jsonResponse);
|
167
|
+
}
|
168
|
+
});
|
169
|
+
}
|
170
|
+
|
171
|
+
@SuppressWarnings("rawtypes")
|
148
172
|
public static class WebFuture implements Future {
|
149
173
|
private final ConditionVariable eventHandled;
|
150
174
|
private volatile boolean complete;
|
@@ -12,6 +12,7 @@ import sh.calaba.instrumentationbackend.InstrumentationBackend;
|
|
12
12
|
import sh.calaba.instrumentationbackend.actions.webview.CalabashChromeClient.WebFuture;
|
13
13
|
import sh.calaba.org.codehaus.jackson.map.ObjectMapper;
|
14
14
|
import android.util.Log;
|
15
|
+
import android.webkit.ValueCallback;
|
15
16
|
import android.webkit.WebView;
|
16
17
|
|
17
18
|
public class QueryHelper {
|
@@ -89,17 +90,21 @@ public class QueryHelper {
|
|
89
90
|
}
|
90
91
|
|
91
92
|
public static WebFuture executeAsyncJavascriptInWebviews(WebView webView,
|
92
|
-
|
93
|
+
String scriptPath, String selector, String type) {
|
93
94
|
|
94
95
|
String script = readJavascriptFromAsset(scriptPath);
|
95
96
|
|
96
97
|
script = script.replaceFirst("%@", selector);
|
97
98
|
script = script.replaceFirst("%@", type);
|
98
|
-
|
99
|
-
CalabashChromeClient chromeClient = CalabashChromeClient.prepareWebView(webView);
|
100
|
-
webView.loadUrl("javascript:calabash_result = " + script + ";prompt('calabash:' + calabash_result);");
|
101
|
-
return chromeClient.getResult();
|
102
|
-
}
|
103
99
|
|
100
|
+
CalabashChromeClient chromeClient = CalabashChromeClient.prepareWebView(webView);
|
101
|
+
|
102
|
+
if (android.os.Build.VERSION.SDK_INT < 19) { // Android 4.4
|
103
|
+
webView.loadUrl("javascript:calabash_result = " + script + ";prompt('calabash:' + calabash_result);");
|
104
|
+
} else {
|
105
|
+
chromeClient.evaluateCalabashScript(script);
|
106
|
+
}
|
104
107
|
|
108
|
+
return chromeClient.getResult();
|
109
|
+
}
|
105
110
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: calabash-android
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.19.
|
4
|
+
version: 0.4.19.pre3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonas Maturana Larsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|