calabash-android 0.4.22.pre4 → 0.5.0.pre1

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.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/bin/calabash-android +66 -45
  3. data/lib/calabash-android/calabash_steps.rb +0 -8
  4. data/lib/calabash-android/canned_steps.md +2 -30
  5. data/lib/calabash-android/lib/TestServer.apk +0 -0
  6. data/lib/calabash-android/operations.rb +199 -23
  7. data/lib/calabash-android/removed_actions.txt +52 -0
  8. data/lib/calabash-android/steps/assert_steps.rb +9 -24
  9. data/lib/calabash-android/steps/check_box_steps.rb +2 -2
  10. data/lib/calabash-android/steps/context_menu_steps.rb +11 -4
  11. data/lib/calabash-android/steps/date_picker_steps.rb +2 -2
  12. data/lib/calabash-android/steps/enter_text_steps.rb +13 -13
  13. data/lib/calabash-android/steps/l10n_steps.rb +5 -5
  14. data/lib/calabash-android/steps/map_steps.rb +12 -12
  15. data/lib/calabash-android/steps/navigation_steps.rb +12 -12
  16. data/lib/calabash-android/steps/press_button_steps.rb +16 -12
  17. data/lib/calabash-android/steps/progress_steps.rb +19 -22
  18. data/lib/calabash-android/steps/search_steps.rb +2 -2
  19. data/lib/calabash-android/steps/spinner_steps.rb +10 -2
  20. data/lib/calabash-android/steps/time_picker_steps.rb +2 -2
  21. data/lib/calabash-android/version.rb +1 -1
  22. data/lib/calabash-android/wait_helpers.rb +29 -1
  23. data/test-server/instrumentation-backend/antlr/UIQuery.g +11 -11
  24. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/CalabashInstrumentationTestRunner.java +3 -2
  25. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/InstrumentationBackend.java +9 -4
  26. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/Result.java +16 -12
  27. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/application/Backdoor.java +55 -0
  28. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/gestures/LongPressCoordinate.java +19 -2
  29. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/JavaScriptExecuter.java +105 -0
  30. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/QueryHelper.java +27 -30
  31. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ViewMapper.java +27 -18
  32. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/ComparisonOperator.java +7 -1
  33. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTPredicate.java +16 -4
  34. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryASTWith.java +13 -6
  35. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/query/ast/UIQueryUtils.java +94 -48
  36. metadata +5 -59
  37. data/lib/calabash-android/steps/additions_manual_steps.rb +0 -11
  38. data/lib/calabash-android/steps/app_steps.rb +0 -10
  39. data/lib/calabash-android/steps/list_steps.rb +0 -41
  40. data/lib/calabash-android/steps/rotation_steps.rb +0 -7
  41. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonNumber.java +0 -22
  42. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressButtonText.java +0 -27
  43. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonDescription.java +0 -39
  44. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/PressImageButtonNumber.java +0 -22
  45. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/button/WaitForButton.java +0 -47
  46. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/checkbox/ToggleCheckboxNumber.java +0 -22
  47. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressText.java +0 -22
  48. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuById.java +0 -26
  49. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByIndex.java +0 -22
  50. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/contextmenu/LongPressTextAndSelectFromMenuByText.java +0 -26
  51. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/helpers/InspectCurrentDialog.java +0 -76
  52. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListData.java +0 -85
  53. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListItemProperties.java +0 -194
  54. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/GetListItemText.java +0 -136
  55. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/LongPressListItems.java +0 -22
  56. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/list/PressListItems.java +0 -22
  57. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollDown.java +0 -22
  58. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/scrolling/ScrollUp.java +0 -22
  59. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/search/EnterQueryByIndex.java +0 -29
  60. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/softkey/SelectFromMenuByText.java +0 -24
  61. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/GetSelectedSpinnerItemText.java +0 -36
  62. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/spinner/SelectSpinnerItemByContentDescription.java +0 -43
  63. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/AssertGridViewContainsNoDuplicates.java +0 -72
  64. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/AssertText.java +0 -31
  65. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/AssertTextOfSpecificTextViewByContentDescription.java +0 -32
  66. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClearTextById.java +0 -30
  67. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClearTextByIndex.java +0 -22
  68. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClearTextFieldByContentDescription.java +0 -33
  69. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/ClickOnText.java +0 -22
  70. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/EnterTextByContentDescription.java +0 -32
  71. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/EnterTextById.java +0 -33
  72. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/EnterTextByIndex.java +0 -22
  73. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/text/GetTextById.java +0 -42
  74. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/AssertViewProperty.java +0 -141
  75. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewByDescription.java +0 -46
  76. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/ClickOnViewById.java +0 -56
  77. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/GetViewProperty.java +0 -101
  78. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/HasView.java +0 -31
  79. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/IsEnabled.java +0 -30
  80. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/LongPressOnViewById.java +0 -34
  81. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/Press.java +0 -89
  82. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/view/SelectTab.java +0 -110
  83. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/Wait.java +0 -24
  84. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForDialogClose.java +0 -21
  85. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForProgress.java +0 -47
  86. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForScreen.java +0 -54
  87. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForTab.java +0 -108
  88. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java +0 -37
  89. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForView.java +0 -43
  90. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForViewById.java +0 -58
  91. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/JavaScriptOperation.java +0 -44
  92. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/PressByCssSelector.java +0 -70
  93. data/test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/webview/SetText.java +0 -64
