calabash-android 0.2.18 → 0.2.19

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,8 @@
1
+ 0.2.19:
2
+ New actions:
3
+ Drag action
4
+ Press image button by content description
5
+
1
6
  0.2.18:
2
7
  Various small improvements and bug fixes.
3
8
 
@@ -14,5 +14,6 @@ require 'calabash-android/steps/press_button_steps'
14
14
  require 'calabash-android/steps/progress_steps'
15
15
  require 'calabash-android/steps/rotation_steps'
16
16
  require 'calabash-android/steps/screenshot_steps'
17
+ require 'calabash-android/steps/search_steps'
17
18
  require 'calabash-android/steps/spinner_steps'
18
19
  require 'calabash-android/steps/time_picker_steps'
@@ -100,8 +100,14 @@ To scroll up
100
100
  Then /^I scroll up$/
101
101
 
102
102
  To open the menu and press the specified text
103
+
103
104
  Then /^I select "([^\"]*)" from the menu$/
105
+
106
+ To drag from one point on the screen to another.
104
107
 
108
+ Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/
109
+ Note: x:y co-ordinates are expressed as percentages of the screen width:height
110
+
105
111
  Touching
106
112
  --------
107
113
 
@@ -38,4 +38,9 @@ end
38
38
 
39
39
  Then /^I scroll up$/ do
40
40
  performAction('scroll_up')
41
- end
41
+ end
42
+
43
+ Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/ do |fromX, fromY, toX, toY, steps|
44
+ performAction('drag',fromX,toX,fromY,toY,steps)
45
+ end
46
+
@@ -0,0 +1,7 @@
1
+ Then /^I enter "([^\"]*)" into search field$/ do |text|
2
+ performAction('enter_query_into_numbered_field', text, 1)
3
+ end
4
+
5
+ Then /^I enter "([^\"]*)" into search field number (\d+)$/ do |text, number|
6
+ performAction('enter_query_into_numbered_field', text, number)
7
+ end
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.2.18"
3
+ VERSION = "0.2.19"
4
4
  end
5
5
  end
@@ -8,4 +8,4 @@
8
8
  # project structure.
9
9
 
10
10
  # Project target.
