calabash-android 0.4.19.pre3 → 0.4.19.pre4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: defa8cb4b262a40357f1f00a8c76c7155629952f
4
- data.tar.gz: 353e205839ac2e5055d5792400437ba6e6c5c945
3
+ metadata.gz: 892daba236fc763e62fe4a2f916fa069c89160b8
4
+ data.tar.gz: dcf99876dcbe495a13add995e5691d229f49202a
5
5
  SHA512:
6
- metadata.gz: 314abb26cf7d23bdd0020b971c6eb7b474397639fab09f67a699860816a36af9e5dc2066b62c3dd2bcb4824690d5cd558d306d118d655479598fb269439cca45
7
- data.tar.gz: 8f554170e76f87e4e33a6d160969e8b84dd03c1febd3c91b969fab036d63bb19c1ec6eed1a696693e19454ae02cf053e40ab4e96c318e87e677d5f50e5258991
6
+ metadata.gz: af842f99bd51c0aa241fc6e52509525083e43a7cccea261abf0b24de1412382ce02e94a06319d8492b92f0ea4c38b912f7cf3bd9afffde8e0f072f47c26b8d80
7
+ data.tar.gz: 10ee7275d1c1b0363fbd1064e41c3f676717a559b2363fac33add5f409da3a5a9b79ae8bcdf58aa5dff0956c10b2929e285b5e364101c5580626c0ab9acebbc8
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- calabash-android (0.4.19.pre3)
4
+ calabash-android (0.4.19.pre4)
5
5
  awesome_print
6
6
  cucumber
7
7
  escape (~> 0.0.4)
@@ -40,7 +40,7 @@ GEM
40
40
  slowhandcuke (0.0.3)
41
41
  cucumber
42
42
  thor (0.18.1)
43
- xamarin-test-cloud (0.9.26)
43
+ xamarin-test-cloud (0.9.27)
44
44
  bundler (>= 1.3.0, < 2.0)
45
45
  json
46
46
  rest-client (~> 1.6.7)
@@ -701,11 +701,29 @@ module Operations
701
701
  raise(msg)
702
702
  end
703
703
 
704
- def touch(uiquery,*args)
705
- raise "Cannot touch nil" unless uiquery
704
+ def double_tap(uiquery, options = {})
705
+ center_x, center_y = find_coordinate(uiquery)
706
+
707
+ performAction("double_tap_coordinate", center_x, center_y)
708
+ end
709
+
710
+ def long_press(uiquery, options = {})
711
+ center_x, center_y = find_coordinate(uiquery)
712
+
713
+ performAction("long_press_coordinate", center_x, center_y)
714
+ end
715
+
716
+ def touch(uiquery, options = {})
717
+ center_x, center_y = find_coordinate(uiquery)
718
+
719
+ performAction("touch_coordinate", center_x, center_y)
720
+ end
721
+
722
+ def find_coordinate(uiquery)
723
+ raise "Cannot find nil" unless uiquery
706
724
 
707
725
  if uiquery.instance_of? String
708
- elements = query(uiquery, *args)
726
+ elements = query(uiquery)
709
727
  raise "No elements found. Query: #{uiquery}" if elements.empty?
710
728
  element = elements.first
711
729
  else
@@ -713,10 +731,10 @@ module Operations
713
731
  element = element.first if element.instance_of?(Array)
714
732
  end
715
733
 
716
-
717
734
  center_x = element["rect"]["center_x"]
718
735
  center_y = element["rect"]["center_y"]
719
- performAction("touch_coordinate", center_x, center_y)
736
+
737
+ [center_x, center_y]
720
738
  end
721
739
 
722
740
  def http(path, data = {}, options = {})
@@ -728,12 +746,13 @@ module Operations
728
746
  end
729
747
 
730
748
  def set_text(uiquery, txt)