@@ -0,0 +1,52 @@
1
+ inspect_current_dialog
2
+ assert_view_property
3
+ get_view_property
4
+ press_image_button_description
5
+ press_image_button_number
6
+ click_on_view_by_id
7
+ wait
8
+ wait_for_text
9
+ wait_for_no_progress_bars
10
+ press_button_with_text
11
+ press_button_number
12
+ wait_for_view_by_id
13
+ toggle_numbered_checkbox
14
+ has_view
15
+ is_enabled
16
+ wait_for_button
17
+ wait_for_view
18
+ press
19
+ click_on_text
20
+ click_on_view_by_description
21
+ press_long_on_text
22
+ get_text_by_id
23
+ click_by_selector
24
+ select_item_from_named_spinner
25
+ get_selected_spinner_item_text
26
+ press_list_item
27
+ long_press_list_item
28
+ get_list_data
29
+ get_list_item_text
30
+ get_list_item_properties
31
+ press_long_on_text_and_select_with_index
32
+ press_long_on_text_and_select_with_text
33
+ assert_text
34
+ assert_text_in_textview
35
+ long_press_on_view_by_id
36
+ press_long_on_text_and_select_with_id
37
+ enter_query_into_numbered_field
38
+ select_from_menu
39
+ clear_id_field
40
+ clear_numbered_field
41
+ clear_named_field
42
+ enter_text_into_named_field
43
+ enter_text_into_id_field
44
+ enter_text_into_numbered_field
45
+ assert_no_duplicates_in_grid
46
+ select_tab
47
+ wait_for_dialog_to_close
48
+ wait_for_screen
49
+ wait_for_tab
50
+ set_text
51
+ scroll_down
52
+ scroll_up
@@ -1,44 +1,29 @@
1
1
  Then /^I see the text "([^\"]*)"$/ do |text|
2
- performAction('assert_text',text, true)
2
+ wait_for_text(text, timeout: 10)
3
3
  end
4
4
 
5
5
  Then /^I see "([^\"]*)"$/ do |text|
6
- performAction('assert_text', text, true)
6
+ wait_for_text(text, timeout: 10)
7
7
  end
8
8
 
9
9
  Then /^I should see "([^\"]*)"$/ do |text|
10
- performAction('assert_text', text, true)
10
+ wait_for_text(text, timeout: 10)
11
11
  end
