Sha256: 7fc6bc1470a696421f91b53156f8a4d4b06769039ed9920ff4466d89706caaf2

Contents?: true

Size: 763 Bytes

Versions: 8

Compression:

Stored size: 763 Bytes

Contents

module PageMagic
  attr_reader :browser, :session

  def initialize(session = Session.new(Capybara.current_session), options = {}, &block)
    @browser = session.raw_session
    @session = session

    @browser_element = @browser
    navigate if options[:navigate_to_page]
    block.call @browser if block
  end

  def title
    browser.title
  end

  def text_on_page?(text)
    text().downcase.include?(text.downcase)
  end

  def visit
    browser.visit self.class.url
    self
  end

  def text
    browser.text
  end

  def method_missing(method, *args)
    element_context.send(method, *args)
  end

  def respond_to?(*args)
    super || element_context.respond_to?(*args)
  end

  def element_context
    ElementContext.new(self, @browser, self)
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
page_magic-1.0.0.alpha13 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha12 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha11 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha10 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha9 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha8 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha7 lib/page_magic/page_magic.rb
page_magic-1.0.0.alpha6 lib/page_magic/page_magic.rb