Sha256: df20b5cfc3c11b1701c99dda665034a08a6578276f20a2686a799d8488d53744

Contents?: true

Size: 959 Bytes

Versions: 1

Compression:

Stored size: 959 Bytes

Contents

module <%= name.split('_').map(&:capitalize).join -%>
<% if klass.include?(':') -%>
::<%= klass[/^[^:]*/] -%>
<% end %>
  class <%= klass[/[^:]*$/] %> < <%= name.split('_').map(&:capitalize).join %>::Base

    <% if url.empty? -%>
# Define url represented by page object if appropriate

    # page_url {  }
<% else -%>
page_url { "<%= url %>" }
<% end %>

<% if elements.empty? -%>
    # Define elements representing contents of page
<% end -%>
    # Specify full Watir locator inside block
    # element(:foo) { browser.div(id: 'foo') }
<% elements.each do |element| -%>
    element(:<%= element %>) {  }
<% end -%>
<% unless form.empty? -%>
    element(:submit) { browser.button(visible: true) }

    def submit_form(<%= form.downcase %> = nil)
      <%= form.downcase %> ||= <%= name.split('_').map(&:capitalize).join %>::Data::<%= form %>.new
      fill_form(<%= form.downcase %>)
      submit.click
      <%= form.downcase %>
    end
<% end %>
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
watir_install-0.3.0 lib/watir_install/generators/pages/spec/support/pages/page.rb.tt