Skip to content

3 Defining Sites

Justin Watts edited this page May 26, 2017 · 2 revisions

A Site is the core of your framework. It provides access to your Pages, Regions, and helper methods. Moreover, it grants a namespace for accessing all of these items with ease. The contents of a Site is laze-loaded ensuring you never have stale references.

class Wikipedia < Ferris::Site
  page(:home_page,  HomePage)
  page(:apple_page, ApplePage)

  region(:header, Header) { browser.div(id: 'mw-head') }

  elements(:every_button_ever) { browser.buttons }

  def ensure_loaded
    header.wait_until(&:present?)
  end

  def tell_me_a_joke
    puts 'This is a joke. So funny.'
  end 
end
Clone this wiki locally