module Briar::Bars
Public Instance Methods
go_back_after_waiting(opts={})
click to toggle source
# File lib/briar/bars/navbar.rb, line 127 def go_back_after_waiting(opts={}) default_opts = {:wait_before_going_back => 0.2, :timeout => BRIAR_WAIT_TIMEOUT, :timeout_message => nil, :wait_step_pause => BRIAR_WAIT_STEP_PAUSE, :retry_frequency => BRIAR_WAIT_RETRY_FREQ} opts = default_opts.merge(opts) wait_before = opts[:wait_before_going_back] sleep(wait_before) msg = opts[:timeout_message] timeout = opts[:timeout] if msg.nil? msg = "waited for '#{timeout + wait_before}' for navbar back button but didn't see it" end wait_for(:timeout => timeout, :retry_frequency => opts[:retry_frequency], :post_timeout => opts[:wait_step_pause], :timeout_message => msg) do not query('navigationItemButtonView first').empty? end touch('navigationItemButtonView first') step_pause end
go_back_and_wait_for_view(view)
click to toggle source
# File lib/briar/bars/navbar.rb, line 153 def go_back_and_wait_for_view (view) sleep(0.2) timeout = BRIAR_WAIT_TIMEOUT msg = "waited '#{timeout}' seconds but did not see navbar back button" wait_for(wait_opts(msg, timeout)) do not query('navigationItemButtonView first').empty? end touch_transition('navigationItemButtonView first', "view marked:'#{view}'", {:timeout => TOUCH_TRANSITION_TIMEOUT, :retry_frequency => TOUCH_TRANSITION_RETRY_FREQ}) step_pause end
index_of_tabbar_item(name)
click to toggle source
# File lib/briar/bars/tabbar.rb, line 21 def index_of_tabbar_item(name) tabs = query('tabBarButton', AL) tabs.index(name) end
should_not_see_tabbar()
click to toggle source
# File lib/briar/bars/tabbar.rb, line 15 def should_not_see_tabbar if tabbar_visible? screenshot_and_raise 'i should not see the tabbar' end end
should_not_see_toolbar(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
click to toggle source
# File lib/briar/bars/toolbar.rb, line 22 def should_not_see_toolbar (toolbar_id, timeout=BRIAR_WAIT_TIMEOUT) wait_for_toolbar_to_disappear toolbar_id, timeout screenshot_and_raise "did not expect to see toolbar with id '#{toolbar_id}'" if toolbar_exists? toolbar_id end
should_see_tab_at_index(name, index)
click to toggle source
# File lib/briar/bars/tabbar.rb, line 45 def should_see_tab_at_index(name, index) should_see_tabbar tabs = query('tabBarButton', AL) unless tabs.index(name) == index.to_i screenshot_and_raise "should have seen tab named '#{name}' at index '#{index}' but found these: '#{tabs}'" end end
should_see_tabbar()
click to toggle source
# File lib/briar/bars/tabbar.rb, line 9 def should_see_tabbar unless tabbar_visible? screenshot_and_raise 'i should see the tabbar' end end
should_see_toolbar(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
click to toggle source
# File lib/briar/bars/toolbar.rb, line 18 def should_see_toolbar (toolbar_id, timeout=BRIAR_WAIT_TIMEOUT) wait_for_toolbar(toolbar_id, timeout) end
tabbar_visible?()
click to toggle source
# File lib/briar/bars/tabbar.rb, line 5 def tabbar_visible? element_exists('tabBar') end
toolbar_exists?(id)
click to toggle source
# File lib/briar/bars/toolbar.rb, line 14 def toolbar_exists? (id) !query("toolbar marked:'#{id}'").empty? end
toolbar_qstr(toolbar_id=nil)
click to toggle source
# File lib/briar/bars/toolbar.rb, line 6 def toolbar_qstr(toolbar_id=nil) if toolbar_id.nil? 'toolbar' else "toolbar marked:'#{toolbar_id}'" end end
touch_tabbar_item(name, wait_for_view_id=nil)
click to toggle source
# File lib/briar/bars/tabbar.rb, line 26 def touch_tabbar_item(name, wait_for_view_id=nil) sleep(0.2) wait_for(:timeout => BRIAR_WAIT_TIMEOUT, :retry_frequency => BRIAR_WAIT_RETRY_FREQ) do index_of_tabbar_item(name) != nil end should_see_tabbar idx = index_of_tabbar_item name if idx touch "tabBarButton index:#{idx}" unless wait_for_view_id.nil? wait_for_view wait_for_view_id end step_pause else screenshot_and_raise "tabbar button with name #{name} does not exist" end end
wait_for_toolbar(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
click to toggle source
# File lib/briar/bars/toolbar.rb, line 86 def wait_for_toolbar(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT) msg = "waited for '#{timeout}' seconds but did not see toolbar marked: '#{toolbar_id}'" options = {:timeout => timeout, :retry_frequency => BRIAR_WAIT_RETRY_FREQ, :post_timeout => BRIAR_WAIT_STEP_PAUSE, :timeout_message => msg} wait_for(options) do toolbar_exists? toolbar_id end end
wait_for_toolbar_to_disappear(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT)
click to toggle source
# File lib/briar/bars/toolbar.rb, line 73 def wait_for_toolbar_to_disappear(toolbar_id, timeout=BRIAR_WAIT_TIMEOUT) msg = "waited for '#{timeout}' seconds but i still see toolbar marked: '#{toolbar_id}'" options = {:timeout => timeout, :retry_frequency => BRIAR_WAIT_RETRY_FREQ, :post_timeout => BRIAR_WAIT_STEP_PAUSE, :timeout_message => msg} wait_for(options) do not toolbar_exists? toolbar_id end end