Fix failing annotator login test on OSX

The SERVER_NAME environment variable on OSX defaults to 127.0.0.1 where
on other systems it's localhost. When a user is created the provider
defaults to the request.server_name value, this caused the assertion
to fail.

Ideally we'd be able to set the SERVER_NAME in the config for all
platforms, but I was unable to find the correct config value for this.
So in the mean time I'm just accepting both options as valid.
Wait for sidebar to ack setTool before applying

Without this change, clicking highlight mode and then dismissing the
authentication without logging in will make it so that one must click
it twice to trigger the behavior again.
Merge pull request #1272 from hypothesis/fix-feature-test-osx

Fix failing annotator login test on OSX
Fix failing annotator login test on OSX

The SERVER_NAME environment variable on OSX defaults to 127.0.0.1 where
on other systems it's localhost. When a user is created the provider
defaults to the request.server_name value, this caused the assertion
to fail.

Secondly, Selenium only returns visible text when using the element.text
property although some drivers (FireFox) seem to return hidden text
also. So now we use dom properties to access the contents of the text
node regardless of styling.
Use 30 second timeout for all WebDriverWait calls

This is to workaround the timeouts in the integration tests in Travis.
Silence the Application logger when running the tests
Add phantomjs to the package.json

This is now used as the primary platform for functional tests until
we can get Sauce Labs running reliably.
Swap out Sauce Labs for a local PhantomJS instance

This should run faster an more reliably for the moment. Working tests
in one browser is better than unreliable tests in many.
Remove unused imports
Wait for sign in link to be visible in tests

This might be necessary because of the delay between opening the
sidebar and the sidebar sliding out fully. Just speculation. This
definitely fixes login tests failing in PhantomJS, though.
In tests, wait for forms to be visible

In addition to waiting for the Sign in button, we should wait for the
sheet to actually appear.

We should maybe re-evaluate using implicit waits for things like this,
as all the wait condition usage is tedious.
Add implicit wait to tests

This should prevent some failures when items are slow to be found.
Remove unnecessary form clears in tests
Merge pull request #1274 from hypothesis/travis-timeouts

Re-jig the integration tests
Fix regressions in auth errors and state resume

Fix two recent regressions with authentication. The first is the lack
of form error reporting. The second is the issue that ongoing highlight
mode switches and edits don't proceed after login.

- Unify all the interceptors related to sessioning. The interceptor for
  flash messages, csrf, and extracting the model from the session view
  responses is now all in session.coffee. This is better because it
  means other requests that don't return data in the same format aren't
  processed by these interceptors. It also makes it clearer which data
  the interceptors are processing; the CSRF interceptor may have been
  broken because the flash interceptor was discarding the data outside
  the model object.
- The CSRF interceptor was also not returning a rejected promise on
  errors. This mistake caused the errors not to be propagated to the
  Auth form controller. Fix #1266.
- The interaction between the Auth controller, session model changes,
  and scope resets is improved. The timeouts on the auth sheet are
  fixed so that they don't lose the ongoing mode switches and edits
  when the sheet is closed. Fix #1214.
Refactor the reset event slightly

Refactor the reset scope event for quicker app startup and stop
using the reserved prefix that angular uses.

- Rename $reset to reset
- At the App controller, invoke the initialization code immediately
  rather than broadcasting an event. Every component should start
  by initializing itself rather than waiting for an event to be
  broadcast.
Merge pull request #1278 from hypothesis/1214-and-1266-auth-regressions

Fix regressions in auth errors and state resume
Small reset tweak in auth controller

It's clearer if the form clears itself through a reset rather than
waiting for it to happen later. This has the advantage of getting
the password out of reachable memory sooner.

Extending the scope rather than erasing its keys and replacing it
with the base scope means the Auth controller can clear the form
fields without clearing the session data in the scope.
Code clarity through local variables
WIP on stream consolidation