calabash-android 0.5.0.pre1 → 0.5.0.pre2
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/lib/calabash-android/canned_steps.md +71 -101
- data/lib/calabash-android/lib/TestServer.apk +0 -0
- data/lib/calabash-android/operations.rb +12 -4
- data/lib/calabash-android/steps/context_menu_steps.rb +8 -10
- data/lib/calabash-android/steps/enter_text_steps.rb +7 -7
- data/lib/calabash-android/steps/navigation_steps.rb +4 -4
- data/lib/calabash-android/steps/press_button_steps.rb +14 -14
- data/lib/calabash-android/steps/progress_steps.rb +11 -11
- data/lib/calabash-android/steps/spinner_steps.rb +2 -2
- data/lib/calabash-android/version.rb +1 -1
- data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/HideSoftKeyboard.java +34 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 95f21eb2f0a76991155542d6963043ead614f372
|
4
|
+
data.tar.gz: 879b905878e095cd1547dc808c6088d0815ef89c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b966369b4d9f8d27e46e1059466f54d809f93a6ad9ff76e1a2550497bf8797f27b4161e4795931a1c3e4f6253a49d1549bb456e099c9ca285577512645b5851d
|
7
|
+
data.tar.gz: d095a2a9ef2a3a5ef7c473615f19b103760f4b0df831e8fe2a7b2f4afc32dc6361de05e05450a44b6b5cb1db6184893cc51476a4dba10b37c3cd2fd47d3ef212
|
@@ -23,18 +23,21 @@ To assert that specified text cannot be found use any of the following steps.
|
|
23
23
|
Input steps
|
24
24
|
-----------
|
25
25
|
|
26
|
-
Then /^I toggle checkbox number (\d+)$/ do |
|
27
|
-
Toggles checkout with the specified index.
|
26
|
+
Then /^I toggle checkbox number (\d+)$/ do |index|
|
27
|
+
Toggles the checkout with the specified index.
|
28
28
|
|
29
|
-
Then /^I long press "([^\"]*)"$/ do |
|
30
|
-
Long presses the
|
29
|
+
Then /^I long press "([^\"]*)"$/ do |text|
|
30
|
+
Long presses the view containing the specified text.
|
31
31
|
|
32
|
-
|
32
|
+
Then /^I long press "([^\"]*)" and select item number (\d+)$/ do |text, index|
|
33
|
+
**This predefined step is deprecated**
|
33
34
|
|
34
|
-
Long presses the
|
35
|
+
Long presses the view containing the specified text and selects the menu item with the specified index in the context menu that appears.
|
35
36
|
|
36
|
-
Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |
|
37
|
-
|
37
|
+
Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |text, identifier|
|
38
|
+
**This predefined step is deprecated**
|
39
|
+
|
40
|
+
Long presses the view containing the specified text and selects the menu item marked by the specified identifier in the context menu that appears.
|
38
41
|
|
39
42
|
|
40
43
|
Given /^I set the date to "(\d\d-\d\d-\d\d\d\d)" on DatePicker with index "([^\"]*)"$/ do |date, index|
|
@@ -46,148 +49,124 @@ Finds the datepicker with the specified index and changes the date.
|
|
46
49
|
Finds the timepicker with the specified index and changes the time.
|
47
50
|
|
48
51
|
Given /^I set the "([^\"]*)" date to "(\d\d-\d\d-\d\d\d\d)"$/ do |content_description, date|
|
49
|
-
|
50
|
-
|
51
|
-
Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, number|
|
52
|
-
Enters the specified text into the input field with index `number`.
|
52
|
+
Finds the datepicker by content description and changes the date.
|
53
53
|
|
54
|
-
Then /^I enter
|
55
|
-
Enters
|
54
|
+
Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, index|
|
55
|
+
Enters the specified text into the input field with the specified index.
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
Enters the specified text into the input field that has a content desciption that matches the provided target.
|
57
|
+
Then /^I enter text "([^\"]*)" into field with id "([^\"]*)"$/ do |text, id|
|
58
|
+
Enters the specified text into the input field with the specified id.
|
60
59
|
|
60
|
+
Then /^I enter "([^\"]*)" as "([^\"]*)"$/ do |text, content_description|
|
61
|
+
Then /^I enter "([^\"]*)" into "([^\"]*)"$/ do |text, content_description|
|
62
|
+
Enters the specified text into the input field that has the specified content description.
|
61
63
|
|
64
|
+
Then /^I clear input field number (\d+)$/ do |index|
|
65
|
+
Clears the text of the input field with the specified index.
|
62
66
|
|
63
|
-
Then /^I clear
|
64
|
-
|
67
|
+
Then /^I clear "([^\"]*)"$/ do |identifier|
|
68
|
+
Clears the text of input fields marked by the identifier.
|
65
69
|
|
66
|
-
Then /^I clear "([^\"]*)"$/ do |
|
67
|
-
|
70
|
+
Then /^I clear input field with id "([^\"]*)"$/ do |id|
|
71
|
+
Clears the text of the input field with the specified id.
|
68
72
|
|
69
|
-
Then /^I
|
70
|
-
Finds the
|
71
|
-
|
72
|
-
Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |item_text, spinner_content_description|
|
73
|
-
Finds the Spinner by 'spinner_content_description' and selects the item with the matching 'item_text'
|
73
|
+
Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |item_identifier, spinner_identifier|
|
74
|
+
Finds the spinner marked by the specified 'spinner_identifier' or has a childview marked by the specified 'spinner_identifier'. It then selects the menu item marked by the specified 'item_identifier'.
|
74
75
|
|
75
76
|
Buttons
|
76
77
|
-------
|
77
78
|
|
78
|
-
Simulates that the user pressed the back button.
|
79
|
-
|
80
79
|
Then /^I go back$/
|
81
|
-
|
82
|
-
Simulates that the user pressed the menu button.
|
80
|
+
Simulates that the user pressed the back button.
|
83
81
|
|
84
82
|
Then /^I press the menu key$/
|
83
|
+
Simulates that the user pressed the menu button.
|
85
84
|
|
85
|
+
Then /^I press the enter button$/
|
86
86
|
Simulates that the user pressed the enter button on the keyboard.
|
87
87
|
|
88
|
-
Then /^I press the enter button$/ do
|
89
|
-
|
90
88
|
Gestures
|
91
89
|
--------
|
92
|
-
To swipe left
|
93
|
-
|
94
90
|
Then /^I swipe left$/
|
95
|
-
|
96
|
-
To swipe right
|
91
|
+
Swipes left.
|
97
92
|
|
98
93
|
Then /^I swipe right$/
|
99
|
-
|
100
|
-
To scroll down
|
94
|
+
Swipes right.
|
101
95
|
|
102
96
|
Then /^I scroll down$/
|
103
|
-
|
104
|
-
To scroll up
|
97
|
+
Scrolls down.
|
105
98
|
|
106
99
|
Then /^I scroll up$/
|
100
|
+
Scrolls up.
|
107
101
|
|
108
|
-
|
102
|
+
Then /^I select "([^\"]*)" from the menu$/ do |identifier|
|
103
|
+
Opens the menu by simulating pressing the menu button and then selects a menu item marked by the specified identifier.
|
109
104
|
|
110
|
-
Then /^I select "([^\"]*)" from the menu$/
|
111
105
|
|
112
|
-
|
106
|
+
Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/ do |from_x, from_y, to_x, to_y, steps|
|
107
|
+
Drags from one point on the screen to another.
|
113
108
|
|
114
|
-
|
115
|
-
Note: x:y co-ordinates are expressed as percentages of the screen width:height
|
109
|
+
**Note: x:y co-ordinates are expressed as percentages of the screen width:height**
|
116
110
|
|
117
111
|
Touching
|
118
112
|
--------
|
119
113
|
|
120
|
-
|
121
|
-
|
122
|
-
Search for a button with the provided text and press it if found.
|
123
|
-
|
124
|
-
Then /^I press button number (\d+)$/
|
114
|
+
Given /^I press the "([^\"]*)" button$/ do |text|
|
115
|
+
Taps the button containing the specified text.
|
125
116
|
|
126
|
-
|
117
|
+
Then /^I press button number (\d+)$/ do |index|
|
118
|
+
Taps the button with the specified index.
|
127
119
|
|
128
|
-
Then /^I press image button number (\d+)$/
|
120
|
+
Then /^I press image button number (\d+)$/ do |index|
|
121
|
+
Taps the image button with the specified index.
|
129
122
|
|
130
|
-
|
131
|
-
|
132
|
-
Then /^I press view with id "([^\"]*)"$/
|
133
|
-
|
134
|
-
Looks for a view with the provided id. If it is found and visible tries to click it.
|
135
|
-
Note that use the short name and not the fully quantified name. That means if your id
|
136
|
-
is 'com.foo.R.id.bar_label' you would use 'I press view with id "bar_label"'.
|
123
|
+
Then /^I press view with id "([^\"]*)"$/ do |id|
|
124
|
+
Taps the view with the give id.
|
137
125
|
|
138
126
|
Then /^I press "([^\"]*)"$/ do |identifier|
|
139
|
-
|
140
|
-
|
141
|
-
1. Looks for a visible button with matching text.
|
142
|
-
2. Look for a visible view with a matching content description.
|
143
|
-
3. Look for a visible view with class name that matches the provided indentifier.
|
127
|
+
Taps the view marked by the specified identifier.
|
144
128
|
|
145
|
-
|
129
|
+
Then /^I touch the "([^\"]*)" text$/ do |text|
|
130
|
+
Taps the specified text.
|
146
131
|
|
147
|
-
Then /^I
|
148
|
-
|
132
|
+
Then /^I press list item number (\d+)$/ do |index|
|
133
|
+
**This predefined step is deprecated**
|
149
134
|
|
150
|
-
|
151
|
-
Will press the specified list item in the first visible list.
|
135
|
+
Taps the list item with the specified index in the first visible list.
|
152
136
|
|
153
|
-
Then /^I long press list item number (\d+)$/
|
137
|
+
Then /^I long press list item number (\d+)$/ do |index|
|
138
|
+
**This predefined step is deprecated**
|
154
139
|
|
155
|
-
|
140
|
+
Long presses the list item with the specified index in the first visible list.
|
156
141
|
|
157
|
-
Then /^I click on screen (\d+)% from the left and (\d+)% from the top$/
|
158
|
-
|
142
|
+
Then /^I click on screen (\d+)% from the left and (\d+)% from the top$/ do |x, y|
|
143
|
+
Taps the screen at the specified location.
|
159
144
|
|
160
145
|
Waiting
|
161
146
|
-------
|
162
147
|
|
163
148
|
Then /^I wait for progress$/ do
|
164
|
-
Will wait
|
149
|
+
Will wait until there are no more progress bars.
|
165
150
|
|
166
|
-
Then /^I wait for
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
Then /^I wait for "([^\"]*)" to appear$/
|
171
|
-
Then /^I wait to see "([^\"]*)"$/
|
151
|
+
Then /^I wait for "([^\"]*)" to appear$/ do |text|
|
152
|
+
Then /^I wait to see "([^\"]*)"$/ do |text|
|
172
153
|
Waits for the specified text to appear.
|
173
154
|
|
174
|
-
Then /^I wait up to (\d+) seconds for "([^\"]*)" to appear$/
|
175
|
-
Then /^I wait up to (\d+) seconds to see "([^\"]*)"$/
|
155
|
+
Then /^I wait up to (\d+) seconds for "([^\"]*)" to appear$/ do |timeout, text|
|
156
|
+
Then /^I wait up to (\d+) seconds to see "([^\"]*)"$/ do |timeout, †ext|
|
176
157
|
Waits for the specified text to appear, with a custom timeout
|
177
158
|
|
178
|
-
Then /^I wait for the "([^\"]*)" button to appear$/
|
179
|
-
Waits for a button
|
159
|
+
Then /^I wait for the "([^\"]*)" button to appear$/ do |identifier|
|
160
|
+
Waits for a button marked by the specified identifier to appear.
|
180
161
|
|
181
|
-
Then /^I wait for the "([^\"]*)" screen to appear$/
|
162
|
+
Then /^I wait for the "([^\"]*)" screen to appear$/ do |activity_name|
|
182
163
|
Waits for a particular screen (Android Activity) to appear.
|
183
164
|
|
184
|
-
Then /^I wait for the view with id "([^\"]*)" to appear$/ do |
|
185
|
-
Waits for a view
|
186
|
-
Note that use the short name and not the fully quantified name. That means if your id
|
187
|
-
is 'com.foo.R.id.bar_label' you would use 'I press view with id "bar_label"'.
|
165
|
+
Then /^I wait for the view with id "([^\"]*)" to appear$/ do |id|
|
166
|
+
Waits for a view with the specified if to appear.
|
188
167
|
|
189
|
-
Then /^I wait up to (\d+) seconds for the "([^\"]*)" screen to appear$/
|
190
|
-
Then /^I wait upto (\d+) seconds for the "([^\"]*)" screen to appear$/
|
168
|
+
Then /^I wait up to (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout, activity_name|
|
169
|
+
Then /^I wait upto (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout, activity_name|
|
191
170
|
Waits for a particular screen (Android Activity) to appear with a timeout.
|
192
171
|
|
193
172
|
Then /^I wait for 1 second$/
|
@@ -197,7 +176,7 @@ Waits for one second.
|
|
197
176
|
Then /^I wait$/
|
198
177
|
Waits for two seonds.
|
199
178
|
|
200
|
-
Then /^I wait for (\d+) seconds$/
|
179
|
+
Then /^I wait for (\d+) seconds$/ do |seconds|
|
201
180
|
Waits for a specified number of seconds.
|
202
181
|
|
203
182
|
Screenshots
|
@@ -248,12 +227,3 @@ Note: you can assert or press interface elements using [Android's String resourc
|
|
248
227
|
|
249
228
|
perform_action('press_l10n_element', 'ok', nil, 'android')
|
250
229
|
|
251
|
-
Rotation
|
252
|
-
--------
|
253
|
-
|
254
|
-
These steps do nothing if you run them locally.
|
255
|
-
If you run the test on [LessPainful](https://www.lesspainful.com) they will actually rotate the physical device.
|
256
|
-
|
257
|
-
Then /^I rotate the device to landscape$/
|
258
|
-
Then /^I rotate the device to portrait$/
|
259
|
-
|
Binary file
|
@@ -461,8 +461,8 @@ module Operations
|
|
461
461
|
|
462
462
|
def connected_devices
|
463
463
|
lines = `#{Env.adb_path} devices`.split("\n")
|
464
|
-
lines.
|
465
|
-
lines.collect { |l| l.split("\t").first}
|
464
|
+
start_index = lines.index{ |x| x =~ /List of devices attached/ } + 1
|
465
|
+
lines[start_index..-1].collect { |l| l.split("\t").first }
|
466
466
|
end
|
467
467
|
|
468
468
|
def wake_up
|
@@ -764,6 +764,10 @@ module Operations
|
|
764
764
|
perform_action('keyboard_enter_text', text)
|
765
765
|
end
|
766
766
|
|
767
|
+
def keyboard_enter_char(character, options = {})
|
768
|
+
keyboard_enter_text(character[0,1], options)
|
769
|
+
end
|
770
|
+
|
767
771
|
def enter_text(uiquery, text, options = {})
|
768
772
|
tap_when_element_exists(uiquery, options)
|
769
773
|
sleep 0.5
|
@@ -778,6 +782,10 @@ module Operations
|
|
778
782
|
true
|
779
783
|
end
|
780
784
|
|
785
|
+
def hide_soft_keyboard
|
786
|
+
perform_action('hide_soft_keyboard')
|
787
|
+
end
|
788
|
+
|
781
789
|
def find_coordinate(uiquery)
|
782
790
|
raise "Cannot find nil" unless uiquery
|
783
791
|
|
@@ -831,9 +839,9 @@ module Operations
|
|
831
839
|
perform_action('press_menu')
|
832
840
|
end
|
833
841
|
|
834
|
-
def select_options_menu_item(
|
842
|
+
def select_options_menu_item(identifier, options={})
|
835
843
|
press_menu_button
|
836
|
-
tap_when_element_exists("DropDownListView * marked:'#{
|
844
|
+
tap_when_element_exists("DropDownListView * marked:'#{identifier}'", options)
|
837
845
|
end
|
838
846
|
|
839
847
|
def select_context_menu_item(view_uiquery, menu_item_query_string)
|
@@ -1,19 +1,17 @@
|
|
1
|
-
Then /^I long press "([^\"]*)" and select item number (\d+)$/ do |
|
1
|
+
Then /^I long press "([^\"]*)" and select item number (\d+)$/ do |text, index|
|
2
2
|
step_deprecated
|
3
3
|
|
4
|
-
long_press_when_element_exists("* {text CONTAINS '#{
|
5
|
-
|
6
|
-
touch_index = index.to_i - 1
|
7
|
-
tap_when_element_exists("com.android.internal.view.menu.ListMenuItemView android.widget.TextView index:#{touch_index}")
|
4
|
+
long_press_when_element_exists("* {text CONTAINS[c] '#{text}'}")
|
5
|
+
tap_when_element_exists("com.android.internal.view.menu.ListMenuItemView android.widget.TextView index:#{index.to_i - 1}")
|
8
6
|
end
|
9
7
|
|
10
|
-
Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |
|
8
|
+
Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |text, identifier|
|
11
9
|
step_deprecated
|
12
10
|
|
13
|
-
long_press_when_element_exists("* {text CONTAINS '#{
|
14
|
-
tap_when_element_exists("com.android.internal.view.menu.ListMenuItemView android.widget.TextView marked:'#{
|
11
|
+
long_press_when_element_exists("* {text CONTAINS[c] '#{text}'}")
|
12
|
+
tap_when_element_exists("com.android.internal.view.menu.ListMenuItemView android.widget.TextView marked:'#{identifier}'")
|
15
13
|
end
|
16
14
|
|
17
|
-
Then /^I long press "([^\"]*)"$/ do |
|
18
|
-
long_press_when_element_exists("* {text CONTAINS '#{
|
15
|
+
Then /^I long press "([^\"]*)"$/ do |text|
|
16
|
+
long_press_when_element_exists("* {text CONTAINS[c] '#{text}'}")
|
19
17
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Then /^I enter "([^\"]*)" as "([^\"]*)"$/ do |text, content_description|
|
2
|
-
enter_text("android.widget.EditText contentDescription
|
2
|
+
enter_text("android.widget.EditText {contentDescription LIKE[c] '#{content_description}'}", text)
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /^I enter "([^\"]*)" into "([^\"]*)"$/ do |text, content_description|
|
@@ -14,14 +14,14 @@ Then /^I enter text "([^\"]*)" into field with id "([^\"]*)"$/ do |text, id|
|
|
14
14
|
enter_text("android.widget.EditText id:'#{id}'", text)
|
15
15
|
end
|
16
16
|
|
17
|
-
Then /^I clear "([^\"]*)"$/ do |
|
18
|
-
clear_text("android.widget.EditText marked:'#{
|
17
|
+
Then /^I clear "([^\"]*)"$/ do |identifier|
|
18
|
+
clear_text("android.widget.EditText marked:'#{identifier}'}")
|
19
19
|
end
|
20
20
|
|
21
|
-
Then /^I clear input field number (\d+)$/ do |
|
22
|
-
clear_text("android.widget.EditText index:#{
|
21
|
+
Then /^I clear input field number (\d+)$/ do |index|
|
22
|
+
clear_text("android.widget.EditText index:#{index.to_i-1}")
|
23
23
|
end
|
24
24
|
|
25
|
-
Then /^I clear input field with id "([^\"]*)"$/ do |
|
26
|
-
clear_text("android.widget.EditText id:'#{
|
25
|
+
Then /^I clear input field with id "([^\"]*)"$/ do |id|
|
26
|
+
clear_text("android.widget.EditText id:'#{id}'")
|
27
27
|
end
|
@@ -19,8 +19,8 @@ Then /^I swipe right$/ do
|
|
19
19
|
perform_action('swipe', 'right')
|
20
20
|
end
|
21
21
|
|
22
|
-
Then /^I select "([^\"]*)" from the menu$/ do |
|
23
|
-
select_options_menu_item(
|
22
|
+
Then /^I select "([^\"]*)" from the menu$/ do |identifier|
|
23
|
+
select_options_menu_item(identifier)
|
24
24
|
end
|
25
25
|
|
26
26
|
Then /^I select tab number (\d+)$/ do | tab |
|
@@ -40,7 +40,7 @@ Then /^I scroll up$/ do
|
|
40
40
|
scroll_up
|
41
41
|
end
|
42
42
|
|
43
|
-
Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/ do |
|
44
|
-
perform_action('drag',
|
43
|
+
Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/ do |from_x, from_y, to_x, to_y, steps|
|
44
|
+
perform_action('drag', from_x, to_x, from_y, to_y, steps)
|
45
45
|
end
|
46
46
|
|
@@ -1,17 +1,17 @@
|
|
1
|
-
Given /^I press the "([^\"]*)" button$/ do |
|
2
|
-
tap_when_element_exists("android.widget.Button {text CONTAINS[c] '#{
|
1
|
+
Given /^I press the "([^\"]*)" button$/ do |text|
|
2
|
+
tap_when_element_exists("android.widget.Button {text CONTAINS[c] '#{text}'}")
|
3
3
|
end
|
4
4
|
|
5
|
-
Then /^I press button number (\d+)$/ do |
|
6
|
-
tap_when_element_exists("android.widget.Button index:#{
|
5
|
+
Then /^I press button number (\d+)$/ do |index|
|
6
|
+
tap_when_element_exists("android.widget.Button index:#{index.to_i-1}")
|
7
7
|
end
|
8
8
|
|
9
|
-
Then /^I press image button number (\d+)$/ do |
|
10
|
-
tap_when_element_exists("android.widget.ImageButton index:#{
|
9
|
+
Then /^I press image button number (\d+)$/ do |index|
|
10
|
+
tap_when_element_exists("android.widget.ImageButton index:#{index.to_i-1}")
|
11
11
|
end
|
12
12
|
|
13
|
-
Then /^I press view with id "([^\"]*)"$/ do |
|
14
|
-
tap_when_element_exists("* id:'#{
|
13
|
+
Then /^I press view with id "([^\"]*)"$/ do |id|
|
14
|
+
tap_when_element_exists("* id:'#{id}'")
|
15
15
|
end
|
16
16
|
|
17
17
|
Then /^I press "([^\"]*)"$/ do |identifier|
|
@@ -19,21 +19,21 @@ Then /^I press "([^\"]*)"$/ do |identifier|
|
|
19
19
|
end
|
20
20
|
|
21
21
|
Then /^I click on screen (\d+)% from the left and (\d+)% from the top$/ do |x, y|
|
22
|
-
perform_action('click_on_screen',x, y)
|
22
|
+
perform_action('click_on_screen', x, y)
|
23
23
|
end
|
24
24
|
|
25
25
|
Then /^I touch the "([^\"]*)" text$/ do |text|
|
26
|
-
tap_when_element_exists("* {text
|
26
|
+
tap_when_element_exists("* {text CONTAINS[c] '#{text}'}")
|
27
27
|
end
|
28
28
|
|
29
|
-
Then /^I press list item number (\d+)$/ do |
|
29
|
+
Then /^I press list item number (\d+)$/ do |index|
|
30
30
|
step_deprecated
|
31
31
|
|
32
|
-
tap_when_element_exists("android.widget.ListView index:0 android.widget.TextView index:#{
|
32
|
+
tap_when_element_exists("android.widget.ListView index:0 android.widget.TextView index:#{index.to_i-1}")
|
33
33
|
end
|
34
34
|
|
35
|
-
Then /^I long press list item number (\d+)$/ do |
|
35
|
+
Then /^I long press list item number (\d+)$/ do |index|
|
36
36
|
step_deprecated
|
37
37
|
|
38
|
-
long_press_when_element_exists("android.widget.ListView index:0 android.widget.TextView index:#{
|
38
|
+
long_press_when_element_exists("android.widget.ListView index:0 android.widget.TextView index:#{index.to_i-1}")
|
39
39
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
Then /^I wait for progress$/ do
|
2
|
-
wait_for_element_do_not_exist("android.widget.ProgressBar"
|
2
|
+
wait_for_element_do_not_exist("android.widget.ProgressBar")
|
3
3
|
end
|
4
4
|
|
5
5
|
Then /^I wait$/ do
|
@@ -35,12 +35,12 @@ Then /^I wait up to (\d+) seconds to see "([^\"]*)"$/ do |timeout, text|
|
|
35
35
|
wait_for_text(text, timeout: timeout.to_i)
|
36
36
|
end
|
37
37
|
|
38
|
-
Then /^I wait for the "([^\"]*)" button to appear$/ do |
|
39
|
-
wait_for_element_exists("android.widget.Button marked:'#{
|
38
|
+
Then /^I wait for the "([^\"]*)" button to appear$/ do |identifier|
|
39
|
+
wait_for_element_exists("android.widget.Button marked:'#{identifier}'");
|
40
40
|
end
|
41
41
|
|
42
42
|
Then /^I wait for the view with id "([^\"]*)" to appear$/ do |id|
|
43
|
-
wait_for_element_exists("* id:'#{id}'"
|
43
|
+
wait_for_element_exists("* id:'#{id}'")
|
44
44
|
end
|
45
45
|
|
46
46
|
Then /^I wait for the "([^\"]*)" view to appear$/ do |text|
|
@@ -48,20 +48,20 @@ Then /^I wait for the "([^\"]*)" view to appear$/ do |text|
|
|
48
48
|
end
|
49
49
|
|
50
50
|
|
51
|
-
Then /^I wait for the "([^\"]*)" screen to appear$/ do |
|
52
|
-
wait_for_activity(
|
51
|
+
Then /^I wait for the "([^\"]*)" screen to appear$/ do |activity_name|
|
52
|
+
wait_for_activity(activity_name)
|
53
53
|
end
|
54
54
|
|
55
|
-
Then /^I wait upto (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout,
|
56
|
-
wait_for_activity(
|
55
|
+
Then /^I wait upto (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout, activity_name|
|
56
|
+
wait_for_activity(activity_name, timeout: timeout.to_i)
|
57
57
|
end
|
58
58
|
|
59
|
-
Then /^I wait up to (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout,
|
60
|
-
wait_for_activity(
|
59
|
+
Then /^I wait up to (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout, activity_name|
|
60
|
+
wait_for_activity(activity_name, timeout: timeout.to_i)
|
61
61
|
end
|
62
62
|
|
63
63
|
# @param - the "tag" associated with the tab, or the text within the tab label
|
64
|
-
Then /^I wait for the "([^\"]*)" tab to appear$/ do |
|
64
|
+
Then /^I wait for the "([^\"]*)" tab to appear$/ do |tab|
|
65
65
|
wait_for do
|
66
66
|
query("android.widget.TabWidget descendant TextView {text LIKE[c] '#{tab}'}", :isSelected).first
|
67
67
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |
|
1
|
+
Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |item_identifier, spinner_identifier|
|
2
2
|
spinner = query("android.widget.Spinner marked:'#{spinner_identifier}'")
|
3
3
|
|
4
4
|
if spinner.empty?
|
@@ -7,5 +7,5 @@ Then /^I select "([^\"]*)" from "([^\"]*)"$/ do |item_text, spinner_identifier|
|
|
7
7
|
touch(spinner)
|
8
8
|
end
|
9
9
|
|
10
|
-
tap_when_element_exists("android.widget.PopupWindow$PopupViewContainer * marked:'#{
|
10
|
+
tap_when_element_exists("android.widget.PopupWindow$PopupViewContainer * marked:'#{item_identifier}'")
|
11
11
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
package sh.calaba.instrumentationbackend.actions.text;
|
2
|
+
|
3
|
+
import android.app.Activity;
|
4
|
+
import android.content.Context;
|
5
|
+
import android.view.View;
|
6
|
+
import android.view.inputmethod.InputMethodManager;
|
7
|
+
|
8
|
+
import sh.calaba.instrumentationbackend.InstrumentationBackend;
|
9
|
+
import sh.calaba.instrumentationbackend.Result;
|
10
|
+
import sh.calaba.instrumentationbackend.actions.Action;
|
11
|
+
|
12
|
+
public class HideSoftKeyboard implements Action {
|
13
|
+
@Override
|
14
|
+
public Result execute(String... args) {
|
15
|
+
Context context = InstrumentationBackend.instrumentation.getTargetContext();
|
16
|
+
InputMethodManager inputMethodManager = (InputMethodManager) context.getSystemService(Context.INPUT_METHOD_SERVICE);
|
17
|
+
|
18
|
+
Activity activity = InstrumentationBackend.solo.getCurrentActivity();
|
19
|
+
View view = activity.getCurrentFocus();
|
20
|
+
|
21
|
+
if (view == null) {
|
22
|
+
view = new View(activity);
|
23
|
+
}
|
24
|
+
|
25
|
+
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
26
|
+
|
27
|
+
return Result.successResult();
|
28
|
+
}
|
29
|
+
|
30
|
+
@Override
|
31
|
+
public String key() {
|
32
|
+
return "hide_soft_keyboard";
|
33
|
+
}
|
34
|
+
}
|
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.5.0.
|
4
|
+
version: 0.5.0.pre2
|
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-06-
|
11
|
+
date: 2014-06-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cucumber
|
@@ -364,6 +364,7 @@ files:
|
|
364
364
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/PressMenu.java
|
365
365
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/RightKey.java
|
366
366
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/UpKey.java
|
367
|
+
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/HideSoftKeyboard.java
|
367
368
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/KeyboardEnterText.java
|
368
369
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetDateByContentDescription.java
|
369
370
|
- test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/time/SetDateByIndex.java
|