calabash-android 0.5.0.pre1 → 0.5.0.pre2

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: 7a378465ba71fd03e09901a56b34e16b780d0753
4
- data.tar.gz: 8e9117755d320057f9cc55e842c448d45db6c726
3
+ metadata.gz: 95f21eb2f0a76991155542d6963043ead614f372
4
+ data.tar.gz: 879b905878e095cd1547dc808c6088d0815ef89c
5
5
  SHA512:
6
- metadata.gz: 14cbc8db152ca204468d1549cd7a96bc032198897eac5e9702941d6b3cc862025b7fc8792031937b97323046a8b3510543f435705ae0ea515559a8a19ab22ced
7
- data.tar.gz: 4c2c2504a207311335d62e2680a1b582852278bfe106d1812622dcbb92866f56553ef7771eb20051ff2ede477f1311e602623da3852b86043f9678b3a2be47f9
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 |checkbox_number|
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 |text_to_press|
30
- Long presses the text if found.
29
+ Then /^I long press "([^\"]*)"$/ do |text|
30
+ Long presses the view containing the specified text.
31
31
 
32
- Then /^I long press "([^\"]*)" and select item number "([^\"]*)"$/ do |text_to_press, index|
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 text (if found) and select the specified number in the context menu that appear.
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 |text_to_press, context_text|
37
- Long presses the text (if found) and select the specified number in the context menu that appear.
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
- Find the datepicker by content description and changes the date.
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 text "([^\"]*)" into field with id "([^\"]*)"$/ do |text, view_id|
55
- Enters Text into the input field with id `view_id`.
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
- Then /^I enter "([^\"]*)" as "([^\"]*)"$/ do |text, target|
58
- Then /^I enter "([^\"]*)" into "([^\"]*)"$/ do |text, target|
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 input field number (\d+)$/ do |number|
64
- Finds a input field by index and blanks its value.
67
+ Then /^I clear "([^\"]*)"$/ do |identifier|
68
+ Clears the text of input fields marked by the identifier.
65
69
 
66
- Then /^I clear "([^\"]*)"$/ do |name|
67
- Finds a input field with matching content description and blanks its value.
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 clear input field with id "([^\"]*)"$/ do |view_id|
70
- Finds the input field with id `view_id` and clears the text from it.
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
- To open the menu and press the specified text
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
- To drag from one point on the screen to another.
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
- Then /^I drag from (\d+):(\d+) to (\d+):(\d+) moving with (\d+) steps$/
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
- Given /^I press the "([^\"]*)" button$/
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
- Presses the button by index.
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
- Presses the image button by index.
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
- Will look for a view in the following order:
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
- If a view is found we will try to click it.
129
+ Then /^I touch the "([^\"]*)" text$/ do |text|
130
+ Taps the specified text.
146
131
 
147
- Then /^I touch the "([^\"]*)" text$/
148
- Will look for the specified text and press it if found.
132
+ Then /^I press list item number (\d+)$/ do |index|
133
+ **This predefined step is deprecated**
149
134
 
150
- Then /^I press list item number (\d+)$/
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
- Will long press the specified list item in the first visible list.
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
- Simulates a touch on the screen at the specified location.
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 till there is no more progress bars.
149
+ Will wait until there are no more progress bars.
165
150
 
166
- Then /^I wait for dialog to close$/
167
- Waits for the current dialog to close.
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 with the specified text to appear.
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 |text|
185
- Waits for a view view that id to appear.
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
-
@@ -461,8 +461,8 @@ module Operations
461
461
 
462
462
  def connected_devices
463
463
  lines = `#{Env.adb_path} devices`.split("\n")
464
- lines.shift
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(text, options={})
842
+ def select_options_menu_item(identifier, options={})
835
843
  press_menu_button
836
- tap_when_element_exists("DropDownListView * marked:'#{text}'", options)
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 |text_to_press, index|
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 '#{text_to_press}'}")
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 |text_to_press, context_text|
8
+ Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |text, identifier|
11
9
  step_deprecated
12
10
 
13
- long_press_when_element_exists("* {text CONTAINS '#{text_to_press}'}")
14
- tap_when_element_exists("com.android.internal.view.menu.ListMenuItemView android.widget.TextView marked:'#{context_text}'")
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 |text_to_press|
18
- long_press_when_element_exists("* {text CONTAINS '#{text_to_press}'}")
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:'#{content_description}'", text)
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 |name|
18
- clear_text("android.widget.EditText marked:'#{name}'}")
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 |number|
22
- clear_text("android.widget.EditText index:#{number.to_i-1}")
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 |view_id|
26
- clear_text("android.widget.EditText id:'#{view_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 |text|
23
- select_options_menu_item(text)
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 |fromX, fromY, toX, toY, steps|
44
- perform_action('drag',fromX,toX,fromY,toY,steps)
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 |button_text|
2
- tap_when_element_exists("android.widget.Button {text CONTAINS[c] '#{button_text}'}")
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 |button_number|
6
- tap_when_element_exists("android.widget.Button index:#{button_number.to_i-1}")
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 |button_number|
10
- tap_when_element_exists("android.widget.ImageButton index:#{button_number.to_i-1}")
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 |view_id|
14
- tap_when_element_exists("* id:'#{view_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 LIKE[c] '#{text}'}")
26
+ tap_when_element_exists("* {text CONTAINS[c] '#{text}'}")
27
27
  end
28
28
 
29
- Then /^I press list item number (\d+)$/ do |line_index|
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:#{line_index.to_i-1}")
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 |line_index|
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:#{line_index.to_i-1}")
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", :timeout => 60)
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 |text|
39
- wait_for_element_exists("android.widget.Button marked:'#{text}'");
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}'", {:timeout => 60})
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 |text|
52
- wait_for_activity(text)
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, text|
56
- wait_for_activity(text, timeout: timeout.to_i)
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, text|
60
- wait_for_activity(text, timeout: timeout.to_i)
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 | tab |
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 |item_text, spinner_identifier|
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:'#{item_text}'")
10
+ tap_when_element_exists("android.widget.PopupWindow$PopupViewContainer * marked:'#{item_identifier}'")
11
11
  end
@@ -1,5 +1,5 @@
1
1
  module Calabash
2
2
  module Android
3
- VERSION = "0.5.0.pre1"
3
+ VERSION = "0.5.0.pre2"
4
4
  end
5
5
  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.pre1
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-17 00:00:00.000000000 Z
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