com.atlassian.confluence
Class AbstractConfluenceAcceptanceTest

java.lang.Object
  extended by junit.framework.Assert
      extended by junit.framework.TestCase
          extended by com.atlassian.confluence.ThreadLocalWebTestCase
              extended by com.atlassian.confluence.AbstractAtlassianWebTestCase
                  extended by com.atlassian.confluence.AbstractConfluenceAcceptanceTest
All Implemented Interfaces:
junit.framework.Test
Direct Known Subclasses:
AbstractAdminAcceptanceTest, AbstractLdapAcceptanceTest, AbstractMultimediaMacroAcceptanceTest, AbstractNotificationsAcceptanceTest, AbstractPermissionsAcceptanceTest, AbstractRpcAcceptanceTest, AbstractSoapRpcAcceptanceTest, ActionAutowireSecurityAcceptanceTest, AddPageAcceptanceTest, AddPageSecurityAcceptanceTest, AdminForceUpgradeAcceptanceTest, AntiXSSAcceptanceTest, AtlassianSecurityAcceptanceTest, AtlassianUserUpgradeAcceptanceTest, AttachedImagesJsonAcceptanceTest, AttachmentAcceptanceTest, AttachmentMigrationAcceptanceTest, AttachmentUploadAcceptanceTest, BackupAndRestoreXsrfAcceptanceTest, BackupImportAcceptanceTODOTest, BasicSoapAcceptanceTest, BigAcceptanceTest, BlogAcceptanceTest, BlogSlowAcceptanceTest, BrowseMenuAcceptanceTest, BrowserLanguageAcceptanceTest, BrowseSpaceAcceptanceTest, BundledPluginsAcceptanceTest, CacheSizeChangeAcceptanceTest, CaptchaAcceptanceTest, ClasspathAcceptanceTest, ColourSchemeAcceptanceTest, ColourSchemeXsrfAcceptanceTest, CommentsAcceptanceTest, CommentXsrfAcceptanceTest, ConfigureLoggingAcceptanceTest, ContentNameSearchAcceptanceTest, CreateContentXsrfAcceptanceTest, CreateSpaceAcceptanceTest, CreateSpaceXsrfAcceptanceTest, CustomHtmlAcceptanceTest, CustomHtmlXsrfAcceptanceTest, CustomizeLogoAcceptanceTest, CustomLogoMigrationAcceptanceTest, CustomStylesheetXsrfAcceptanceTest, DarkFeaturesAcceptanceTest, DashboardActionsSpacesAcceptanceTest, DashboardActionTemplatesAcceptanceTest, DashboardRecentlyUpdatedContentMacroAcceptanceTest, DateFormatAcceptanceTest, DecoratorAcceptanceTest, DiffPagesAcceptanceTest, DocThemeAcceptanceTest, DraftsAcceptanceTest, DraftsXsrfAcceptanceTest, EditDefaultSpaceContentAcceptanceTest, EditLayoutsAcceptanceTest, EditSpaceAcceptanceTest, EmailAndLinkExternalizationAcceptanceTest, EmbeddedCrowdUpgradeAcceptanceTest, EmbeddedObjectAcceptanceTest, ErrorPageAcceptanceTest, EventsAcceptanceTest, ExcerptMacroAcceptanceTest, ExternalGadgetDirectoryAcceptanceTest, FavouritePageXsrfAcceptanceTest, FavouriteSpaceXsrfAcceptanceTest, FileHandleTestingSuite.FileHandleTest, FiveHundredPageSecurityAcceptanceTest, FlushCacheAcceptanceTest, FuncTestPermissionAcceptanceTest, GadgetCustomWhitelistAcceptanceTest, GadgetWhiteListAcceptanceTest, GalleryAcceptanceTest, GeneralConfigurationAcceptanceTest, GlobalAdminAcceptanceTest, GlobalAdminXsrfAcceptanceTest, GlobalEntitiesAcceptanceTest, GlobalLogoXsrfAcceptanceTest, GlobalPermissionsXsrfAcceptanceTest, GlobalReportsAcceptanceTest, GroupMembersAcceptanceTest, GroupPickerAcceptanceTest, GzipFilterAcceptanceTest, HistoricalPageViewAcceptanceTest, HtmlExportAcceptanceTest, HttpHeadersAcceptanceTest, HttpMethodValidationAcceptanceTest, I18nModeAcceptanceTest, I18nResourceAcceptanceTest, ImportPagesFromDiskAcceptanceTest, ImportPagesXsrfAcceptanceTest, IncomingLinkAcceptanceTest, IndexingAcceptanceTest, JobPluginAcceptanceTest, JohnsonFilterAcceptanceTest, KnownBugsAcceptanceTest, LabelsAcceptanceTest, LanguageAcceptanceTest, LargeImportAcceptanceTest, LicensingAcceptanceTest, LinkTypeAcceptanceTest, ListPageAlternativesAcceptanceTest, LoggingAndProfilingXsrfAcceptanceTest, LoginAcceptanceTest, LogoutAcceptanceTest, MacroDiffAcceptanceTest, MacroMigrationAcceptanceTest, MacroPluginAcceptanceTest, MacrosAcceptanceTest, MailAcceptanceTest, MailQueueXsrfAcceptanceTest, ManageUsersAndGroupsXsrfAcceptanceTest, MovePageAcceptanceTest, MultipleAttachmentsAcceptanceTest, NetworkTabAcceptanceTest, Node, NonClusterLicensingAcceptanceTest, NotificationImportAcceptanceTest, NotificationsXsrfAcceptanceTest, OpenSearchAcceptanceTest, OrphanedPagesAcceptanceTest, PackageTemplateAcceptanceTest, PageDestinationSearchAcceptanceTest, PageEditAcceptanceTest, PageExportAcceptanceTest, PageHistoryAcceptanceTest, PageHistoryXsrfAcceptanceTest, PageInfoAcceptanceTest, PageListingAcceptanceTest, PageNotFoundAcceptanceTest, PageOperationsAcceptanceTest, PageTemplatesAcceptanceTest, PageTitlesAcceptanceTest, PageTreeMovePageAcceptanceTest, PageXsrfAcceptanceTest, PaginationAcceptanceTest, PeopleDirectoryAcceptanceTest, PersonalLabelsAcceptanceTest, PersonalSpaceAcceptanceTest, PlatformCtkAcceptanceTest, PluginAcceptanceTest, PluginAdminXsrfAcceptanceTest, PluginDecorationAcceptanceTest, PopularLabelsMacroAcceptanceTest, RaiseSupportRequestXsrfAcceptanceTest, RecentlyUpdatedContentMacroAcceptanceTest, RecentlyUsedLabelsMacroAcceptanceTest, RefactoringAcceptanceTest, RelatedContentRefactorerAcceptanceTest, RemoveClassicThemeAcceptanceTest, RemovePageRestrictionsXsrfAcceptanceTest, RemoveSpaceAcceptanceTest, ReportsAcceptanceTest, RestAcceptanceTest, RpcVersion1AcceptanceTest, RpcVersion2AcceptanceTest, RssAcceptanceTest, RssFeedBuilderAcceptanceTest, ScheduleJobAdminXsrfAcceptanceTest, SearchAcceptanceTest, SearchSuggestionsAcceptanceTest, SecurityAcceptanceTest, SecurityConfigurationAcceptanceTest, ServletPluginAcceptanceTest, SignupAcceptanceTest, SiteExportAcceptanceTest, SiteImportAcceptanceTest, SiteSupportAcceptanceTest, SpaceAdminAcceptanceTest, SpaceAdminXsrfAcceptanceTest, SpaceAdvancedAcceptanceTest, SpaceDetailsAcceptanceTest, SpaceExportAcceptanceTest, SpaceExportXsrfAcceptanceTest, SpaceImportAcceptanceTest, SpaceKeyDirectoryTraversalAcceptanceTest, SpaceLabelsAcceptanceTest, SpaceLogoXsrfAcceptanceTest, SpacePermissionsXsrfAcceptanceTest, SpacesListMacroAcceptanceTest, SpacesListMacroAcceptanceTest, SpaceTemplateAcceptanceTest, SpringPluginUploadAcceptanceTest, StylesheetAcceptanceTest, SuperbatchAcceptanceTest, SupportRequestAcceptanceTest, SupportToolsPluginAcceptanceTest, SupportUtilityAcceptanceTest, SystemInformationAcceptanceTest, TestRequestLicenseFromMac, ThemeChangeAcceptanceTest, ThemesXsrfAcceptanceTest, ThreadedCommentAcceptanceTest, ThumbnailAcceptanceTest, TimeZoneAcceptanceTest, TrackbackAcceptanceTest, TrashCanAcceptanceTest, TrustedApplicationAcceptanceTest, TrustedApplicationXsrfAcceptanceTest, UndefinedPagesAcceptanceTest, UpdateLicenseDetailsXsrfAcceptanceTest, UpdateStatusXsrfAcceptanceTest, UPMAcceptanceTest, UserFollowAcceptanceTest, UserFollowXsrfAcceptanceTest, UserHoverAcceptanceTest, UserMacrosAcceptanceTest, UserManagementAcceptanceTest, UserManagementReadOnlyAcceptanceTest, UserMenuAcceptanceTest, UserPickerAcceptanceTest, UserPreferencesAcceptanceTest, UserProfileAcceptanceTest, UserProfilePictureXsrfAcceptanceTest, UserProfileXsrfAcceptanceTest, UserStatusAcceptanceTest, UserStatusPermissionsAcceptanceTest, VelocityDeprecationAcceptanceTest, ViewSourceAcceptanceTest, WebDavAcceptanceTest, WebItemPluginAcceptanceTest, WebPanelAcceptanceTest, WebResourceTransformerAcceptanceTest, WebSudoAcceptanceTest, WelcomeMessageAcceptanceTest, WordExportAcceptanceTest

