Skip to content

Support Site mounting #66

@dtognazzini

Description

@dtognazzini

The main purpose of the Site class is to provide routing for the contained page objects.

The common setup for a Rails app is define all the page objects within a single Site as all the page objects will share the same router.

When using mountable engines in Rails, routes are defined by engines and then mounted by the application. It's nice to have the engine provide page objects for its pages as they can be used by both the top level application and the dummy application used in the engine's tests. The colocation of the page objects and the engine, keeps the page objects and the corresponding engine's pages to evolve together.

Enhance Site with a way to compose other Site instances provided by engines.

Something like the following should be supported:

Engine1

class Engine1Page < AePageObjects::Document
  path :engine1_page
end

class Engine1Site < AePageObjects::Site
end

Engine2

class Engine2Page < AePageObjects::Document
  path :engine2_page
end

class Engine2Site < AePageObjects::Site
end

Application

class ApplicationPage < AePageObjects::Document
  path :application_page

  def submit!
    node.click('#submit_button')
    window.change_to(Engine1Page)
  end
end

class ApplicationSite < AePageObjects::Site
  mount Engine1Site, "/engine1directory"
  mount Engine2Site, "/engine2directory"
end

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions