Class: BriarPage

Inherits:
Calabash::IBase
  • Object
show all
Defined in:
lib/briar/page/briar_page.rb

Overview

extends Calabash::IBase

Instance Method Summary collapse

Constructor Details

#initialize(world, transition_duration = BRIAR_WAIT_STEP_PAUSE) ⇒ BriarPage

Returns a new instance of BriarPage.



6
7
8
# File 'lib/briar/page/briar_page.rb', line 6

def initialize(world, transition_duration=BRIAR_WAIT_STEP_PAUSE)
  super(world, transition_duration)
end

Instance Method Details

#markObject

returns the mark for this page

raises an exception if subclass does not implement



43
44
45
# File 'lib/briar/page/briar_page.rb', line 43

def mark
  raise "subclasses must implement the 'mark' method"
end

#page_visible?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/briar/page/briar_page.rb', line 51

def page_visible?
  view_exists?(mark)
end

#qstr_for_trait(mark, opts = {}) ⇒ Object

returns a query string that can be used by trait method to create a query string based on the mark

accepts the following options:

+:ui_class+ - defaults to <tt>'view'</tt>
+:is_custom_class+ - defaults to +false+

raises an exception if :is_custom is true and :ui_class is 'view' - set the :ui_class to your custom class name



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/briar/page/briar_page.rb', line 19

def qstr_for_trait(mark, opts={})
  default_opts = {:ui_class => 'view',
                  :is_custom => false}
  opts = default_opts.merge(opts)

  ui_class = opts[:ui_class]
  is_custom = opts[:is_custom]

  if is_custom and ui_class.eql?('view')
    raise "if is_custom is 'true' than ui_class should not be '#{view}'"
  end

  if opts[:is_custom]
    view = "view:'#{opts[:is_custom]}'"
  else
    view = ui_class
  end

  "#{view} marked:'#{mark}'"
end

#traitObject



47
48
49
# File 'lib/briar/page/briar_page.rb', line 47

def trait
  qstr_for_trait(mark)
end