Module: Briar::ImageView

Defined in:
lib/briar/image_view.rb

Instance Method Summary collapse

Instance Method Details

#image_view_exists?(iv_id) ⇒ Boolean

Returns:

  • (Boolean)


5
6
7
8
9
10
11
12
13
# File 'lib/briar/image_view.rb', line 5

def image_view_exists?(iv_id)
  query_str = "imageView marked:'#{iv_id}'"
  exists = !query(query_str).empty?
  if exists
    alpha = query(query_str, :alpha).first.to_i
    hidden = query(query_str, :isHidden).first.to_i
    alpha > 0 and hidden == 0
  end
end

#should_not_see_image_view(iv_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object



19
20
21
# File 'lib/briar/image_view.rb', line 19

def should_not_see_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
  wait_for_image_view_to_disappear iv_id, timeout
end

#should_see_image_view(iv_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object



15
16
17
# File 'lib/briar/image_view.rb', line 15

def should_see_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
  wait_for_image_view iv_id, timeout
end

#wait_for_image_view(iv_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object



23
24
25
26
27
28
29
30
31
32
# File 'lib/briar/image_view.rb', line 23

def wait_for_image_view(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
  msg = "waited for '#{timeout}' seconds but did not see image view marked: '#{iv_id}'"
  options = {:timeout => timeout,
             :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
             :post_timeout => BRIAR_WAIT_STEP_PAUSE,
             :timeout_message => msg}
  wait_for(options) do
    image_view_exists? iv_id
  end
end

#wait_for_image_view_to_disappear(iv_id, timeout = BRIAR_WAIT_TIMEOUT) ⇒ Object



34
35
36
37
38
39
40
41
42
43
# File 'lib/briar/image_view.rb', line 34

def wait_for_image_view_to_disappear(iv_id, timeout=BRIAR_WAIT_TIMEOUT)
  msg = "waited for '#{timeout}' seconds but i still see image view marked: '#{iv_id}'"
  options = {:timeout => timeout,
             :retry_frequency => BRIAR_WAIT_RETRY_FREQ,
             :post_timeout => BRIAR_WAIT_STEP_PAUSE,
             :timeout_message => msg}
  wait_for(options) do
    not image_view_exists? iv_id
  end
end