Module: Calabash::Cucumber::Operations
Constant Summary
Constants included
from Core
Core::CAL_HTTP_RETRY_COUNT, Core::DATA_PATH, Core::RETRYABLE_ERRORS
KeyboardHelpers::KEYPLANE_NAMES
Constants included
from WaitHelpers
WaitHelpers::CALABASH_CONDITIONS
Instance Method Summary
collapse
Methods included from Location
#location_for_place, #set_location
Methods included from Core
#backdoor, #background, #calabash_exit, #cell_swipe, #client_version, #current_rotation, #http, #init_request, #interpolate, #load_playback_data, #load_recording, #macro, #make_http_request, #map, #move_wheel, #perform, #picker, #pinch, #playback, #prepare_dialog_action, #query, #query_all, #record_begin, #record_end, #recording_name_for, #rotate, #scroll, #scroll_to_cell, #scroll_to_row, #send_uia_command, #server_version, #start_app_in_background, #stop_background_app, #swipe, #touch, #url_for
#_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_none_animating, #wait_for_transition, #wait_poll
Instance Method Details
#assert_home_direction(expected) ⇒ Object
43
44
45
46
47
|
# File 'lib/calabash-cucumber/operations.rb', line 43
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
35
36
37
|
# File 'lib/calabash-cucumber/operations.rb', line 35
def await_page(clz,*args)
clz.new(self,*args).await
end
|
#escape_quotes(str) ⇒ Object
49
50
51
|
# File 'lib/calabash-cucumber/operations.rb', line 49
def escape_quotes(str)
str.gsub("'", "\\\\'")
end
|
#home_direction ⇒ Object
39
40
41
|
# File 'lib/calabash-cucumber/operations.rb', line 39
def home_direction
@current_rotation = @current_rotation || :down
end
|
#html(q) ⇒ Object
68
69
70
|
# File 'lib/calabash-cucumber/operations.rb', line 68
def html(q)
query(q).map { |e| e['html'] }
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
31
32
33
|
# File 'lib/calabash-cucumber/operations.rb', line 31
def page(clz,*args)
clz.new(self,*args)
end
|
#set_text(uiquery, txt) ⇒ Object
72
73
74
75
76
|
# File 'lib/calabash-cucumber/operations.rb', line 72
def set_text(uiquery, txt)
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
79
80
81
82
83
84
85
86
87
88
|
# File 'lib/calabash-cucumber/operations.rb', line 79
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
60
61
62
|
# File 'lib/calabash-cucumber/operations.rb', line 60
def simple_touch(label, *args)
touch("view marked:'#{label}'", *args)
end
|
#tap(label, *args) ⇒ Object
64
65
66
|
# File 'lib/calabash-cucumber/operations.rb', line 64
def tap(label, *args)
simple_touch(label, *args)
end
|
#user_pref(key) ⇒ Object
90
91
92
93
94
95
96
97
98
99
|
# File 'lib/calabash-cucumber/operations.rb', line 90
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
|