public abstract class AbstractConfluenceAcceptanceTest
extends AbstractAtlassianWebTestCase

This super class provides Confluence specific functions useful in acceptance tests.


Field Summary
protected  AdminConsole adminConsole
           
static String ANONYMOUS_USER
           
protected static String BROWSE_MENU_LINK_ID
           
static String context
           
protected static boolean CROWD_MODE
           
static String DASHBOARD_RECENT_UPDATES_URL
           
protected static DirectoryConfiguration DIRECTORY_CONFIG
           
protected  List<File> filesToDelete
           
protected  org.slf4j.Logger log
           
protected  LogAdjuster logAdjuster
          Can be used by subclasses to turn logging on the server up or down for just one test.
protected  LoginHelper loginHelper
           
protected  MailServices mailServices
           
static RandomnessHandler RANDOM
           
protected  ConfluenceRpc rpc
           
protected  ServerStateManager serverStateManager
           
protected static String SMTP_SUBJECT_PREFIX
           
static User TEST_ADMIN
           
static String TEST_ADMIN_EMAIL
           
static String TEST_ADMIN_FULLNAME
           
static String TEST_ADMIN_PASSWORD
           
static String TEST_ADMIN_USERNAME
           
 BlogPost TEST_BLOG
           
 Comment TEST_COMMENT
           
