   home:
     get: ->
       # Finds the home button.
-      find = =>
+      findButton = =>
         # The home button is the parent of the home icon.
-        @select('button .glyphicon-home', '..')
-    
+        @find('button .glyphicon-home', '..')
+
       # Validates the home button.
       #
       # @throws expectation error if the button is missing
       validate = (button) ->
         expect(button, 'The home button is missing').to.exist
         button
-    
+
       # Clicks the given button.
       click = (button) ->
         button.click()

        browser.navigate().back().then ->
          # Resolve to the URL.
          home_url
    
      find()
        .then(validate)
        .then(click)
        .then(pop)
  
  # @returns the help content
  help:
    get: ->
      @select('.qi-help').then (block) =>
        # Help is initially hidden.
        expect(block.isDisplayed(), 'The help element is not initially hidden')
          .to.eventually.be.false
        # The help button is the parent of the question mark icon.
        @select('button .glyphicon-question-sign', '..').then (button) =>
          expect(button, 'The help button is missing').to.exist
          # Open the help view...
          button.click().then =>
            # ...verify that the help is displayed...
            expect(block.isDisplayed(), 'The help element is hidden after click')
              .to.eventually.be.true
            # ...find the element...
            @select('.qi-main .qi-help-text').then (content) =>
              # ...resolve to the formatted help content.
              content.getInnerHtml()
    
    # @returns the contact information contact
    contact: () ->
      @select('.qi-main .qi-contact-info').then (content) =>
        # ...resolve to the formatted contact information content.
        content.getInnerHtml()

module.exports = Page

_ = require 'lodash'

expect = require('./expect')()