12
12
 
13
13
  Then /^I should see text containing "([^\"]*)"$/ do |text|
14
- performAction('assert_text', text, true)
14
+ wait_for_text(text, timeout: 10)
15
15
  end
16
16
 
17
17
 
18
18
 
19
19
  Then /^I should not see "([^\"]*)"$/ do |text|
20
- performAction('assert_text', text, false) #second param indicated that the text should _not_ be found
20
+ wait_for_text_to_disappear(text, timeout: 10)
21
21
  end
22
22
 
23
-
24
- Then /^I don't see the text "([^\"]*)"$/ do |text|
25
- performAction('assert_text', text, false) #second param indicated that the text should _not_ be found
26
- end
27
-
28
- Then /^I don't see "([^\"]*)"$/ do |text|
29
- performAction('assert_text', text, false) #second param indicated that the text should _not_ be found
23
+ Then /^I don't see the text "([^\"]*)"$/ do |text|
24
+ wait_for_text_to_disappear(text, timeout: 10)
30
25
  end
31
26
 
32
- # This step is more of an example or macro to be used within your own custom steps
33
- # Generally, assert_view_property takes 3 args, but for if 'property'='compoundDrawables', the next arg should be 'left'/'right'/'top'/'bottom', followed by the expected drawable ID.
34
- # @param view_id - the name of the view, eg: R.my_view_id
35
- # @param property - eg: 'visibility' (visible/invisible/gone), 'drawable' (expected drawable ID)
36
- Then /^the view with id "([^\"]*)" should have property "([^\"]*)" = "([^\"]*)"$/ do | view_id, property, value |
37
- # get_view_property is also available: performAction( 'get_view_property', 'my_view', 'visibility')
38
- performAction( 'assert_view_property', view_id, property, value )
27
+ Then /^I don't see "([^\"]*)"$/ do |text|
28
+ wait_for_text_to_disappear(text, timeout: 10)
39
29
  end
40
-
41
- Then /^the "([^\"]*)" activity should be open$/ do | expected_activity |
42
- actual_activity = performAction('get_activity_name')['message']
43
- raise "The current activity is #{actual_activity}" unless( actual_activity == expected_activity || actual_activity == expected_activity + 'Activity' )
44
- end
@@ -1,3 +1,3 @@
1
- Then /^I toggle checkbox number (\d+)$/ do |checkboxNumber|
2
- performAction('toggle_numbered_checkbox', checkboxNumber)
1
+ Then /^I toggle checkbox number (\d+)$/ do |index|
2
+ tap_when_element_exists("android.widget.CheckBox index:#{index.to_i-1}")
3
3
  end
@@ -1,12 +1,19 @@
1
+ Then /^I long press "([^\"]*)" and select item number (\d+)$/ do |text_to_press, index|
2
+ step_deprecated
1
3
 
2
- Then /^I long press "([^\"]*)" and select item number "([^\"]*)"$/ do |text_to_press, index|
3
- performAction('press_long_on_text_and_select_with_index', text_to_press, index)
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
8
  end
5
9
 
6
10
  Then /^I long press "([^\"]*)" and select "([^\"]*)"$/ do |text_to_press, context_text|
7
- performAction('press_long_on_text_and_select_with_text', text_to_press, context_text)
11
+ step_deprecated
12
+
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}'")
8
15
  end
9
16
 
10
17
  Then /^I long press "([^\"]*)"$/ do |text_to_press|
11
- performAction('press_long_on_text', text_to_press)
18
+ long_press_when_element_exists("* {text CONTAINS '#{text_to_press}'}")
12
19
  end
@@ -1,8 +1,8 @@
1
1
 
2
2
  Given /^I set the date to "(\d\d-\d\d-\d\d\d\d)" on DatePicker with index "([^\"]*)"$/ do |date, index|
