Refactoring: moved login in tests to login.js.