11
- target=Google Inc.:Google APIs:15
11
+ target=Google Inc.:Google APIs:8
@@ -0,0 +1,31 @@
1
+ package sh.calaba.instrumentationbackend.actions.button;
2
+
3
+
4
+ import android.widget.ImageButton;
5
+ import android.view.ViewGroup;
6
+ import sh.calaba.instrumentationbackend.InstrumentationBackend;
7
+ import sh.calaba.instrumentationbackend.Result;
8
+ import sh.calaba.instrumentationbackend.actions.Action;
9
+
10
+
11
+ public class PressImageButtonDescription implements Action {
12
+
13
+ @Override
14
+ public Result execute(String... args) {
15
+ String err = "No image button found with description "+args[0]+" found. Found only:";
16
+ for (ImageButton b : InstrumentationBackend.solo.getCurrentImageButtons()){
17
+ err += " "+ b.getContentDescription();
18
+ if (args[0].equals(b.getContentDescription())){
19
+ InstrumentationBackend.solo.clickOnView(b);
20
+ return Result.successResult();
21
+ }
22
+ }
23
+ return new Result(false, err);
24
+ }
25
+
26
+ @Override
27
+ public String key() {
28
+ return "press_image_button_description";
29
+ }
30
+
31
+ }
@@ -0,0 +1,40 @@
1
+ package sh.calaba.instrumentationbackend.actions.gestures;
2
+
3
+ import sh.calaba.instrumentationbackend.InstrumentationBackend;
4
+ import sh.calaba.instrumentationbackend.Result;
5
+ import sh.calaba.instrumentationbackend.actions.Action;
6
+
7
+ import android.util.DisplayMetrics;
8
+
9
+ public class Drag implements Action {
10
+
11
+ @Override
12
+ public Result execute(String... args) {
13
+
14
+ Float fromX = new Float(args[0]);
15
+ Float toX = new Float(args[1]);
16
+ Float fromY = new Float(args[2]);
17
+ Float toY = new Float(args[3]);
18
+ Integer stepCount = new Integer(args[4]);
19
+
20
+ DisplayMetrics dm = new DisplayMetrics();
21
+ InstrumentationBackend.solo.getCurrentActivity().getWindowManager()
22
+ .getDefaultDisplay().getMetrics(dm);
23
+ Integer windowWidth = dm.widthPixels;
24
+ Integer windowHeight = dm.heightPixels;
25
+
26
+ InstrumentationBackend.solo.drag(fromX / 100 * windowWidth,
27
+ toX / 100 * windowWidth,
28
+ fromY / 100 * windowHeight,
29
+ toY / 100 * windowHeight,
30
+ stepCount);
31
+
32
+ return Result.successResult();
33
+ }
34
+
35
+ @Override
36
+ public String key() {
37
+ return "drag";
38
+ }
39
+
40
+ }
@@ -0,0 +1,31 @@
1
+ package sh.calaba.instrumentationbackend.actions.search;
2
+
3
+ import sh.calaba.instrumentationbackend.InstrumentationBackend;
4
+ import sh.calaba.instrumentationbackend.Result;
5
+ import sh.calaba.instrumentationbackend.actions.Action;
6
+
7
+ public class EnterQueryByIndex implements Action {
8
+ @Override
9
+ public Result execute(String... args) {
10
+ /*
11
+ final String query = args[0];
12
+ final SearchView view = (SearchView) InstrumentationBackend.solo.getView(
13
+ SearchView.class, Integer.parseInt(args[1]) - 1);
14
+
15
+ InstrumentationBackend.instrumentation.runOnMainSync(new Runnable() {
16
+ @Override
17
+ public void run() {
18
+ view.setQuery(query, true);
19
+ }
20
+ });
21
+
22
+ return Result.successResult();
23
+ */
24
+ throw new RuntimeException("Not supported in this version. Will be reintroduced when we have a way to support features from newer versions of Android.");
25
+ }
26
+
27
+ @Override
28
+ public String key() {
29
+ return "enter_query_into_numbered_field";
30
+ }
31
+ }
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.18
4
+ version: 0.2.19
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-10 00:00:00.000000000 Z
12
+ date: 2012-09-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: cucumber
@@ -133,6 +133,7 @@ files:
133
133
  - lib/calabash-android/steps/progress_steps.rb
134
134
  - lib/calabash-android/steps/rotation_steps.rb
135
135
  - lib/calabash-android/steps/screenshot_steps.rb
136
+ - lib/calabash-android/steps/search_steps.rb
136
137
  - lib/calabash-android/steps/spinner_steps.rb
137
138
  - lib/calabash-android/steps/time_picker_steps.rb
138
139
  - lib/calabash-android/version.rb
@@ -165,6 +166,7 @@ files:
165
166
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/NullAction.java
166
167
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonNumber.java
167
168
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonText.java
169
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java
168
170
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonNumber.java
169
171
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/WaitForButton.java
170
172
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/checkbox/ToggleCheckboxNumber.java
@@ -173,6 +175,7 @@ files:
173
175
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByIndex.java
174
176
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByText.java
175
177
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/ClickOnScreen.java
178
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/Drag.java
176
179
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/Swipe.java
177
180
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/helpers/ListActions.java
178
181
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListItemProperties.java
@@ -203,6 +206,7 @@ files:
203
206
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/map_unsupported/UnsupportedMapAction.java
204
207
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollDown.java
205
208
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollUp.java
209
+ - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/search/EnterQueryByIndex.java
206
210
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/DownKey.java
207
211
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/EnterKey.java
208
212
  - test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/GoBack.java