3
- performAction('set_date_with_index', date, index)
3
+ perform_action('set_date_with_index', date, index)
4
4
  end
5
5
 
6
6
  Given /^I set the "([^\"]*)" date to "(\d\d-\d\d-\d\d\d\d)"$/ do |content_description, date|
7
- performAction('set_date_with_description', content_description, date)
7
+ perform_action('set_date_with_description', content_description, date)
8
8
  end
@@ -1,27 +1,27 @@
1
- Then /^I enter "([^\"]*)" as "([^\"]*)"$/ do |text, target|
2
- performAction('enter_text_into_named_field', text, target)
1
+ Then /^I enter "([^\"]*)" as "([^\"]*)"$/ do |text, content_description|
2
+ enter_text("android.widget.EditText contentDescription:'#{content_description}'", text)
3
3
  end
4
4
 
5
- Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, number|
6
- performAction('enter_text_into_numbered_field',text, number)
5
+ Then /^I enter "([^\"]*)" into "([^\"]*)"$/ do |text, content_description|
6
+ enter_text("android.widget.EditText {contentDescription LIKE[c] '#{content_description}'}", text)
7
7
  end
8
8
 
9
- Then /^I enter "([^\"]*)" into "([^\"]*)"$/ do |text, name|
10
- performAction('enter_text_into_named_field',text, name)
9
+ Then /^I enter "([^\"]*)" into input field number (\d+)$/ do |text, index|
10
+ enter_text("android.widget.EditText index:#{index.to_i-1}", text)
11
+ end
12
+
13
+ Then /^I enter text "([^\"]*)" into field with id "([^\"]*)"$/ do |text, id|
14
+ enter_text("android.widget.EditText id:'#{id}'", text)
11
15
  end
12
16
 
13
17
  Then /^I clear "([^\"]*)"$/ do |name|
14
- performAction('clear_named_field',name)
18
+ clear_text("android.widget.EditText marked:'#{name}'}")
15
19
  end
16
20
 
17
21
  Then /^I clear input field number (\d+)$/ do |number|
18
- performAction('clear_numbered_field',number)
22
+ clear_text("android.widget.EditText index:#{number.to_i-1}")
19
23
  end
20
24
 
21
25
  Then /^I clear input field with id "([^\"]*)"$/ do |view_id|
22
- performAction('clear_id_field', view_id)
23
- end
24
-
25
- Then /^I enter text "([^\"]*)" into field with id "([^\"]*)"$/ do |text, view_id|
26
- performAction('enter_text_into_id_field', text, view_id)
26
+ clear_text("android.widget.EditText id:'#{view_id}'")
27
27
  end
@@ -1,19 +1,19 @@
1
1
  Then /^I press text of translated l10key (\d+)$/ do |l10key|
2
- performAction('press_l10n_element', l10key)
2
+ perform_action('press_l10n_element', l10key)
3
3
  end
4
4
 
5
5
  Then /^I press button of translated l10key (\d+)$/ do |l10key|
6
- performAction('press_l10n_element', l10key,'button')
6
+ perform_action('press_l10n_element', l10key,'button')
7
7
  end
8
8
 
9
9
  Then /^I press menu item of translated l10key (\d+)$/ do |l10key|
10
- performAction('press_l10n_element', l10key,'menu_item')
10
+ perform_action('press_l10n_element', l10key,'menu_item')
11
11
  end
12
12
 
13
13
  Then /^I press toggle button of translated l10key (\d+)$/ do |l10key|
14
- performAction('press_l10n_element', l10key,'toggle_button')
14
+ perform_action('press_l10n_element', l10key,'toggle_button')
15
15
  end
16
16
 
17
17
  Then /^I wait for the translated "([^\"]*)" l10nkey to appear$/ do |l10nkey|
18
- performAction('wait_for_l10n_element', l10nkey)
18
+ perform_action('wait_for_l10n_element', l10nkey)
19
19
  end