static String TEST_GEN_EMAIL1
           
static String TEST_GEN_EMAIL2
           
static String TEST_GEN_FULLNAME1
           
static String TEST_GEN_FULLNAME2
           
static String TEST_GEN_PASSWORD1
           
static String TEST_GEN_PASSWORD2
           
static String TEST_GEN_USERNAME1
           
static String TEST_GEN_USERNAME2
           
protected static String TEST_GROUP1
           
 Page TEST_PAGE
           
 Space TEST_SPACE
           
 Space TEST_SPACE2
           
static User TEST_USER1
           
static User TEST_USER2
           
static String TESTBLOG_CONTENT
           
static String TESTBLOG_TITLE
           
protected  TestData testData
           
static String TESTMAILSERVER_HOSTNAME
           
static String TESTMAILSERVER_NAME
           
static String TESTPAGE_COMMENT
           
static String TESTPAGE_CONTENT
           
static String TESTPAGE_TITLE
           
static String TESTSPACE_KEY
           
static String TESTSPACE_TITLE
           
static String TESTSPACE2_KEY
           
static String TESTSPACE2_TITLE
           
protected  UserManagementHelper userHelper
           
protected static String VIEW_PERSONAL_SPACE_LINK
           
protected  ConfluenceRpc wikiMarkupRpc
          Use this for tests where you want to create pages/comments/blogs using wikimarkup.
 
Constructor Summary
AbstractConfluenceAcceptanceTest()
           
AbstractConfluenceAcceptanceTest(String testName)
           
 
Method Summary
 void addUserToGroupViaHelper(String username, String groupname)
          Adds the given user to a groupname
 ViewContentBean addWatchPage()
           
 void assertImagePresent(String imageName)
          Provide our own implementation of ThreadLocalWebTestCase.assertImagePresent(String, String) that asserts the image name with a contains check rather than equals.
 void assertImageValid(String imgSrc, String imgAlt)
          We override the default implementation of this method as it has a bug when dealing with relative URLs

Basically if we are on the page /display/blah.action and there is an image src with /images/blah.gif, the default implementation will verify that the img src matches but will attempt to request the image at the URL /display/images/blah.gif.

 void assertLinkPresentWithExactTextAndClass(String linkText, String cls)
           
protected  void assertMailReceived()
           
protected  void assertNoMailReceived()
           
 void attachFile(File attachment)
          Click the attach file link, attach a given file with a given comment and submit the attachment form.
 void attachFile(File attachment, String comment)
          Click the attach file link, attach a given file with a given comment and submit the attachment form.
 void attachFileWithName(String fileName, InputStream in, String comment)
          Click the attach file link, attach a given file with a given comment and submit the attachment form.
 void createGroup(String group)
          Create a group via the Web Interface.
 void createGroupViaHelper(String groupName)
          Creates a group with the given name
 void createMail(File mail, String spaceKey)
           
 ViewContentBean createPage(String spaceKey, String title, String content, String parentPageTitle)
           
 ViewContentBean createPageWithViewRestrictions(String spaceKey, String title, String content, String parentPageTitle, String viewPermissionUsers)
           
 void createSpaceViaWebUI(Space space)
           
protected  void createTestMailServer()
          Starts up and configures a new mail server which will be pulled back down during tearDown().
 void createTestSpaceViaWebUI()
          For those times we need to ensure a space was created via the web UI (For example if the web UI may behave differently to RPC)
 void createUserViaHelper(User user)
          Creates a new user with the given details.
 void disableAnonymousAccess()
           
 EditContentBean editPage(String spaceKey, String pageTitle)
           
 void editPageContent(String content)
          Sets content via RPC, as the admin user.
 void editPageWithContent(String spaceKey, String title, String content)
           
 void editSpaceDescription(User user, String spaceKey, String newDescription)
           
 void editSpacePermsForm()
           
 void enableAnonymousAccess()
           
 void ensureTestUserCanViewTestSpace()
          Deprecated. since 3.5 permissions should be granted using SpacePermissions.grantPermission(com.atlassian.confluence.it.SpacePermission, User) (which already ensures that users can view a space before other permissions are granted)
 void forceViewGlobalAdmin()
           
protected  String generateBaseUrl()
           
 File generateFile(String filename, String contents)
           
 String getAppContext()
           
 String getBaseUrl()
           
 String getConfiguredBaseUrl()
          Returns the configured base URL in the Confluence app.
 int getCurrentMailQueueSize()
           
protected  long getCurrentPageId()
           
 String getFriendlyRelativeDate(Date now, Date date, TimeZone timeZone)
          Use the FriendlyDateFormatter to format the date relative to the "now" time.
protected  String getLoginButtonId()
          HACK - temp method to get tests checking for login screen working.
 long getPageId(String spaceKey, String title)
           
protected  PluginHelper getPluginHelper()
           
 void gotoPageWithError(String url)
           
 void importMail(String filePath, String spaceKey)
          Creates mails in the specified space.
 void importMailAndAssertNoRunningTask(String filePath, String spaceKey)
          Creates mails in the specified space and then checks if it successfully moved to the No Long Running Task page.
 boolean isClustered()
           
 void logIn(User user, String destination)
          Log in as the specified user, going to the provided URL (relative to the context path) after logging in using redirect.
 void logInAs(String username, String password)
          Log in as the specified user, going to START_LOCATION.
 void logInAs(String username, String password, boolean rememberMe)
          Log in with the given details.
 void logInAs(User user)
          Log in as the specified user, going to the default start page.
 void logInAsAdminAtHomepage()
           
 void logInAsAtHomepage(String username, String password)
          Logs in and then goes straight to "/"
 void logInAsAtHomepage(User user)
          Logs in fast and then goes straight to "/"
 void loginAsTestUser()
           
 void loginAsTestUser2()
           
 void loginAsTestUserAtHomepage()
           
