class Object
Constants
- AI
noinspection RubyConstantNamingConvention
- AL
noinspection RubyConstantNamingConvention
- BRIAR_DATE_CONVERSION_FORMATS
- BRIAR_DATE_FORMATS
- BRIAR_PICKER_12H_BRIEF_DATE_FMT
common format for US Fri Nov 16
- BRIAR_PICKER_12H_TIME_FMT
- BRIAR_PICKER_24H_BRIEF_DATE_FMT
24h locales - Fri 16 Nov - 24h locales
- 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
- BRIAR_PICKER_ISO8601_BRIEF_DATE_FMT
our canonical format for testing if two dates are the same
- BRIAR_PICKER_ISO8601_BRIEF_DATE_TIME_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 }
- BRIAR_PICKER_OBJC_DATE_AND_TIME_FMT
- BRIAR_PICKER_OBJC_DATE_AND_TIME_FMT_ZONED
- BRIAR_PICKER_RUBY_DATE_AND_TIME_FMT
- BRIAR_PICKER_RUBY_DATE_AND_TIME_FMT_ZONED
ex. 2012_11_18_16_45
- BRIAR_POST_TIMEOUT
- BRIAR_REMOVE_LEADING_ZERO_REGEX
- BRIAR_RETRY_FREQ
see below for replacements
- BRIAR_STEP_PAUSE
- BRIAR_TIME_FORMATS
- BRIAR_WAIT_RETRY_FREQ
- 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
- 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.
- TOUCH_TRANSITION_RETRY_FREQ
- TOUCH_TRANSITION_TIMEOUT
will deprecate soon (starting 0.1.3)
- UIDatePickerModeCountDownTimer
- UIDatePickerModeDate
- UIDatePickerModeDateAndTime
- UIDatePickerModeTime
Public Instance Methods
noinspection RubyUnusedLocalVariable
# File lib/briar/irbrc.rb, line 10 def World(*world_modules, &proc) world_modules.each { |mod| include mod puts "loaded '#{mod}'" } end
# File lib/briar/irbrc.rb, line 77 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
# File lib/briar/irbrc.rb, line 205 def briar_message_of_the_day 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
noinspection RubyUnusedLocalVariable
# File lib/briar/irbrc.rb, line 36 def embed(x,y=nil,z=nil) puts "Screenshot at #{x}" end
# File lib/briar/irbrc.rb, line 136 def ids accessibility_marks(:id) end
# File lib/briar/irbrc.rb, line 140 def labels accessibility_marks(:label) end
# File lib/briar/irbrc.rb, line 148 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
# File lib/briar/irbrc.rb, line 168 def nbl query('navigationButton', :accessibilityLabel) end
# File lib/briar/irbrc.rb, line 70 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
# File lib/briar/irbrc.rb, line 176 def puts_calabash_environment puts '' begin puts "Loaded IRBRC: #{File.expand_path(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
# File lib/briar/irbrc.rb, line 131 def quiet ENV['DEBUG'] = '0' ENV['CALABASH_FULL_CONSOLE_OUTPUT'] = '0' end
# File lib/briar/irbrc.rb, line 172 def row_ids query('tableViewCell', @ai).compact.sort.each {|x| puts "* #{x}" } end
# File lib/briar/irbrc.rb, line 144 def text text_marks end
# File lib/briar/irbrc.rb, line 98 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
# File lib/briar/irbrc.rb, line 126 def verbose ENV['DEBUG'] = '1' ENV['CALABASH_FULL_CONSOLE_OUTPUT'] = '1' end