Module: Howitzer::Web::PageDsl::ClassMethods

Defined in:
lib/howitzer/web/page_dsl.rb

Overview

This module holds page dsl class methods

Instance Method Summary collapse

Instance Method Details

#on(&block) ⇒ Object

Note:

It additionally checks the page is really displayed on each method call, otherwise it raises error

Allows to execute page methods in context of the page.

Examples:

Standard case

LoginPage.open
LoginPage.on do
  fill_form(name: 'John', email: '[email protected]')
  submit_form
end

More complex case with outer context

@name = 'John'
def email(domain = 'gmail.com')
  "jkarpensky@#{domain}"
end
LoginPage.open
LoginPage.on do
  fill_form(name: out(:@name), email: out(:email, 'yahoo.com'))
  submit_form
end


98
99
100
101
# File 'lib/howitzer/web/page_dsl.rb', line 98

def on(&block)
  PageScope.new(self, &block)
  nil
end