Skip to content

Defining a Site

jfitisoff edited this page Aug 6, 2018 · 1 revision

Before creating any page objects you need to define a site object class:

require 'insite'

class MySite
  include Insite
end

When included, the Insite module adds a Page class that you can use to create page objects.

Defining custom tags in your site definition (optional)

If your application uses non-standard HTML tags, you can optionally specify those tags when creating your site using the set_custom_tags method:

class MySite
  include Insite
  set_custom_tags "custom-tag1", "custom-tag2"
end

This creates empty component classes for each tag you pass in. Components are usually used to model complex, recurring features in your application. This is just a quick and dirty bulk create option that you can use to register your custom tags, some of which likely won't need any custom functionality. The benefit of using the mechanism outlined here is that it creates DOM methods for each of your tags, allowing you to work with them in the same way that you'd work with standard HTML tags.