Package com.atlassian.confluence.it.user
Class LoginHelper
- java.lang.Object
-
- 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 tocom.atlassian.confluence.AbstractConfluenceAcceptanceTest.logout()
.
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.slf4j.Logger
log
-
Constructor Summary
Constructors Constructor Description LoginHelper()
LoginHelper(net.sourceforge.jwebunit.junit.WebTester webTester)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description String
getLoginButtonId()
HACK - temp method to get tests checking for login screen working.boolean
isLoggedInAs(User user)
Returns true if logged in as the passed user.boolean
isLoggedInAs(String username)
Returns true if logged in as the passed user.void
logIn(String username, String password, boolean rememberMe)
Log in with a specific username and password plus options.void
logInAs(User user)
void
logInAs(User user, AbstractPageEntity abstractPageEntity)
void
logInAs(String username, String password)
Log in as the specified user, going toSTART_LOCATION
.void
logInAsAtHomepage(User user)
void
logInAsAtHomepage(String username, String password)
Logs in and then goes straight to "/"void
logInDecorated(User user)
Deprecated.since 6.7.void
logInFast(User user)
Deprecated.since 7.10.void
logInFast(String username, String password, boolean rememberMe)
Deprecated.since 7.10.void
logInToDestination(User user, String destination)
void
logInViaForm(User user)
void
logInViaForm(String username, String password, boolean rememberMe)
void
logInViaFormOnCurrentPage(User user)
void
logInViaFormOnCurrentPage(String username, String password, boolean rememberMe)
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.
-
-
-
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(String username, String password, boolean rememberMe)
Log in with a specific username and password plus options.
-
logInFast
@Deprecated public void logInFast(User user)
Deprecated.since 7.10. UselogInAs(User)
instead.
-
logInFast
@Deprecated public void logInFast(String username, String password, boolean rememberMe)
Deprecated.since 7.10. UselogIn(String, String, boolean)
instead.
-
logInDecorated
@Deprecated public void logInDecorated(User user)
Deprecated.since 6.7. noop.jsp no longer supports having a decorator.
-
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 theWebTester
by callingWebTester.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 uselogOutSlowly()
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 callWebTester.beginAt(String)
so you can not use it to ensure theWebTester
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 callWebTester.beginAt(String)
so you can not use it to ensure theWebTester
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)
-
logInViaFormOnCurrentPage
public void logInViaFormOnCurrentPage(User user)
-
logInViaFormOnCurrentPage
public void logInViaFormOnCurrentPage(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 toSTART_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 "/"
-
-