Top Level Namespace
- Extended by:
- Calabash::Cucumber::Operations
- Includes:
- Briar::Alerts_and_Sheets, Briar::Bars, Briar::Control::Button, Briar::Control::Segmented_Control, Briar::Control::Slider, Briar::Core, Briar::Email, Briar::ImageView, Briar::Keyboard, Briar::Label, Briar::Page::Helpers, Briar::Picker, Briar::Picker::DateCore, Briar::Picker::DateManipulation, Briar::Picker::DateSteps, Briar::Picker_Shared, Briar::Table, Briar::TextField, Briar::TextView, Briar::UIA, Briar::UIAKeyboard, Briar::UIAKeyboard::Language, Briar::UIAKeyboard::Numeric, Calabash::Cucumber::IPad
Defined Under Namespace
Modules: Briar Classes: Array, BriarPage, DateTime, String
Constant Summary collapse
- TOUCH_TRANSITION_TIMEOUT =
will deprecate soon (starting 0.1.3)
30.0
- TOUCH_TRANSITION_RETRY_FREQ =
0.5
- BRIAR_RETRY_FREQ =
see below for replacements
0.1
- BRIAR_POST_TIMEOUT =
0.5
- BRIAR_STEP_PAUSE =
(ENV['STEP_PAUSE'] || 0.5).to_f
- BRIAR_WAIT_TIMEOUT =
we need an insanely long time out because of some changes in 0.9.163
the waits succeed after a short amount of time (visually < 1 sec), but fail if the wait time out is too short (4s)
8 seconds works most of the time 10 seconds seems safe 14 seconds is safe
the problem with a long time out is that during development you want the tests to fail fast.
(ENV['WAIT_TIMEOUT'] || 14.0).to_f
- BRIAR_WAIT_RETRY_FREQ =
(ENV['RETRY_FREQ'] || 0.1).to_f
- BRIAR_WAIT_STEP_PAUSE =
‘post timeout’ is the time to wait after a wait function returns true i think ‘wait step pause’ is a better variable name
(ENV['POST_TIMEOUT'] || 0.5).to_f
- AI =
noinspection RubyConstantNamingConvention
:accessibilityIdentifier
- AL =
noinspection RubyConstantNamingConvention
:accessibilityLabel
- SIM =
Calabash::Cucumber::SimulatorLauncher
- UIDatePickerModeTime =
0
- UIDatePickerModeDate =
1
- UIDatePickerModeDateAndTime =
2
- UIDatePickerModeCountDownTimer =
3
- BRIAR_PICKER_24H_TIME_FMT =
most locales and situations prefer not to have leading zeros on hours in 24h see usage below to find out when and if the zeros are stripped
'%H:%M'
- BRIAR_PICKER_12H_TIME_FMT =
'%l:%M %p'
- BRIAR_TIME_FORMATS =
{:h24 => BRIAR_PICKER_24H_TIME_FMT, :h12 => BRIAR_PICKER_12H_TIME_FMT}
- BRIAR_REMOVE_LEADING_ZERO_REGEX =
/\A^0/
- BRIAR_PICKER_24H_BRIEF_DATE_FMT =
24h locales - Fri 16 Nov - 24h locales
'%a %e %b'
- BRIAR_PICKER_12H_BRIEF_DATE_FMT =
common format for US Fri Nov 16
'%a %b %e'
- BRIAR_DATE_FORMATS =
{:brief_24h => BRIAR_PICKER_24H_BRIEF_DATE_FMT, :brief_12h => BRIAR_PICKER_12H_BRIEF_DATE_FMT}
- BRIAR_PICKER_ISO8601_TIME_FMT =
change_picker_date_time (target_dt, options)
change_time_on_picker_with_time_str (time_str, options) change_time_on_picker_with_time (time, options)
change_date_on_picker_with_date_str (date_str, options) change_date_on_picker_with_date (date, options)
options ==> { # calabash returns dates in terms of the local timezone # sometimes you have pickers (like alarms or reminders) that use utc timezone # WARN: only set this if you need times converted to UTC - if you are in UTC # timezone, don’t set this :convert_time_to_utc => false, # animate the change :animate => true, # optionally pass the picker id :picker_id => nil, # iterate over the picker’s target/action pairs and call them using # performSelector:SEL object:<picker> :notify_targets => true }
'%H:%M'
- BRIAR_PICKER_ISO8601_BRIEF_DATE_FMT =
our canonical format for testing if two dates are the same
'%Y-%m-%d'
- BRIAR_PICKER_ISO8601_BRIEF_DATE_TIME_FMT =
'%Y-%m-%d %H:%M'
- BRIAR_PICKER_RUBY_DATE_AND_TIME_FMT_ZONED =
ex. 2012_11_18_16_45
'%Y_%m_%d_%H_%M_%z'
- BRIAR_PICKER_OBJC_DATE_AND_TIME_FMT_ZONED =
'yyyy_MM_dd_HH_mm_Z'
- BRIAR_PICKER_RUBY_DATE_AND_TIME_FMT =
'%Y_%m_%d_%H_%M'
- BRIAR_PICKER_OBJC_DATE_AND_TIME_FMT =
'yyyy_MM_dd_HH_mm'
- BRIAR_DATE_CONVERSION_FORMATS =
{:objc => {:zoned => BRIAR_PICKER_OBJC_DATE_AND_TIME_FMT_ZONED, :default => BRIAR_PICKER_OBJC_DATE_AND_TIME_FMT}, :ruby => {:zoned => BRIAR_PICKER_RUBY_DATE_AND_TIME_FMT_ZONED, :default => BRIAR_PICKER_RUBY_DATE_AND_TIME_FMT}}
Constants included from Briar::UIAKeyboard::Language
Briar::UIAKeyboard::Language::BRIAR_LANGUAGE_KEYS
Constants included from Briar::Keyboard
Briar::Keyboard::UITextAutocapitalizationTypeAllCharacters, Briar::Keyboard::UITextAutocapitalizationTypeNone, Briar::Keyboard::UITextAutocapitalizationTypeSentences, Briar::Keyboard::UITextAutocapitalizationTypeWords, Briar::Keyboard::UITextAutocorrectionTypeNo, Briar::Keyboard::UITextAutocorrectionTypeYes, Briar::Keyboard::UITextSpellCheckingTypeNo, Briar::Keyboard::UITextSpellCheckingTypeYes
Instance Method Summary collapse
- #accessibility_marks(kind, opts = {}) ⇒ Object
- #briar_message_of_the_day ⇒ Object
-
#embed(x, y = nil, z = nil) ⇒ Object
noinspection RubyUnusedLocalVariable.
- #ids ⇒ Object
- #labels ⇒ Object
- #marks ⇒ Object
- #nbl ⇒ Object
- #print_marks(marks, max_width) ⇒ Object
- #puts_calabash_environment ⇒ Object
- #quiet ⇒ Object
- #row_ids ⇒ Object
- #text ⇒ Object
- #text_marks(opts = {}) ⇒ Object
- #verbose ⇒ Object
-
#World(*world_modules, &proc) ⇒ Object
noinspection RubyUnusedLocalVariable.
Methods included from Briar::Page::Helpers
#cp_is?, #expect_current_page, #expect_current_page_is_one_of
Methods included from Briar::TextView
#should_not_see_text_view, #should_see_text_view, #should_see_text_view_with_text, #text_view_exists?, #wait_for_text_view, #wait_for_text_view_to_disappear
Methods included from Briar::TextField
#button_in_text_field_is_clear?, #clear_text_field_with_button, #should_not_see_clear_button_in_text_field, #should_not_see_text_field, #should_see_clear_button_in_text_field, #should_see_text_field, #should_see_text_field_with_text, #text_field_exists?, #text_field_exists_with_text?
Methods included from Briar::Email
#delete_draft_and_wait_for, #device_can_send_email, #email_body, #email_body_contains?, #email_not_testable?, #email_subject, #email_subject_has_text_like?, #email_subject_is?, #email_testable?, #email_to, #email_to_contains?, #email_to_field_is?, #is_ios5_mail_view, #should_see_mail_view, #should_see_recipients, #uia_send_email_to, #uia_set_email_to, #uia_touch_email_to, #uia_touch_send_email, #warn_about_no_ios5_email_view
Methods included from Briar::UIAKeyboard::Language
#english_keyboard?, #german_keyboard?, #keyboard_has_international?, #romaji_keyboard?, #spacebar_has_label?, #spacebar_label, #touch_international_key, #touch_international_until_language
Methods included from Briar::UIAKeyboard::Numeric
#is_numeric_keyboard?, #keyboard_send_backspace, #keyboard_send_numeric_backspace
Methods included from Briar::Keyboard
#auto_correct_type, #autocapitalization_type, #briar_clear_text, #briar_keyboard_enter_text, #set_autocapitalization, #set_autocorrect, #should_not_see_keyboard, #should_see_keyboard, #turn_autocapitalization_off, #turn_autocorrect_off, #turn_spell_correct_off
Methods included from Briar::Label
#label_exists?, #label_exists_with_text?, #should_not_see_label_with_text, #should_see_label, #should_see_label_with_text, #touch_label, #wait_for_label
Methods included from Briar::ImageView
#image_view_exists?, #should_not_see_image_view, #should_see_image_view, #wait_for_image_view, #wait_for_image_view_to_disappear
Methods included from Briar::Table
#briar_scroll_to_row, #briar_scroll_to_row_and_touch, #delete_row_with_edit_mode_delete_button, #edit_mode_delete_button_exists?, #query_str_for_confirm_delete_in_row, #query_str_for_label_and_text_exists, #query_str_for_row, #query_str_for_row_content, #query_str_for_rows, #query_str_for_table, #reorder_button_exists?, #row_visible?, #row_with_label_and_text_exists?, #should_not_see_delete_confirmation_in_row, #should_not_see_edit_mode_delete_button, #should_not_see_reorder_button, #should_not_see_row, #should_not_see_table, #should_see_delete_confirmation_in_row, #should_see_disclosure_chevron_in_row, #should_see_edit_mode_delete_button, #should_see_reorder_button, #should_see_row, #should_see_row_at_index, #should_see_row_with_image, #should_see_row_with_label_that_has_no_text, #should_see_row_with_label_with_text, #should_see_slider_in_row, #should_see_slider_in_row_with_value, #should_see_switch_in_row_with_state, #should_see_table, #should_see_text_field_in_row_with_text, #swipe_on_row, #swipe_to_delete_row, #table_exists?, #touch_button_in_row, #touch_delete_confirmation, #touch_edit_mode_delete_button, #touch_row, #touch_row_and_wait_to_see, #touch_row_offset_hash, #touch_section_header, #touch_switch_in_row, #touch_text_field_clear_button_in_row, #touch_text_field_in_row_and_wait_for_keyboard, #wait_for_row
Methods included from Briar::UIA
#uia_handle_target_command, #uia_touch_with_options
Methods included from Briar::Core
#default_device_or_create, #device, #error_no_rescue, #send_backdoor_command, #should_not_see_view, #should_see_view, #should_see_view_with_center, #should_see_view_with_frame, #should_see_view_with_text, #step_pause, #step_pause_if_xtc, #tokenize_list, #touch_and_wait_for_view, #touch_and_wait_to_disappear, #touch_custom_view, #touch_custom_view_and_wait_for_view, #touch_view, #touch_view_named, #view_exists?, #view_exists_with_text?, #wait_for_animation, #wait_for_custom_view, #wait_for_query, #wait_for_view, #wait_for_view_to_disappear, #wait_for_views, #wait_opts, #warn_pretty
Methods included from Briar::Picker::DateSteps
#change_minute_interval_on_picker, #change_time_on_picker_to_minutes_before_now, #change_time_on_picker_to_minutes_from_now, #should_see_label_has_time_i_just_entered, #should_see_row_has_label_with_time_on_picker, #should_see_row_has_time_i_just_entered, #should_see_time_on_picker_is_now
Methods included from Briar::Picker::DateManipulation
#args_for_change_date_on_picker, #brief_date_strings_are_equivalent, #brief_date_time_strings_are_equivalent, #change_date_on_picker_with_date, #change_date_on_picker_with_date_str, #change_picker_date_time, #change_time_on_picker_with_time, #change_time_on_picker_with_time_str, #convert_date_time_to_objc_fmt, #date_format_for_target, #ensure_can_change_picker_to_date, #set_briar_date_picker_variables, #target_date_for_change_date_on_picker_with_date, #target_date_for_change_date_on_picker_with_date_str, #target_date_for_change_time_on_picker_with_time, #target_date_for_change_time_on_picker_with_time_str, #time_strings_are_equivalent
Methods included from Briar::Picker::DateCore
#convert_to_utc_from_options, #now_time_12h_locale, #now_time_24h_locale, #now_times_arr, #now_times_map, #picker_brief_date_str, #picker_brief_date_strs_arr, #picker_brief_date_strs_hash, #picker_column_for_period, #picker_id_from_options, #picker_is_in_12h_locale, #picker_is_in_24h_locale, #picker_is_in_countdown_mode, #picker_is_in_date_and_time_mode, #picker_is_in_date_mode, #picker_is_in_time_mode, #picker_maximum_date_time, #picker_minimum_date_time, #picker_minute_interval, #picker_mode, #picker_time_str, #picker_time_strs_arr, #picker_time_strs_hash, #query_string_for_picker, #ruby_time_from_picker, #should_see_date_picker, #time_hash_by_add_minutes_until_at_closest_interval
Methods included from Briar::Picker_Shared
#picker_current_index_for_column, #picker_current_index_for_column_is, #picker_next_index_for_column, #picker_scroll_down_on_column, #picker_scroll_up_on_column, #previous_index_for_column
Methods included from Briar::Picker
#scroll_picker, #selected_title_for_column, #should_not_see_picker, #should_see_picker, #visible_titles
Methods included from Briar::Control::Slider
#briar_args_for_slider_set_value, #briar_slider_set_value, #change_slider_value_to
Methods included from Briar::Control::Segmented_Control
#index_of_control_with_id, #index_of_segment_with_name_in_control_with_id, #query_str_for_control, #should_see_control_with_segment_titles, #should_see_segment_with_selected_state, #touch_segment
Methods included from Briar::Control::Button
#button_exists?, #button_is_enabled, #should_not_see_button, #should_see_button, #should_see_button_with_title, #touch_button, #touch_button_and_wait_for_view, #touch_button_and_wait_for_view_to_disappear, #touch_button_with_title, #wait_for_button, #wait_for_button_with_title
Methods included from Briar::Alerts_and_Sheets
#alert_button_exists?, #alert_exists?, #dismiss_alert_with_button, #error_msg_for_sheet_button, #query_str_for_sheet, #sheet_button_exists?, #sheet_exists?, #should_not_see_alert, #should_not_see_button_on_sheet, #should_not_see_sheet, #should_see_alert, #should_see_alert_button, #should_see_alert_with_message, #should_see_alert_with_title, #should_see_button_on_sheet, #should_see_sheet, #should_see_sheet_title, #touch_alert_button, #touch_sheet_button, #touch_sheet_button_and_wait_for_view, #wait_for_sheet, #wait_for_sheet_to_disappear
Methods included from Briar::Bars
#date_is_in_navbar, #go_back_after_waiting, #go_back_and_wait_for_view, #index_of_navbar_button, #index_of_tabbar_item, #navbar_has_back_button?, #navbar_has_title?, #navbar_visible?, #should_not_see_navbar, #should_not_see_navbar_back_button, #should_not_see_navbar_button, #should_not_see_tabbar, #should_not_see_toolbar, #should_see_navbar, #should_see_navbar_back_button, #should_see_navbar_button, #should_see_navbar_with_title, #should_see_tab_at_index, #should_see_tabbar, #should_see_toolbar, #should_see_toolbar_button, #tabbar_visible?, #toolbar_button_exists?, #toolbar_exists?, #toolbar_qstr, #touch_navbar_item, #touch_navbar_item_and_wait_for_view, #touch_tabbar_item, #touch_toolbar_button, #wait_for_toolbar, #wait_for_toolbar_button, #wait_for_toolbar_to_disappear
Instance Method Details
#accessibility_marks(kind, opts = {}) ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/briar/irbrc.rb', line 85 def accessibility_marks(kind, opts={}) opts = {:print => true, :return => false}.merge(opts) kinds = [:id, :label] raise "'#{kind}' is not one of '#{kinds}'" unless kinds.include?(kind) res = Array.new max_width = 0 query('*').each { |view| aid = view[kind.to_s] unless aid.nil? or aid.eql?('') cls = view['class'] len = cls.length max_width = len if len > max_width res << [cls, aid] end } print_marks(res, max_width) if opts[:print] opts[:return] ? res : nil end |
#briar_message_of_the_day ⇒ Object
213 214 215 216 217 218 219 220 |
# File 'lib/briar/irbrc.rb', line 213 def motd=["Let's get this done!", 'Ready to rumble.', 'Enjoy.', 'Remember to breathe.', 'Take a deep breath.', "Isn't it time for a break?", 'Can I get you a coffee?', 'What is a calabash anyway?', 'Smile! You are on camera!', 'Let op! Wild Rooster!', "Don't touch that button!", "I'm gonna take this to 11.", 'Console. Engaged.', 'Your wish is my command.', 'This console session was created just for you.'] puts "#{motd.shuffle().first}" end |
#embed(x, y = nil, z = nil) ⇒ Object
noinspection RubyUnusedLocalVariable
44 45 46 |
# File 'lib/briar/irbrc.rb', line 44 def (x,y=nil,z=nil) puts "Screenshot at #{x}" end |
#ids ⇒ Object
144 145 146 |
# File 'lib/briar/irbrc.rb', line 144 def ids accessibility_marks(:id) end |
#labels ⇒ Object
148 149 150 |
# File 'lib/briar/irbrc.rb', line 148 def labels accessibility_marks(:label) end |
#marks ⇒ Object
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/briar/irbrc.rb', line 156 def marks opts = {:print => false, :return => true } res = accessibility_marks(:id, opts).each { |elm|elm << :ai } res.concat(accessibility_marks(:label, opts).each { |elm| elm << :al }) res.concat(text_marks(opts).each { |elm| elm << :text }) max_width = 0 res.each { |elm| len = elm[0].length max_width = len if len > max_width } counter = -1 res.sort.each { |elm| printf("%4s %-4s => %#{max_width}s => %s\n", "[#{counter = counter + 1}]", elm[2], elm[0], elm[1]) } nil end |
#nbl ⇒ Object
176 177 178 |
# File 'lib/briar/irbrc.rb', line 176 def nbl query('navigationButton', :accessibilityLabel) end |
#print_marks(marks, max_width) ⇒ Object
78 79 80 81 82 83 |
# File 'lib/briar/irbrc.rb', line 78 def print_marks(marks, max_width) counter = -1 marks.sort.each { |elm| printf("%4s %#{max_width + 2}s => %s\n", "[#{counter = counter + 1}]", elm[0], elm[1]) } end |
#puts_calabash_environment ⇒ Object
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/briar/irbrc.rb', line 184 def puts_calabash_environment puts '' begin puts "Loaded IRBRC: #{File.(ENV['IRBRC'])}" rescue Exception => _ puts 'No IRBRC defined; loading the local .irbrc' end puts '' puts " DEVICE_ENDPOINT => '#{ENV['DEVICE_ENDPOINT']}'" puts " DEVICE_TARGET => '#{ENV['DEVICE_TARGET']}'" puts " DEVICE => '#{ENV['DEVICE']}'" puts " BUNDLE_ID => '#{ENV['BUNDLE_ID']}'" puts " PLAYBACK_DIR => '#{ENV['PLAYBACK_DIR']}'" puts " SCREENSHOT_PATH => '#{ENV['SCREENSHOT_PATH']}'" puts " SDK_VERSION => '#{ENV['SDK_VERSION']}'" puts "CALABASH_FULL_CONSOLE_OUTPUT => '#{ENV['CALABASH_FULL_CONSOLE_OUTPUT']}'" puts " DEBUG => '#{ENV['DEBUG']}'" puts '' puts '*** useful functions defined in .irbrc ***' puts '> ids #=> all accessibilityIdentifiers' puts '> labels #=> all accessibilityLabels' puts '> text #=> all text' puts '> row_ids #=> all tableViewCell accessibilityIdentifiers' puts '> verbose #=> set debug logging on' puts '> quiet #=> set debug logging off' puts '' end |
#quiet ⇒ Object
139 140 141 142 |
# File 'lib/briar/irbrc.rb', line 139 def quiet ENV['DEBUG'] = '0' ENV['CALABASH_FULL_CONSOLE_OUTPUT'] = '0' end |
#row_ids ⇒ Object
180 181 182 |
# File 'lib/briar/irbrc.rb', line 180 def row_ids query('tableViewCell', @ai).compact.sort.each {|x| puts "* #{x}" } end |
#text ⇒ Object
152 153 154 |
# File 'lib/briar/irbrc.rb', line 152 def text text_marks end |
#text_marks(opts = {}) ⇒ Object
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/briar/irbrc.rb', line 106 def text_marks(opts={}) opts = {:print => true, :return => false}.merge(opts) indexes = Array.new idx = 0 all_texts = query('*', :text) all_texts.each { |view| indexes << idx unless view.eql?('*****') or view.eql?('') idx = idx + 1 } res = Array.new all_views = query('*') max_width = 0 indexes.each { |index| view = all_views[index] cls = view['class'] text = all_texts[index] len = cls.length max_width = len if len > max_width res << [cls, text] } print_marks(res, max_width) if opts[:print] opts[:return] ? res : nil end |
#verbose ⇒ Object
134 135 136 137 |
# File 'lib/briar/irbrc.rb', line 134 def verbose ENV['DEBUG'] = '1' ENV['CALABASH_FULL_CONSOLE_OUTPUT'] = '1' end |
#World(*world_modules, &proc) ⇒ Object
noinspection RubyUnusedLocalVariable
10 11 12 13 14 15 |
# File 'lib/briar/irbrc.rb', line 10 def World(*world_modules, &proc) world_modules.each { |mod| include mod puts "loaded '#{mod}'" } end |