@@ -1,39 +1,39 @@
1
1
  When /^I centre the map at (-?\d+\.\d+), (-?\d+\.\d+)$/ do | lat, lon |
2
- performAction('set_map_center', lat, lon)
2
+ perform_action('set_map_center', lat, lon)
3
3
  end
4
4
 
5
5
  When /^I pan the map to (-?\d+\.\d+), (-?\d+\.\d+)$/ do | lat, lon |
6
- performAction('pan_map_to', lat, lon)
7
- performAction('wait', 1)
6
+ perform_action('pan_map_to', lat, lon)
7
+ sleep(1)
8
8
  end
9
9
 
10
10
  When /^(?:I )?set the map zoom level to (\d+)$/ do | zoom |
11
- performAction('set_map_zoom', zoom)
11
+ perform_action('set_map_zoom', zoom)
12
12
  sleep(0.2)
13
13
  end
14
14
 
15
15
  When /^(?:I )?zoom (in|out) on the map$/ do | zoom |
16
- performAction('set_map_zoom', zoom)
16
+ perform_action('set_map_zoom', zoom)
17
17
  sleep(0.2)
18
18
  end
19
19
 
20
20
  Then /^the map zoom level should be (\d+)$/ do | zoom |
21
- result = performAction('get_map_zoom')
21
+ result = perform_action('get_map_zoom')
22
22
  raise StandardError.new( "The map's zoom level should be #{zoom} but is #{result['message']}" ) unless zoom.eql?( result['message'] )
23
23
  end
24
24
 
25
25
  When /^I tap the map marker "([^\"]*)"$/ do | marker_title |
26
- performAction('tap_map_marker_by_title', marker_title, 60000)
26
+ perform_action('tap_map_marker_by_title', marker_title, 60000)
27
27
  end
28
28
 
29
29
  When /^I double tap the map marker "([^\"]*)"$/ do | marker_title |
30
- performAction('tap_map_marker_by_title', marker_title, 60000)
30
+ perform_action('tap_map_marker_by_title', marker_title, 60000)
31
31
  sleep(0.4)
32
- performAction('tap_map_marker_by_title', marker_title, 100)
32
+ perform_action('tap_map_marker_by_title', marker_title, 100)
33
33
  end
34
34
 
35
35
  When /^I tap away from the markers$/ do
36
- performAction('tap_map_away_from_markers')
36
+ perform_action('tap_map_away_from_markers')
37
37
  end
38
38
 
39
39
  Then /^I should see the following markers:$/ do | marker_table |
@@ -41,7 +41,7 @@ Then /^I should see the following markers:$/ do | marker_table |
41
41
  end
42
42
 
43
43
  Then /^the map should be centred at (-?\d+\.\d+), (-?\d+\.\d+)$/ do | lat, lon |
44
- result = performAction('get_map_center')
44
+ result = perform_action('get_map_center')
45
45
  bonus_info = result['bonusInformation']
46
46
  actual_lat = bonus_info[0].to_f
47
47
  actual_lon = bonus_info[1].to_f
@@ -54,7 +54,7 @@ Then /^the map should be centred at (-?\d+\.\d+), (-?\d+\.\d+)$/ do | lat, lon |
54
54
  end
55
55
 
56
56
  Then /^the map marker "([^\"]*)" should be highlighted$/ do | marker_title |
57
- result = performAction('get_map_marker', marker_title)
57
+ result = perform_action('get_map_marker', marker_title)
58
58
  result = result['message']
59
59
  result = JSON.parse( result )
60
60
  raise StandardError.new( "The marker '#{marker_title}' was found, but is not highlighted" ) unless result['focused']
@@ -1,46 +1,46 @@
1
1
  Then /^I go back$/ do
2
- performAction('go_back')
2
+ press_back_button
3
3
  end
4
4
 
5
5
  Then /^I press the menu key$/ do
6
- performAction('press_menu')
6
+ press_menu_button
7
7
  end
