Module: Calabash::Cucumber::Operations
Constant Summary
Constants included
from DatePicker
DatePicker::OBJC_DATE_AND_TIME_FMT, DatePicker::RUBY_DATE_AND_TIME_FMT, DatePicker::UI_DATE_PICKER_MODE_COUNT_DOWN_TIMER, DatePicker::UI_DATE_PICKER_MODE_DATE, DatePicker::UI_DATE_PICKER_MODE_DATE_AND_TIME, DatePicker::UI_DATE_PICKER_MODE_TIME
Constants included
from Core
Core::CAL_HTTP_RETRY_COUNT, Core::DATA_PATH, Core::RETRYABLE_ERRORS
KeyboardHelpers::IOS7_SUPPORTED_CHARS, KeyboardHelpers::KEYPLANE_NAMES
Constants included
from WaitHelpers
WaitHelpers::CALABASH_CONDITIONS
Instance Method Summary
collapse
Methods included from DatePicker
#args_for_change_date_on_picker, #countdown_mode?, #date_and_time_mode?, #date_mode?, #date_picker_mode, #date_time_from_picker, #maximum_date_time_from_picker, #minimum_date_time_from_picker, #picker_set_date_time, #query_string_for_picker, #should_see_date_picker, #time_mode?
Methods included from Core
#backdoor, #calabash_exit, #cell_swipe, #client_version, #default_device, #device_orientation, #do_touch, #find_compatible_recording, #flash, #http, #init_request, #interpolate, #load_playback_data, #load_recording, #macro, #make_http_request, #map, #move_wheel, #pan, #perform, #picker, #pinch, #playback, #playback_file_directories, #point_from, #query, #query_all, #record_begin, #record_end, #recording_name_for, #rotate, #rotate_home_button_to, #rotation_candidates, #scroll, #scroll_to_cell, #scroll_to_row, #scroll_to_row_with_mark, #send_app_to_background, #server_version, #start_test_server_in_background, #status_bar_orientation, #stop_test_server, #swipe, #touch, #url_for
#find_or_raise, #ios7?, #normalize_rect_for_orientation, #pan_ios7, #pinch_ios7, #swipe_ios7, #touch_ios7
Methods included from UIA
#escape_uia_string, #send_uia_command, #uia_element_does_not_exist?, #uia_element_exists?, #uia_enter, #uia_handle_command, #uia_names, #uia_pan, #uia_pan_offset, #uia_pinch, #uia_pinch_offset, #uia_query, #uia_screenshot, #uia_scroll_to, #uia_send_app_to_background, #uia_set_location, #uia_swipe, #uia_swipe_offset, #uia_tap, #uia_tap_mark, #uia_tap_offset, #uia_type_string
Methods included from Location
#location_for_place, #set_location
#_do_keyplane, #await_keyboard, #current_keyplane, #done, #keyboard_enter_char, #keyboard_enter_text, #search_keyplanes_and_enter_char
#check_element_does_not_exist, #check_element_exists, #check_view_with_mark_exists, #classes, #each_cell, #each_cell_and_back, #element_does_not_exist, #element_exists, #fail, #navigation_path, #query_map, #screenshot, #screenshot_and_raise, #screenshot_embed, #view_with_mark_exists
#handle_error_with_options, #touch_transition, #wait_for, #wait_for_condition, #wait_for_elements_do_not_exist, #wait_for_elements_exist, #wait_for_no_network_indicator, #wait_for_none_animating, #wait_for_transition, #wait_poll
Instance Method Details
#assert_home_direction(expected) ⇒ Object
44
45
46
47
48
|
# File 'lib/calabash-cucumber/operations.rb', line 44
def assert_home_direction(expected)
unless expected.to_sym == home_direction
screenshot_and_raise "Expected home button to have direction #{expected} but had #{home_direction}"
end
end
|
#await_page(clz, *args) ⇒ Object
36
37
38
|
# File 'lib/calabash-cucumber/operations.rb', line 36
def await_page(clz,*args)
clz.new(self,*args).await
end
|
#clear_text(uiquery) ⇒ Object
84
85
86
87
88
|
# File 'lib/calabash-cucumber/operations.rb', line 84
def clear_text(uiquery)
views_modified = map(uiquery, :setText, '')
screenshot_and_raise "could not find text field #{uiquery}" if views_modified.empty?
views_modified
end
|
#escape_quotes(str) ⇒ Object
50
51
52
|
# File 'lib/calabash-cucumber/operations.rb', line 50
def escape_quotes(str)
str.gsub("'", "\\\\'")
end
|
#home_direction ⇒ Object
40
41
42
|
# File 'lib/calabash-cucumber/operations.rb', line 40
def home_direction
device_orientation().to_sym
end
|
#html(q) ⇒ Object
70
71
72
|
# File 'lib/calabash-cucumber/operations.rb', line 70
def html(q)
query(q).map { |e| e['html'] }
end
|
#identifier(uiquery) ⇒ Object
58
59
60
|
# File 'lib/calabash-cucumber/operations.rb', line 58
def identifier(uiquery)
query(uiquery, :accessibilityIdentifier)
end
|
#label(uiquery) ⇒ Object
54
55
56
|
# File 'lib/calabash-cucumber/operations.rb', line 54
def label(uiquery)
query(uiquery, :accessibilityLabel)
end
|
#page(clz, *args) ⇒ Object
32
33
34
|
# File 'lib/calabash-cucumber/operations.rb', line 32
def page(clz,*args)
clz.new(self,*args)
end
|
#set_text(uiquery, txt) ⇒ Object
74
75
76
77
78
79
80
81
82
|
# File 'lib/calabash-cucumber/operations.rb', line 74
def set_text(uiquery, txt)
unless ENV['CALABASH_NO_DEPRECATION'] == '1'
warn "WARNING: set_text will be deprecated.\n * to enter text using the native keyboard use 'keyboard_enter_text'\n * to clear a text field or text view use 'clear_text'"
warn 'https://github.com/calabash/calabash-ios/wiki/03.5-Calabash-iOS-Ruby-API'
end
text_fields_modified = map(uiquery, :setText, txt)
screenshot_and_raise "could not find text field #{uiquery}" if text_fields_modified.empty?
text_fields_modified
end
|
#set_user_pref(key, val) ⇒ Object
91
92
93
94
95
96
97
98
99
100
|
# File 'lib/calabash-cucumber/operations.rb', line 91
def set_user_pref(key, val)
res = http({:method => :post, :path => 'userprefs'},
{:key=> key, :value => val})
res = JSON.parse(res)
if res['outcome'] != 'SUCCESS'
screenshot_and_raise "set_user_pref #{key} = #{val} failed because: #{res['reason']}\n#{res['details']}"
end
res['results']
end
|
#simple_touch(label, *args) ⇒ Object
62
63
64
|
# File 'lib/calabash-cucumber/operations.rb', line 62
def simple_touch(label, *args)
touch("view marked:'#{label}'", *args)
end
|
#tap(label, *args) ⇒ Object
66
67
68
|
# File 'lib/calabash-cucumber/operations.rb', line 66
def tap(label, *args)
simple_touch(label, *args)
end
|
#user_pref(key) ⇒ Object
102
103
104
105
106
107
108
109
110
111
|
# File 'lib/calabash-cucumber/operations.rb', line 102
def user_pref(key)
res = http({:method => :get, :raw => true, :path => 'userprefs'},
{:key=> key})
res = JSON.parse(res)
if res['outcome'] != 'SUCCESS'
screenshot_and_raise "get user_pref #{key} failed because: #{res['reason']}\n#{res['details']}"
end
res['results'].first
end
|