module Howitzer::Web::PageDsl::ClassMethods

This module holds page dsl class methods

Public Instance Methods

on(&block) click to toggle source

Allows to execute page methods in context of the page. @note It additionally checks the page is really displayed

on each method call, otherwise it raises error

@example Standard case

LoginPage.open
LoginPage.on do
  fill_form(name: 'John', email: 'jkarpensky@gmail.com')
  submit_form
end

@example 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
# File lib/howitzer/web/page_dsl.rb, line 98
def on(&block)
  PageScope.new(self, &block)
  nil
end