protected  void loginViaForm(String username, String password, boolean rememberMe)
           
 void logout()
          Log out by going straight to the regular logout.action and then starting a new conversation at the start location, usually noop.jsp.
 void movePage(String title, Space oldSpace, Space newSpace)
           
 void movePage(String spaceKey, String title, String newSpaceKey)
           
 void movePageToNewParent(String spaceKey, String title, String newParentPage)
           
 void movePageToNewParent(String oldSpaceKey, String title, String newSpaceKey, String newParentPage)
           
 void movePageToNewSpace(String spaceKey, String title, String newSpaceKey)
           
protected  void rebuildIndex()
           
 void removeGroup(String groupName)
          Delete a group via the Web Interface.
 void removePageLabel(String spaceKey, String pageTitle)
           
 void removePageOrBlogById(long id)
           
 void removeTestUser1ViaHelper()
          Removes the test user
 void removeUserViaHelper(String username)
          Removes a user with the given username
 void renamePage(String spaceKey, String originalPageTitle, String newPageTitle)
           
 void search(String query)
           
 void setAttachmentMaxUploadSize(long max)
           
 JSONObject setBlogLabels(Space space, String blogTitle, String labels)
          Add the specified labels to the blog
 void setEditPermissionsForGroups(String spaceKey, String pageTitle, String groups)
          Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)
 void setEditPermissionsForUsers(String spaceKey, String pageTitle, String users)
          Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)
 void setMaxAttachmentsInUI(long max)
           
 JSONObject setPageLabels(String spaceKey, String pageTitle, String labels)
          Add the specified labels to the page
 void setThreadedComments(boolean enable)
           
protected  void setUp()
           
protected  void setUp(String beginAt)
          Default setUp method.
protected  void setUpTestNG(Method method)
          Called by TestNG, calls setUp() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.
 void setViewPermissionsForGroups(String spaceKey, String pageTitle, String groups)
          Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)
 void setViewPermissionsForUsers(String spaceKey, String pageTitle, String users)
          Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)
 void stopTestMailServer()
           
protected  void tearDown()
          Default tearDown method.
protected  void tearDownTestNG()
          Called by TestNG, calls tearDown() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.
 GlobalPermissions viewGlobalPermissions()
           
 void viewHomepage()
           
 void viewLabel(String spaceKey, String labelName)
           
 void viewLanguages()
           
 ViewContentBean viewPage(long pageId)
           
 ViewContentBean viewPage(String spaceKey, String pageTitle)
           
 void viewPeopleDirectory()
           
 SpaceAdmin viewSpaceAdmin()
           
 void viewSpaceAdvanced()
           
 void viewSpaceContent()
           
 SpacePermissions viewSpacePermissions(Space space)
           
 void viewSpaceSummary()
           
 void viewSpaceSummary(String spaceKey)
           
 void viewTrash()
           
 ViewContentBean watchPage(String spaceKey, String pageTitle)
           
 void watchSpace(Space space)
           
 void watchSpace(String spaceKey)
           
 
Methods inherited from class com.atlassian.confluence.AbstractAtlassianWebTestCase
assertCollectionContainsKeyWithValue, assertContains, assertContainsRegex, assertDoesNotContain, assertEndsWith, assertLinkNotPresentWithHrefContaining, assertLinkPresentWithHref, assertLinkPresentWithHrefContaining, assertLinkPresentWithTextAndHref, assertPageTitleEquals, assertServerResponseContains, assertServerResponseDoesNotContain, assertStartsWith, assertStatusCode, assertTextPresentInPageSource, assertTextsPresentInOrder, assertTextsPresentInOrder, assertTitleEquals, assertTitleEquals, getGroupFromResponse, setTextFieldUnlessBlank
 
