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.Loggerlog
-
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 StringgetLoginButtonId()HACK - temp method to get tests checking for login screen working.booleanisLoggedInAs(User user)Returns true if logged in as the passed user.booleanisLoggedInAs(String username)Returns true if logged in as the passed user.voidlogIn(String username, String password, boolean rememberMe)Log in with a specific username and password plus options.voidlogInAs(User user)voidlogInAs(User user, AbstractPageEntity abstractPageEntity)voidlogInAs(String username, String password)Log in as the specified user, going toSTART_LOCATION.voidlogInAsAtHomepage(User user)voidlogInAsAtHomepage(String username, String password)Logs in and then goes straight to "/"voidlogInDecorated(User user)Deprecated.since 6.7.voidlogInFast(User user)Deprecated.since 7.10.voidlogInFast(String username, String password, boolean rememberMe)Deprecated.since 7.10.voidlogInToDestination(User user, String destination)voidlogInViaForm(User user)voidlogInViaForm(String username, String password, boolean rememberMe)voidlogInViaFormOnCurrentPage(User user)voidlogInViaFormOnCurrentPage(String username, String password, boolean rememberMe)voidlogout()Log out to the super-fast test logout screen.voidlogOutAndIn(User user)Log out the current user and then log back in with the given user.voidlogOutAndStayAnonymous()Log out the current user and then begin a new session as the anonymous user.voidlogOutFast()Logs the current user out as quickly as possible.voidlogOutSlowly()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 theWebTesterby 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 theWebTesteris 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 theWebTesteris 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 "/"
-
-