Sha256: aae2e65cbb7420e94c71c4ee8db0f94d8d775461a19190190a71b4f8fd354d24

Contents?: true

Size: 1.32 KB

Versions: 36

Compression:

Stored size: 1.32 KB

Contents

require 'calabash-cucumber/ibase'

# extends Calabash::IBase
class BriarPage < Calabash::IBase

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

  # 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
  # <tt>'view'</tt> - set the +:ui_class+ to your custom class name
  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

  # returns the mark for this page
  #
  # raises an exception if subclass does not implement
  def mark
    raise "subclasses must implement the 'mark' method"
  end

  def trait
    qstr_for_trait(mark)
  end

  def page_visible?
    view_exists?(mark)
  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
briar-2.0.5 lib/briar/page/briar_page.rb
briar-2.0.4 lib/briar/page/briar_page.rb
briar-2.0.3 lib/briar/page/briar_page.rb
briar-2.0.2 lib/briar/page/briar_page.rb
briar-2.0.1 lib/briar/page/briar_page.rb
briar-2.0.0 lib/briar/page/briar_page.rb
briar-1.4.2 lib/briar/page/briar_page.rb
briar-1.4.1 lib/briar/page/briar_page.rb
briar-1.3.2 lib/briar/page/briar_page.rb
briar-1.3.1 lib/briar/page/briar_page.rb
briar-1.3.0 lib/briar/page/briar_page.rb
briar-1.2.2 lib/briar/page/briar_page.rb
briar-1.2.1 lib/briar/page/briar_page.rb
briar-1.2.0 lib/briar/page/briar_page.rb
briar-1.1.9 lib/briar/page/briar_page.rb
briar-1.1.8 lib/briar/page/briar_page.rb
briar-1.1.7 lib/briar/page/briar_page.rb
briar-1.1.6 lib/briar/page/briar_page.rb
briar-1.1.5 lib/briar/page/briar_page.rb
briar-1.1.4 lib/briar/page/briar_page.rb