Methods inherited from class com.atlassian.confluence.ThreadLocalWebTestCase
assertButtonNotPresent, assertButtonNotPresentWithText, assertButtonPresent, assertButtonPresentWithText, assertCheckboxNotPresent, assertCheckboxNotPresent, assertCheckboxNotSelected, assertCheckboxNotSelected, assertCheckboxPresent, assertCheckboxPresent, assertCheckboxSelected, assertCheckboxSelected, assertCookiePresent, assertCookieValueEquals, assertCookieValueMatch, assertDownloadedFileEquals, assertElementNotPresent, assertElementNotPresentByXPath, assertElementPresent, assertElementPresentByXPath, assertFormElementEmpty, assertFormElementEquals, assertFormElementMatch, assertFormElementNotPresent, assertFormElementPresent, assertFormNotPresent, assertFormNotPresent, assertFormPresent, assertFormPresent, assertFramePresent, assertHiddenFieldPresent, assertImagePresent, assertImageValidAndStore, assertKeyInTable, assertKeyInTable, assertKeyNotInTable, assertKeyNotPresent, assertKeyNotPresent, assertKeyPresent, assertKeyPresent, assertKeysInTable, assertKeysInTable, assertLinkNotPresent, assertLinkNotPresentWithExactText, assertLinkNotPresentWithExactText, assertLinkNotPresentWithImage, assertLinkNotPresentWithText, assertLinkNotPresentWithText, assertLinkPresent, assertLinkPresentWithExactText, assertLinkPresentWithExactText, assertLinkPresentWithImage, assertLinkPresentWithText, assertLinkPresentWithText, assertMatch, assertMatchInElement, assertMatchInTable, assertMatchInTable, assertNoMatch, assertNoMatchInElement, assertNoMatchInTable, assertNoMatchInTable, assertRadioOptionNotPresent, assertRadioOptionNotSelected, assertRadioOptionPresent, assertRadioOptionSelected, assertResetButtonNotPresent, assertResetButtonNotPresent, assertResetButtonPresent, assertResetButtonPresent, assertSelectedOptionEquals, assertSelectedOptionMatches, assertSelectedOptionsEqual, assertSelectedOptionsMatch, assertSelectedOptionValueEquals, assertSelectedOptionValuesEqual, assertSelectOptionNotPresent, assertSelectOptionPresent, assertSelectOptionsEqual, assertSelectOptionsNotEqual, assertSelectOptionsPresent, assertSelectOptionValueNotPresent, assertSelectOptionValuePresent, assertSelectOptionValuesEqual, assertSelectOptionValuesNotEqual, assertSelectOptionValuesPresent, assertSubmitButtonNotPresent, assertSubmitButtonNotPresent, assertSubmitButtonPresent, assertSubmitButtonPresent, assertSubmitButtonPresent, assertTableEquals, assertTableEquals, assertTableMatch, assertTableMatch, assertTableNotPresent, assertTablePresent, assertTableRowCountEquals, assertTableRowsEqual, assertTableRowsEqual, assertTableRowsMatch, assertTableRowsMatch, assertTextFieldEquals, assertTextInElement, assertTextInTable, assertTextInTable, assertTextNotInElement, assertTextNotInTable, assertTextNotInTable, assertTextNotPresent, assertTextPresent, assertTitleEqualsKey, assertTitleEqualsKey, assertTitleMatch, assertWindowCountEquals, assertWindowPresent, assertWindowPresent, assertWindowPresentWithTitle, beginAt, checkCheckbox, checkCheckbox, clickButton, clickButtonWithText, clickElementByXPath, clickLink, clickLinkWithExactText, clickLinkWithExactText, clickLinkWithImage, clickLinkWithText, clickLinkWithText, clickRadioOption, closeBrowser, closeWindow, dumpCookies, dumpHtml, dumpHtml, dumpTable, dumpTable, getDialog, getElementAttributByXPath, getElementTextByXPath, getFormElementValue, getImage, getMessage, getMessage, getPageSource, getServeurResponse, getTable, getTestContext, getTester, getTestingEngineKey, gotoFrame, gotoPage, gotoRootWindow, gotoWindow, gotoWindow, gotoWindowByTitle, removeThreadLocal, reset, runBare, saveAs, selectOption, selectOptionByValue, selectOptions, selectOptionsByValues, setDialog, setExpectedJavaScriptAlert, setExpectedJavaScriptAlert, setExpectedJavaScriptConfirm, setExpectedJavaScriptConfirm, setExpectedJavaScriptPrompt, setExpectedJavaScriptPrompt, setFormElement, setScriptingEnabled, setTestContext, setTester, setTestingEngineKey, setTextField, setWorkingForm, setWorkingForm, setWorkingForm, submit, submit, submit, uncheckCheckbox, uncheckCheckbox, wrapWithPageSourceOnError
 
Methods inherited from class junit.framework.TestCase
countTestCases, createResult, getName, run, run, runTest, setName, toString
 
Methods inherited from class junit.framework.Assert
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final transient org.slf4j.Logger log

context

public static final String context

testData

protected TestData testData

DIRECTORY_CONFIG

protected static DirectoryConfiguration DIRECTORY_CONFIG

CROWD_MODE

protected static final boolean CROWD_MODE

TEST_ADMIN

public static final User TEST_ADMIN

TEST_ADMIN_USERNAME

public static final String TEST_ADMIN_USERNAME

TEST_ADMIN_PASSWORD

public static final String TEST_ADMIN_PASSWORD

TEST_ADMIN_FULLNAME

public static final String TEST_ADMIN_FULLNAME

TEST_ADMIN_EMAIL

public static final String TEST_ADMIN_EMAIL

TEST_USER1

public static final User TEST_USER1

TEST_GEN_USERNAME1

public static final String TEST_GEN_USERNAME1

TEST_GEN_PASSWORD1

public static final String TEST_GEN_PASSWORD1

TEST_GEN_FULLNAME1

public static final String TEST_GEN_FULLNAME1

TEST_GEN_EMAIL1

public static final String TEST_GEN_EMAIL1

TEST_USER2

public static final User TEST_USER2

TEST_GEN_USERNAME2

public static final String TEST_GEN_USERNAME2

TEST_GEN_PASSWORD2

public static final String TEST_GEN_PASSWORD2

TEST_GEN_FULLNAME2

public static final String TEST_GEN_FULLNAME2

TEST_GEN_EMAIL2

public static final String TEST_GEN_EMAIL2

ANONYMOUS_USER

public static final String ANONYMOUS_USER
See Also:
Constant Field Values

TEST_GROUP1

protected static final String TEST_GROUP1
See Also:
Constant Field Values

TEST_SPACE

public Space TEST_SPACE

TEST_SPACE2

public Space TEST_SPACE2

TESTSPACE_TITLE

public static String TESTSPACE_TITLE

TESTSPACE_KEY

public static String TESTSPACE_KEY

TESTSPACE2_TITLE

public static String TESTSPACE2_TITLE

TESTSPACE2_KEY

public static String TESTSPACE2_KEY

TESTPAGE_TITLE

public static final String TESTPAGE_TITLE
See Also:
Constant Field Values

