       , done
 
 describe 'Login', ->
-  browser = null
-
-  before (done) ->
-    browser = new Browser()
+  before (done) ->
+    wd40.init ->
+      console.log browser
+      browser.get LOGIN_URL, done
+
+  before (done) ->
     createProfile
       shortName: 'ickletest'
       displayName: 'Mr Ickle Test'


  context 'when I visit the homepage', ->
    before (done) ->
      browser.visit BASE_URL, done

    context 'when I am not logged in', ->
      it 'shows me a login form', ->
        should.exist browser.query('form')

    context 'when I try to login with valid details', ->
      before (done) ->
        browser.fill '#username', 'ickletest'
        browser.fill '#password', 'toottoot'
        browser.pressButton '#login', ->
          browser.wait done

      it 'shows my name', ->
        browser.text('#subnav-path').should.include 'Mr Ickle Test'

      context 'when I logout', ->
        before (done) ->
          browser.clickLink '#header .logout a', done

        it 'redirects me to the login page', ->
          browser.location.href.should.equal "#{BASE_URL}/login"

        context 'when I revisit the index page', ->
          before (done) ->
            browser.visit BASE_URL, done

          it 'should still present a login form', ->
            should.exist browser.query('.login-page form')
            should.not.exist browser.query('.dataset-list')

     xcontext 'when I try to login with my email address as my username', ->



  context 'when I log in to a corporate account', ->
    before (done) ->
      browser.deleteAllCookies done

    before (done) ->
      browser.get BASE_URL, ->
        wd40.fill '#username', corpProfile.shortName, ->
          wd40.fill '#password', corpProfile.password, ->
            wd40.click '#login', ->
              browser.get BASE_URL, done

    it 'shows my corporate logo somewhere', (done) ->
      browser.source (err, source) ->
        source.should.include """src="#{corpProfile.logoUrl}"""
        done()