8
8
 
9
9
  Then /^I press the enter button$/ do
10
- performAction('send_key_enter')
10
+ perform_action('send_key_enter')
11
11
  end
12
12
 
13
13
 
14
14
  Then /^I swipe left$/ do
15
- performAction('swipe', 'left')
15
+ perform_action('swipe', 'left')
16
16
  end
17
17
 
18
18
  Then /^I swipe right$/ do
19
- performAction('swipe', 'right')
19
+ perform_action('swipe', 'right')
20
20
  end
21
21
 
22
- Then /^I select "([^\"]*)" from the menu$/ do |item|
23
- performAction('select_from_menu', item)
22
+ Then /^I select "([^\"]*)" from the menu$/ do |text|
23
+ select_options_menu_item(text)
24
24
  end
25
25
 
26
26
  Then /^I select tab number (\d+)$/ do | tab |
27
- performAction('select_tab', tab)
27
+ touch("android.widget.TabWidget descendant TextView index:#{tab.to_i-1}")
28
28
  end
29
29
 
30
30
  # @param - the "tag" associated with the tab, or the text within the tab label
31
31
  Then /^I select the "([^\"]*)" tab$/ do | tab |
32
- performAction('select_tab', tab)
32
+ touch("android.widget.TabWidget descendant TextView {text LIKE[c] '#{tab}'}")
33
33
  end
34
34
 
35
35
  Then /^I scroll down$/ do
36
- performAction('scroll_down')
36
+ scroll_down
37
37
  end
38
38
 
39
39
  Then /^I scroll up$/ do
40
- performAction('scroll_up')
40
+ scroll_up
41
41
  end
42
42
 
43
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)
44
+ perform_action('drag',fromX,toX,fromY,toY,steps)
45
45
  end
46
46
 
@@ -1,35 +1,39 @@
1
- Given /^I press the "([^\"]*)" button$/ do |buttonText|
2
- performAction('press_button_with_text', buttonText)
1
+ Given /^I press the "([^\"]*)" button$/ do |button_text|
2
+ tap_when_element_exists("android.widget.Button {text CONTAINS[c] '#{button_text}'}")
3
3
  end
4
4
 
5
- Then /^I press button number (\d+)$/ do |buttonNumber|
6
- performAction('press_button_number', buttonNumber)
5
+ Then /^I press button number (\d+)$/ do |button_number|
6
+ tap_when_element_exists("android.widget.Button index:#{button_number.to_i-1}")
7
7
  end
8
8
 
9
- Then /^I press image button number (\d+)$/ do |buttonNumber|
10
- performAction('press_image_button_number', buttonNumber)
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}")
11
11
  end
12
12
 
13
13
  Then /^I press view with id "([^\"]*)"$/ do |view_id|
14
- performAction('click_on_view_by_id',view_id)
14
+ tap_when_element_exists("* id:'#{view_id}'")
15
15
  end
16
16
 
17
17
  Then /^I press "([^\"]*)"$/ do |identifier|