TESTPAGE_CONTENT

public static final String TESTPAGE_CONTENT
See Also:
Constant Field Values

TESTPAGE_COMMENT

public static final String TESTPAGE_COMMENT
See Also:
Constant Field Values

TESTBLOG_TITLE

public static final String TESTBLOG_TITLE
See Also:
Constant Field Values

TESTBLOG_CONTENT

public static final String TESTBLOG_CONTENT
See Also:
Constant Field Values

TEST_PAGE

public Page TEST_PAGE

TEST_BLOG

public BlogPost TEST_BLOG

TEST_COMMENT

public Comment TEST_COMMENT

TESTMAILSERVER_NAME

public static final String TESTMAILSERVER_NAME
See Also:
Constant Field Values

TESTMAILSERVER_HOSTNAME

public static final String TESTMAILSERVER_HOSTNAME

RANDOM

public static final RandomnessHandler RANDOM

BROWSE_MENU_LINK_ID

protected static final String BROWSE_MENU_LINK_ID
See Also:
Constant Field Values

SMTP_SUBJECT_PREFIX

protected static final String SMTP_SUBJECT_PREFIX
See Also:
Constant Field Values

wikiMarkupRpc

protected ConfluenceRpc wikiMarkupRpc
Use this for tests where you want to create pages/comments/blogs using wikimarkup.


rpc

protected ConfluenceRpc rpc

serverStateManager

protected ServerStateManager serverStateManager

filesToDelete

protected List<File> filesToDelete

userHelper

protected UserManagementHelper userHelper

loginHelper

protected LoginHelper loginHelper

mailServices

protected MailServices mailServices

adminConsole

protected AdminConsole adminConsole

VIEW_PERSONAL_SPACE_LINK

protected static final String VIEW_PERSONAL_SPACE_LINK
See Also:
Constant Field Values

logAdjuster

protected LogAdjuster logAdjuster
Can be used by subclasses to turn logging on the server up or down for just one test. LogAdjuster.resetLogLevels() is called in tearDown().


DASHBOARD_RECENT_UPDATES_URL

public static final String DASHBOARD_RECENT_UPDATES_URL
See Also:
Constant Field Values
Constructor Detail

AbstractConfluenceAcceptanceTest

public AbstractConfluenceAcceptanceTest(String testName)

AbstractConfluenceAcceptanceTest

public AbstractConfluenceAcceptanceTest()
Method Detail

setUp

protected void setUp()
              throws Exception
Overrides:
setUp in class junit.framework.TestCase
Throws:
Exception

setUpTestNG

protected void setUpTestNG(Method method)
                    throws Exception
Called by TestNG, calls setUp() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.

Parameters:
method - The test method being called
Throws:
Exception - if setup fails

setUp

protected void setUp(String beginAt)
              throws Exception
Default setUp method. Establishes XML-RPC connection and sets the base URL. Also configures LDAP repository.

Parameters:
beginAt - the initial path (relative to the context path) to begin at
Throws:
Exception - from super

getPluginHelper

protected PluginHelper getPluginHelper()

tearDownTestNG

protected void tearDownTestNG()
                       throws Exception
Called by TestNG, calls tearDown() on the current class, prevents the need to put this annotation everywhere, and sets the test name properly.

Throws:
Exception - if tear down fails

tearDown

protected void tearDown()
                 throws Exception
Default tearDown method. Removes any files which were added to the filesToDelete list.

Overrides:
tearDown in class ThreadLocalWebTestCase
Throws:
Exception

generateBaseUrl

protected String generateBaseUrl()
Returns:
a random base URL selected from the nodes in the cluster. Used for switching between nodes for cluster testing.

getConfiguredBaseUrl

public String getConfiguredBaseUrl()
Returns the configured base URL in the Confluence app. This is the same as the base URL of node #1 in a cluster.

Returns:
it

logInAs

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


logInAs

public void logInAs(User user)
Log in as the specified user, going to the default start page.

Parameters:
user - the user to log in as.

logInAsAtHomepage

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


logInAsAtHomepage

public void logInAsAtHomepage(User user)
Logs in fast and then goes straight to "/"


logIn

public void logIn(User user,
                  String destination)
Log in as the specified user, going to the provided URL (relative to the context path) after logging in using redirect. Note that this is a slow way to log in. If you are not testing the redirect functionality it should be faster to call LoginHelper.login(com.atlassian.confluence.it.User), followed by an explicit visit to the destination.

Parameters:
user - the user to log in as.
destination - where to go after logging in. Pass 'null' to go to the default homepage.

logInAs

public void logInAs(String username,
                    String password,
                    boolean rememberMe)
Log in with the given details. Note that the resulting page is decorated with menus and thus this call is quite slow. Preferably call LoginHelper.logInFast(com.atlassian.confluence.it.User).


loginViaForm

protected void loginViaForm(String username,
                            String password,
                            boolean rememberMe)

getLoginButtonId

protected 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

logInAsAdminAtHomepage

public void logInAsAdminAtHomepage()

loginAsTestUser

public void loginAsTestUser()

loginAsTestUserAtHomepage

public void loginAsTestUserAtHomepage()

loginAsTestUser2

public void loginAsTestUser2()

logout

public void logout()
Log out by going straight to the regular logout.action and then starting a new conversation at the start location, usually noop.jsp. You probably want to call LoginHelper.logOutSlowly() instead if you're testing what logging out actually does, and LoginHelper.logout() if you just want to clean up the session as fast as possible.

See Also:
LoginHelper.logout(), LoginHelper.logOutSlowly()

assertLinkPresentWithExactTextAndClass

