calabash-android 0.2.10 → 0.2.11
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/CHANGES.txt +5 -0
- data/lib/calabash-android/version.rb +2 -2
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java +8 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/HttpServer.java +1 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/IsEnabled.java +30 -0
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/ExecuteJavascript.java +15 -3
- metadata +5 -4
data/CHANGES.txt
CHANGED
@@ -64,6 +64,14 @@ public class Result {
|
|
64
64
|
public static Result successResult() {
|
65
65
|
return successResult;
|
66
66
|
}
|
67
|
+
|
68
|
+
public static Result failedResult() {
|
69
|
+
return new Result(false);
|
70
|
+
}
|
71
|
+
|
72
|
+
public static Result failedResult(final String message) {
|
73
|
+
return new Result(false, message);
|
74
|
+
}
|
67
75
|
|
68
76
|
public String toString() {
|
69
77
|
return "Success: " + success + ", message: " + message;
|
@@ -0,0 +1,30 @@
|
|
1
|
+
package sh.calaba.instrumentationbackend.actions.view;
|
2
|
+
|
3
|
+
import sh.calaba.instrumentationbackend.Result;
|
4
|
+
import sh.calaba.instrumentationbackend.TestHelpers;
|
5
|
+
import sh.calaba.instrumentationbackend.actions.Action;
|
6
|
+
import android.view.View;
|
7
|
+
|
8
|
+
public class IsEnabled implements Action {
|
9
|
+
|
10
|
+
@Override
|
11
|
+
public Result execute(String... args) {
|
12
|
+
final String firstArgument = args[0];
|
13
|
+
final View foundView = TestHelpers.getViewById(firstArgument);
|
14
|
+
|
15
|
+
if( null == foundView ) {
|
16
|
+
return notFoundResult(firstArgument);
|
17
|
+
}
|
18
|
+
|
19
|
+
return new Result(foundView.isEnabled());
|
20
|
+
}
|
21
|
+
|
22
|
+
@Override
|
23
|
+
public String key() {
|
24
|
+
return "is_enabled";
|
25
|
+
}
|
26
|
+
|
27
|
+
private Result notFoundResult(final String firstArgument) {
|
28
|
+
return Result.failedResult(String.format("View with id %s was not found", firstArgument));
|
29
|
+
}
|
30
|
+
}
|
@@ -13,9 +13,16 @@ public class ExecuteJavascript implements Action {
|
|
13
13
|
CalabashChromeClient ccc = CalabashChromeClient.findAndPrepareWebViews().get(0);
|
14
14
|
final WebView webView = ccc.getWebView();
|
15
15
|
final String script = "javascript:(function() {"
|
16
|
-
+ "var
|
16
|
+
+ " var r;"
|
17
|
+
+ " try {"
|
18
|
+
+ " r = (function() {"
|
17
19
|
+ args[0] + ";"
|
18
|
-
+ "
|
20
|
+
+ " }());"
|
21
|
+
+ " } catch (e) {"
|
22
|
+
+ " r = 'Exception: ' + e;"
|
23
|
+
+ " }"
|
24
|
+
+ " prompt('calabash:'+r);"
|
25
|
+
+ "}())";
|
19
26
|
|
20
27
|
System.out.println("execute javascript: " + script);
|
21
28
|
|
@@ -30,7 +37,12 @@ public class ExecuteJavascript implements Action {
|
|
30
37
|
String r = ccc.getResult();
|
31
38
|
System.out.println("javascript result: " + r);
|
32
39
|
|
33
|
-
|
40
|
+
boolean success = true;
|
41
|
+
if (r.startsWith("Exception:")) {
|
42
|
+
success = false;
|
43
|
+
}
|
44
|
+
|
45
|
+
return new Result(success, r);
|
34
46
|
}
|
35
47
|
|
36
48
|
@Override
|
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: 1
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 11
|
10
|
+
version: 0.2.11
|
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-14 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetTimeByContentDescription.java
|
198
198
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetTimeByIndex.java
|
199
199
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewById.java
|
200
|
+
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/IsEnabled.java
|
200
201
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/LongPressOnViewById.java
|
201
202
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/Press.java
|
202
203
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/WaitForView.java
|