731
- raise "Currently queries are only supported for webviews" unless uiquery.start_with? "webView"
732
- uiquery.slice!(0, "webView".length)
733
- if uiquery =~ /(css|xpath):\s*(.*)/
749
+ view,arguments = uiquery.split(" ",2)
750
+ raise "Currently queries are only supported for webviews" unless view.downcase == "webview"
751
+
752
+ if arguments =~ /(css|xpath):\s*(.*)/
734
753
  r = performAction("set_text", $1, $2, txt)
735
754
  else
736
- raise "Invalid query #{uiquery}"
755
+ raise "Invalid query #{arguments}"
737
756
  end
738
757
  end
739
758
 
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.4.19.pre3"
3
+ VERSION = "0.4.19.pre4"
4
4
  end
5
5
  end
@@ -4,6 +4,7 @@ import java.util.List;
4
4
 
5
5
  import android.app.Activity;
6
6
  import android.app.Instrumentation;
7
+ import android.graphics.PointF;
7
8
 
8
9
  public class SoloEnhanced extends Solo {
9
10
  private MapViewUtils mapViewUtils;
@@ -72,4 +73,9 @@ public class SoloEnhanced extends Solo {
72
73
  public List<String> getMapBounds() {
73
74
  return mapViewUtils.getBounds();
74
75
  }
76
+
77
+ public void doubleTapOnScreen(float x, float y) {
78
+ clicker.clickOnScreen(x,y);
79
+ clicker.clickOnScreen(x,y);
80
+ }
75
81
  }
@@ -0,0 +1,25 @@
1
+ package sh.calaba.instrumentationbackend.actions.gestures;
2
+
3
+ import android.view.Display;
4
+ import sh.calaba.instrumentationbackend.InstrumentationBackend;
5
+ import sh.calaba.instrumentationbackend.Result;
6
+ import sh.calaba.instrumentationbackend.actions.Action;
7
+
8
+ public class DoubleTapCoordinate implements Action {
9
+ @Override
10
+ public Result execute(String... args) {
11
+ Display display = InstrumentationBackend.solo.getCurrentActivity().getWindowManager().getDefaultDisplay();
12
+
13
+ float x = Float.parseFloat(args[0]);
14
+ float y = Float.parseFloat(args[1]);
15
+
16
+ InstrumentationBackend.solo.doubleTapOnScreen(x, y);
17
+
18
+ return Result.successResult();
19
+ }
20
+
21
+ @Override
22
+ public String key() {
23
+ return "double_tap_coordinate";
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ package sh.calaba.instrumentationbackend.actions.gestures;
2
+
3
+ import android.view.Display;
4
+ import sh.calaba.instrumentationbackend.InstrumentationBackend;
5
+ import sh.calaba.instrumentationbackend.Result;
6
+ import sh.calaba.instrumentationbackend.actions.Action;
7
+
8
+ public class LongPressCoordinate implements Action {
9
+ @Override
10
+ public Result execute(String... args) {
11
+ Display display = InstrumentationBackend.solo.getCurrentActivity().getWindowManager().getDefaultDisplay();
12
+
13
+ float x = Float.parseFloat(args[0]);
14
+ float y = Float.parseFloat(args[1]);
15
+
16
+ InstrumentationBackend.solo.clickLongOnScreen(x, y);
17
+
18
+ return Result.successResult();
19
+ }
20
+
21
+ @Override
22
+ public String key() {
23
+ return "long_press_coordinate";
24
+ }
25
+ }
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.pre3
4
+ version: 0.4.19.pre4
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-06 00:00:00.000000000 Z
11
+ date: 2014-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cucumber
@@ -344,8 +344,10 @@ files:
344
344
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByIndex.java
345
345
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByText.java
346
346
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/ClickOnScreen.java
347
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/DoubleTapCoordinate.java
347
348
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/Drag.java
348
349
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/DragCoordinates.java
350
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java
349
351
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/Swipe.java
350
352
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/TouchCoordinates.java
351
353
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/helpers/InspectCurrentDialog.java