public void assertLinkPresentWithExactTextAndClass(String linkText,
                                                   String cls)

createSpaceViaWebUI

public void createSpaceViaWebUI(Space space)

createTestSpaceViaWebUI

public void createTestSpaceViaWebUI()
For those times we need to ensure a space was created via the web UI (For example if the web UI may behave differently to RPC)


createPage

public ViewContentBean createPage(String spaceKey,
                                  String title,
                                  String content,
                                  String parentPageTitle)

createPageWithViewRestrictions

public ViewContentBean createPageWithViewRestrictions(String spaceKey,
                                                      String title,
                                                      String content,
                                                      String parentPageTitle,
                                                      @Nullable
                                                      String viewPermissionUsers)

getPageId

public long getPageId(String spaceKey,
                      String title)

getCurrentPageId

protected long getCurrentPageId()

viewPage

public ViewContentBean viewPage(String spaceKey,
                                String pageTitle)

viewPage

public ViewContentBean viewPage(long pageId)

viewLabel

public void viewLabel(String spaceKey,
                      String labelName)

editPage

public EditContentBean editPage(String spaceKey,
                                String pageTitle)

movePageToNewSpace

public void movePageToNewSpace(String spaceKey,
                               String title,
                               String newSpaceKey)

movePage

public void movePage(String spaceKey,
                     String title,
                     String newSpaceKey)

movePage

public void movePage(String title,
                     Space oldSpace,
                     Space newSpace)

movePageToNewParent

public void movePageToNewParent(String spaceKey,
                                String title,
                                String newParentPage)

movePageToNewParent

public void movePageToNewParent(String oldSpaceKey,
                                String title,
                                String newSpaceKey,
                                String newParentPage)

createUserViaHelper

public void createUserViaHelper(User user)
Creates a new user with the given details. Depending on the value of the ldapMode test property the user is created in an ldap repository or via the XML-RPC interface.

Parameters:
user - the user to create

removeUserViaHelper

public void removeUserViaHelper(String username)
Removes a user with the given username

Parameters:
username - the username of the user to remove

removeTestUser1ViaHelper

public void removeTestUser1ViaHelper()
Removes the test user


createGroupViaHelper

public void createGroupViaHelper(String groupName)
Creates a group with the given name

Parameters:
groupName - the name of the group to be created

createGroup

public void createGroup(String group)
Create a group via the Web Interface. This should only be used where the web interface itself is being tested. It cannot be used when the UserRepository being tested is unmodifiable.

Parameters:
group - name of group

addUserToGroupViaHelper

public void addUserToGroupViaHelper(String username,
                                    String groupname)
Adds the given user to a groupname

Parameters:
username - the username of the user to be added
groupname - the group the user should be added to

removeGroup

public void removeGroup(String groupName)
Delete a group via the Web Interface. This should only be used where the web interface itself is being tested. It cannot be used when the UserRepository being tested is unmodifiable.

Parameters:
groupName - name of group to remove

viewPeopleDirectory

public void viewPeopleDirectory()

viewGlobalPermissions

public GlobalPermissions viewGlobalPermissions()

viewLanguages

public void viewLanguages()

viewSpaceAdmin

public SpaceAdmin viewSpaceAdmin()

viewSpaceSummary

public void viewSpaceSummary()

viewSpaceSummary

public void viewSpaceSummary(String spaceKey)

viewSpacePermissions

public SpacePermissions viewSpacePermissions(Space space)

viewHomepage

public void viewHomepage()

viewSpaceContent

public void viewSpaceContent()

viewTrash

public void viewTrash()

setThreadedComments

public void setThreadedComments(boolean enable)

ensureTestUserCanViewTestSpace

@Deprecated
public void ensureTestUserCanViewTestSpace()
Deprecated. since 3.5 permissions should be granted using SpacePermissions.grantPermission(com.atlassian.confluence.it.SpacePermission, User) (which already ensures that users can view a space before other permissions are granted)


editSpacePermsForm

public void editSpacePermsForm()

enableAnonymousAccess

public void enableAnonymousAccess()

disableAnonymousAccess

public void disableAnonymousAccess()

attachFile

public void attachFile(File attachment)
Click the attach file link, attach a given file with a given comment and submit the attachment form.

Parameters:
attachment - the file attachment

attachFile

public void attachFile(File attachment,
                       @Nullable
                       String comment)
Click the attach file link, attach a given file with a given comment and submit the attachment form.

Parameters:
attachment - the file attachment
comment - the comment for the attachment

attachFileWithName

public void attachFileWithName(String fileName,
                               InputStream in,
                               String comment)
Click the attach file link, attach a given file with a given comment and submit the attachment form.

Parameters:
fileName - the filename to attach
in - the stream to read the file
comment - a comment for this attachment

createMail

public void createMail(File mail,
                       String spaceKey)

setAttachmentMaxUploadSize

public void setAttachmentMaxUploadSize(long max)

setMaxAttachmentsInUI

public void setMaxAttachmentsInUI(long max)

search

public void search(String query)

getAppContext

public String getAppContext()

importMailAndAssertNoRunningTask

public void importMailAndAssertNoRunningTask(String filePath,
                                             String spaceKey)
Creates mails in the specified space and then checks if it successfully moved to the No Long Running Task page. Mail import can be done with an Mbox file or single mail.

Parameters:
filePath - the file path to the mailbox
spaceKey - the space key to import into

importMail

public void importMail(String filePath,
                       String spaceKey)
Creates mails in the specified space. Mail import can be done with an Mbox file or single mail. No explicit assertions are made by this method.

