calabash-android 0.2.19 → 0.2.20

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.
@@ -1,3 +1,6 @@
1
+ 0.2.20:
2
+ Added click_on_view_by_description action
3
+
1
4
  0.2.19:
2
5
  New actions:
3
6
  Drag action
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.2.19"
3
+ VERSION = "0.2.20"
4
4
  end
5
5
  end
@@ -0,0 +1,46 @@
1
+ package sh.calaba.instrumentationbackend.actions.view;
2
+
3
+
4
+ import sh.calaba.instrumentationbackend.InstrumentationBackend;
5
+ import sh.calaba.instrumentationbackend.Result;
6
+ import sh.calaba.instrumentationbackend.TestHelpers;
7
+ import sh.calaba.instrumentationbackend.actions.Action;
8
+ import android.view.View;
9
+
10
+ /*
11
+ * Warning: Unlike most other actions this action will allow you to click on views that are not visible.
12
+ */
13
+ public class ClickOnViewByDescription implements Action {
14
+
15
+ @Override
16
+ public Result execute(String... args) {
17
+ final View view = TestHelpers.getViewByDescription(args[0]);
18
+
19
+ if(view == null) {
20
+ return new Result(false, "Could not find view with description: '" + args[0] + "'");
21
+ }
22
+ try {
23
+ System.out.println("Clicking on view: " + view.getClass());
24
+ InstrumentationBackend.solo.clickOnView(view);
25
+ return Result.successResult();
26
+ } catch(junit.framework.AssertionFailedError e) {
27
+ System.out.println("solo.clickOnView failed - using fallback");
28
+ if (view.isClickable()) {
29
+ InstrumentationBackend.solo.getCurrentActivity().runOnUiThread(new Runnable() {
30
+ public void run() {
31
+ view.performClick();
32
+ }
33
+ });
34
+ }
35
+ }
36
+ return Result.successResult();
37
+ }
38
+
39
+ @Override
40
+ public String key() {
41
+ return "click_on_view_by_description";
42
+ }
43
+
44
+
45
+
46
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: calabash-android
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.19
4
+ version: 0.2.20
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: 2012-09-12 00:00:00.000000000 Z
12
+ date: 2012-09-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -230,6 +230,7 @@ files:
230
230
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetTimeByContentDescription.java
231
231
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetTimeByIndex.java
232
232
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/AssertViewProperty.java
233
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewByDescription.java
233
234
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewById.java
234
235
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/GetActivityName.java
235
236
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/GetViewProperty.java