 
   beginTest: (browser, user) ->
 
-    url   = @getUrl()
+    url = @getUrl()
+
+    if HUBSPOT
+       url = "#{url}/Login"
+
     user ?= utils.getUser()
 
     browser.url url

  assertNotLoggedIn: (browser, user) ->

    url = @getUrl()
    browser.url(url)
    browser.maximizeWindow()



  attemptEnterEmailAndPasswordOnRegister: (browser, user) ->

    url = @getUrl()

    if HUBSPOT
      url = "#{url}/Register"

    browser.url url

    unless HUBSPOT
      browser.waitForElementVisible  '[testpath=main-header]', 30000

    browser.setValue    '[testpath=register-form-email]', user.email

    if HUBSPOT
      browser.setValue  '.login-form .password input[name=password]', user.password
    else
      browser.setValue  'input[name=password]', user.password

    browser.click       '[testpath=signup-button]'


  attemptEnterUsernameOnRegister: (browser, user) ->

    modalSelector  = '.extra-info.password'
    buttonSelector = "#{modalSelector} button[type=submit]"

    browser.waitForElementVisible modalSelector, 30000

    if user.gravatar
      browser
        .assert.valueContains "#{modalSelector} input[name=username]",  'kodingqa'
        .assert.valueContains "#{modalSelector} input[name=firstName]", 'Koding'
        .assert.valueContains "#{modalSelector} input[name=lastName]",  'Testuser'
    else
      browser
        .setValue '[testpath=register-form-username]', user.username