Parameters:
filePath - the file path to the mailbox
spaceKey - the space key to import into

renamePage

public void renamePage(String spaceKey,
                       String originalPageTitle,
                       String newPageTitle)

viewSpaceAdvanced

public void viewSpaceAdvanced()

addWatchPage

public ViewContentBean addWatchPage()
                             throws Exception
Throws:
Exception

watchPage

public ViewContentBean watchPage(String spaceKey,
                                 String pageTitle)

watchSpace

public void watchSpace(String spaceKey)

watchSpace

public void watchSpace(Space space)

generateFile

public File generateFile(String filename,
                         String contents)

getCurrentMailQueueSize

public int getCurrentMailQueueSize()

setViewPermissionsForUsers

@Deprecated
public void setViewPermissionsForUsers(String spaceKey,
                                                  String pageTitle,
                                                  String users)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters:
spaceKey - the space the page belongs to
pageTitle - the title of the page
users - the users to restrict view permissions to as a comma separated list of usernames.

setViewPermissionsForGroups

@Deprecated
public void setViewPermissionsForGroups(String spaceKey,
                                                   String pageTitle,
                                                   String groups)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters:
spaceKey - the space the page belongs to
pageTitle - the title of the page
groups - the groups to restrict view permissions to as a comma separated list of group names.

setEditPermissionsForUsers

@Deprecated
public void setEditPermissionsForUsers(String spaceKey,
                                                  String pageTitle,
                                                  String users)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters:
spaceKey - the space the page belongs to
pageTitle - the title of the page
users - the users to restrict edit permissions to as a comma separated list of usernames.

setEditPermissionsForGroups

@Deprecated
public void setEditPermissionsForGroups(String spaceKey,
                                                   String pageTitle,
                                                   String groups)
Deprecated. Use ConfluenceRpc.grantContentPermission(com.atlassian.confluence.it.content.security.ContentPermission, ContentEntity)

Edit the permissions of the specified page as the current user.

One doesn't need to navigate to the page before calling this method.

Parameters:
spaceKey - the space the page belongs to
pageTitle - the title of the page
groups - the groups to restrict edit permissions to as a comma separated list of group names.

removePageOrBlogById

public void removePageOrBlogById(long id)

getBaseUrl

public String getBaseUrl()
Returns:
The base url that is used in tests. Note that in case of cluster it will return a base url of the node that the current test is running against. For configured base url please use getConfiguredBaseUrl() method.

setPageLabels

public JSONObject setPageLabels(String spaceKey,
                                String pageTitle,
                                String labels)
                         throws JSONException
Add the specified labels to the page

Parameters:
spaceKey - the space key
pageTitle - the page title
labels - the labels
Returns:
a JSONObject with the server response
Throws:
JSONException - .

setBlogLabels

public JSONObject setBlogLabels(Space space,
                                String blogTitle,
                                String labels)
                         throws JSONException
Add the specified labels to the blog

Parameters:
space - the space
blogTitle - the blog title
labels - the labels
Returns:
a JSONObject with the server response
Throws:
JSONException - .

removePageLabel

public void removePageLabel(String spaceKey,
                            String pageTitle)

editPageContent

public void editPageContent(String content)
Sets content via RPC, as the admin user.

Parameters:
content - new page content

editPageWithContent

public void editPageWithContent(String spaceKey,
                                String title,
                                String content)

gotoPageWithError

public void gotoPageWithError(String url)

assertImageValid

public void assertImageValid(String imgSrc,
                             String imgAlt)
We override the default implementation of this method as it has a bug when dealing with relative URLs

Basically if we are on the page /display/blah.action and there is an image src with /images/blah.gif, the default implementation will verify that the img src matches but will attempt to request the image at the URL /display/images/blah.gif. The bug is in the method createUrl(String, URL)

Overrides:
assertImageValid in class ThreadLocalWebTestCase
See Also:
ThreadLocalWebTestCase.assertImageValidAndStore(String, String, java.io.File)

assertImagePresent

public void assertImagePresent(String imageName)
Provide our own implementation of ThreadLocalWebTestCase.assertImagePresent(String, String) that asserts the image name with a contains check rather than equals.

Parameters:
imageName - The path to the image (i.e. the src attribute value)

isClustered

public boolean isClustered()
Returns:
true if testing against a clustered intance of Confluence, false otherwise.

getFriendlyRelativeDate

public String getFriendlyRelativeDate(Date now,
                                      Date date,
                                      TimeZone timeZone)
Use the FriendlyDateFormatter to format the date relative to the "now" time. Note that the output format varies greatly even from second to second -- see FriendlyDateFormatter.

Parameters:
now - the date which the relative time is calculated in relation to
date - the date of some event which is to be formatted
timeZone - the current time zone
Returns:
a formatted relative date-time
See Also:
FriendlyDateFormatter

forceViewGlobalAdmin

public void forceViewGlobalAdmin()

createTestMailServer

protected void createTestMailServer()
                             throws BindException
Starts up and configures a new mail server which will be pulled back down during tearDown().

Throws:
BindException - If a free port could not be found

stopTestMailServer

public void stopTestMailServer()

assertNoMailReceived

protected void assertNoMailReceived()
                             throws InterruptedException
Throws:
InterruptedException

assertMailReceived

protected void assertMailReceived()
                           throws InterruptedException
Throws:
InterruptedException

rebuildIndex

protected void rebuildIndex()
                     throws InterruptedException
Throws:
InterruptedException

editSpaceDescription

public void editSpaceDescription(User user,
                                 String spaceKey,
                                 String newDescription)


Copyright © 2003-2012 Atlassian. All Rights Reserved.