com.atlassian.confluence.it.user
Class LoginHelper

java.lang.Object
  extended by com.atlassian.confluence.it.user.LoginHelper

public class LoginHelper
extends Object

Helps to manage the user session for a http client for testing. Use this in preference to com.atlassian.confluence.AbstractConfluenceAcceptanceTest.logout().


Field Summary
protected  org.slf4j.Logger log
           
 
Constructor Summary
LoginHelper()
           
LoginHelper(net.sourceforge.jwebunit.junit.WebTester webTester)
           
 
Method Summary
 String getLoginButtonId()
          HACK - temp method to get tests checking for login screen working.
 boolean isLoggedInAs(String username)
          Returns true if logged in as the passed user.
 boolean isLoggedInAs(User user)
          Returns true if logged in as the passed user.
 void login(String username, String password, boolean rememberMe)
          Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).
 void logIn(String username, String password, boolean rememberMe)
          Log in with a specific username and password plus options.
 void login(User user)
          Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).
 void logInAs(String username, String password)
          Log in as the specified user, going to START_LOCATION.
 void logInAs(User user)
           
 void logInAs(User user, AbstractPageEntity abstractPageEntity)
           
 void logInAsAtHomepage(String username, String password)
          Logs in and then goes straight to "/"
 void logInAsAtHomepage(User user)
           
 void logInDecorated(User user)
           
 void logInFast(User user)
           
 void logInToDestination(User user, String destination)
           
 void logInViaForm(String username, String password, boolean rememberMe)
           
 void logInViaForm(User user)
           
 void logout()
          Log out to the super-fast test logout screen.
 void logOutAndIn(User user)
          Log out the current user and then log back in with the given user.
 void logOutAndStayAnonymous()
          Log out the current user and then begin a new session as the anonymous user.
 void logOutFast()
          Logs the current user out as quickly as possible.
 void logOutSlowly()
          Log out by clicking the Log Out link in the UI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final transient org.slf4j.Logger log
Constructor Detail

LoginHelper

public LoginHelper()

LoginHelper

public LoginHelper(net.sourceforge.jwebunit.junit.WebTester webTester)
Method Detail

logOutAndIn

public void logOutAndIn(User user)
Log out the current user and then log back in with the given user. The logIn is a fast decoratorless one.

Parameters:
user - user to log in

logOutAndStayAnonymous

public void logOutAndStayAnonymous()
Log out the current user and then begin a new session as the anonymous user. The beginAt is a fast decoratorless one.


login

public void login(User user)
Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).


login

public void login(String username,
                  String password,
                  boolean rememberMe)
Deprecated. since 4.2 Use logInFast(com.atlassian.confluence.it.User), logInDecorated(com.atlassian.confluence.it.User) or logInViaForm(com.atlassian.confluence.it.User).


logIn

public void logIn(String username,
                  String password,
                  boolean rememberMe)
Log in with a specific username and password plus options.


logInFast

public void logInFast(User user)

logInDecorated

public void logInDecorated(User user)

logout

public void logout()
Log out to the super-fast test logout screen. This logs your user out quickly, freeing up resources, but doesn't return the appropriate result for testing. It also sets up the WebTester by calling WebTester.beginAt(String). You should use this method to log out most of the time, and also to begin tests where Confluence is being used anonymously. But use logOutSlowly() if you're testing log-out functionality specifically.

Note, this method will only actually invalidate your user's existing session on the server if the functest plugin is installed.

See Also:
logOutSlowly()

logOutFast

public void logOutFast()
Logs the current user out as quickly as possible. It does not call WebTester.beginAt(String) so you can not use it to ensure the WebTester is appropriately set up.


logOutSlowly

public void logOutSlowly()
Log out by clicking the Log Out link in the UI. This method assumes you are already on a page with the Log Out menu visible. You can use it to test that the results of clicking that link are appropriate. It does not call WebTester.beginAt(String) so you can not use it to ensure the WebTester is appropriately set up.

See Also:
logout()

isLoggedInAs

public boolean isLoggedInAs(String username)
Returns true if logged in as the passed user.


isLoggedInAs

public boolean isLoggedInAs(User user)
Returns true if logged in as the passed user.


logInViaForm

public void logInViaForm(User user)

logInViaForm

public void logInViaForm(String username,
                         String password,
                         boolean rememberMe)

getLoginButtonId

public String getLoginButtonId()
HACK - temp method to get tests checking for login screen working. Needs refactoring out to something like the Selenium stack's "Suite" class.

Returns:
the id or name of the login button that we can assert to be present on the Login screen

logInAs

public void logInAs(String username,
                    String password)
Log in as the specified user, going to START_LOCATION.


logInAs

public void logInAs(User user)

logInAs

public void logInAs(User user,
                    AbstractPageEntity abstractPageEntity)

logInAsAtHomepage

public void logInAsAtHomepage(User user)

logInAsAtHomepage

public void logInAsAtHomepage(String username,
                              String password)
Logs in and then goes straight to "/"


logInToDestination

public void logInToDestination(User user,
                               String destination)


Copyright © 2003–2015 Atlassian. All rights reserved.