18
- performAction('press',identifier)
18
+ tap_when_element_exists("* marked:'#{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
- performAction('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
- performAction('click_on_text',text)
26
+ tap_when_element_exists("* {text LIKE[c] '#{text}'}")
27
27
  end
28
28
 
29
29
  Then /^I press list item number (\d+)$/ do |line_index|
30
- performAction('press_list_item', line_index, 0)
30
+ step_deprecated
31
+
32
+ tap_when_element_exists("android.widget.ListView index:0 android.widget.TextView index:#{line_index.to_i-1}")
31
33
  end
32
34
 
33
35
  Then /^I long press list item number (\d+)$/ do |line_index|
34
- performAction('long_press_list_item', line_index, 0)
36
+ step_deprecated
37
+
38
+ long_press_when_element_exists("android.widget.ListView index:0 android.widget.TextView index:#{line_index.to_i-1}")
35
39
  end
@@ -1,71 +1,68 @@
1
1
  Then /^I wait for progress$/ do
2
- performAction('wait_for_no_progress_bars')
2
+ wait_for_element_do_not_exist("android.widget.ProgressBar", :timeout => 60)
3
3
  end
4
4
 
5
5
  Then /^I wait$/ do
6
- performAction('wait', 2)
7
- end
8
-
9
- Then /^I wait for dialog to close$/ do
10
- performAction('wait_for_dialog_to_close')
6
+ sleep 2
11
7
  end
12
8
 
13
9
 
14
10
  Then /^I wait for (\d+) seconds$/ do |seconds|
15
- performAction('wait', seconds)
11
+ sleep(seconds.to_i)
16
12
  end
17
13
 
18
14
  Then /^I wait for 1 second$/ do
19
- performAction('wait', 1)
15
+ sleep 1
20
16
  end
21
17
 
22
18
  Then /^I wait for a second$/ do
23
- performAction('wait', 1)
19
+ sleep 1
24
20
  end
25
21
 
26
-
27
22
  Then /^I wait for "([^\"]*)" to appear$/ do |text|
28
- performAction('wait_for_text', text)
23
+ wait_for_text(text)
29
24
  end
30
25
 
31
26
  Then /^I wait up to (\d+) seconds for "([^\"]*)" to appear$/ do |timeout, text|
32
- performAction('wait_for_text', text, timeout)
27
+ wait_for_text(text, timeout: timeout.to_i)
33
28
  end
34
29
 
35
30
  Then /^I wait to see "([^\"]*)"$/ do |text|
36
- performAction('wait_for_text', text)
31
+ wait_for_text(text)
37
32
  end
38
33
 
39
34
  Then /^I wait up to (\d+) seconds to see "([^\"]*)"$/ do |timeout, text|
40
- performAction('wait_for_text', text, timeout)
35
+ wait_for_text(text, timeout: timeout.to_i)
41
36
  end
42
37
 
43
38
  Then /^I wait for the "([^\"]*)" button to appear$/ do |text|
44
- performAction('wait_for_button', text)
39
+ wait_for_element_exists("android.widget.Button marked:'#{text}'");
45
40
  end
46
41
 
47
- Then /^I wait for the view with id "([^\"]*)" to appear$/ do |text|
48
- performAction('wait_for_view_by_id', text)
42
+ Then /^I wait for the view with id "([^\"]*)" to appear$/ do |id|
43
+ wait_for_element_exists("* id:'#{id}'", {:timeout => 60})
49
44
  end
50
45
 
51
46
  Then /^I wait for the "([^\"]*)" view to appear$/ do |text|
52
- performAction('wait_for_view', text)
47
+ wait_for_element_exists("* marked:'#{text}'")
53
48
  end
54
49
 
55
50
 
56
51
  Then /^I wait for the "([^\"]*)" screen to appear$/ do |text|
57
- performAction('wait_for_screen', text)
52
+ wait_for_activity(text)
58
53
  end
59
54
 
60
55
  Then /^I wait upto (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout, text|
61
- performAction('wait_for_screen', text, timeout)
56
+ wait_for_activity(text, timeout: timeout.to_i)
62
57
  end
63
58
 
64
59
  Then /^I wait up to (\d+) seconds for the "([^\"]*)" screen to appear$/ do |timeout, text|
65
- performAction('wait_for_screen', text, timeout)
60
+ wait_for_activity(text, timeout: timeout.to_i)
66
61
  end
67
62
 
68
63
  # @param - the "tag" associated with the tab, or the text within the tab label
69
64
  Then /^I wait for the "([^\"]*)" tab to appear$/ do | tab |
70
- performAction('wait_for_tab', tab)
65
+ wait_for do
66
+ query("android.widget.TabWidget descendant TextView {text LIKE[c] '#{tab}'}", :isSelected).first
67
+ end
71
68
  end