Sha256: 8fe11bb5a78c681f55d6bc4049aa496a4393cef2e3db8ffd57b96372e9cb9145

Contents?: true

Size: 928 Bytes

Versions: 1

Compression:

Stored size: 928 Bytes

Contents

module <%= name.split('_').map(&:capitalize).join %>
  class <%= klass.gsub('::', '') %> < Page::Base

<% if url.empty? -%>
    # Define url represented by page object if appropriate
    # page_url {  }
<% else -%>
<% if url =~ %r{^(about|data|https?):}i -%>
    page_url { "<%= url %>" }
<% else -%>
    page_url { "#{Site.base_url}<%= url %>" }
<% end -%>
<% 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 %> ||= 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.1 lib/watir_install/generators/pages/spec/support/pages/page.rb.tt