com.atlassian.confluence.selenium.client
Class Editor

java.lang.Object
  extended by com.atlassian.confluence.selenium.client.Editor

public class Editor
extends Object


Nested Class Summary
static class Editor.EditorMode
           
 
Field Summary
static int EDITOR_TIMEOUT_MILLIS
           
static String MARKUP_EDITOR_ID
           
 
Constructor Summary
Editor(ConfluenceSeleniumClient client, Confluence confluence)
           
 
Method Summary
 void addComment(Page page)
           
 void cancel()
           
 void clickMarkupDefault()
           
 void clickRteDefault()
           
 PageTemplateWizard clickSelectTemplate()
           
 void createBlogPost(Space space)
           
 void createPage(Space space)
           
 void discardDraft()
           
 void edit(ContentEntity contentEntity)
           
 void edit(ContentEntity contentEntity, Editor.EditorMode mode)
          Opens the edit screen for the given content and switches to the required mode
 long getAttachmentSourceContentId()
           
 long getContentId()
           
 EditorPreview getEditorPreview()
           
 Location getLocation()
           
 MacroBrowser getMacroBrowser()
          For use when opening the macro browser manually, e.g.
 long getMarkupEditorPositionTop()
           
 String getRichTextContent()
           
 TinyMce getTinyMce()
           
 String getTitle()
          Gets the value in the editor Title field.
 String getWikiMarkupContent()
           
 boolean hasContentChanged()
          Returns true if Confluence considers the editor content to have changed.
 InsertImageDialog insertImage()
           
 boolean isRichTextMode()
           
 boolean isWikiMarkupMode()
           
 void logInAndAddComment(User user, Page page)
           
 void logInAndCreateBlogPost(User user, Space space)
           
 void logInAndCreateChildPage(User user, Space space, long parentPageId)
           
 void logInAndCreatePage(User user, Space space)
           
 void logInAndEdit(User user, ContentEntity contentEntity)
           
 void logInAndEdit(User user, ContentEntity contentEntity, Editor.EditorMode mode)
           
 TinyMce logInAndEditInRTE(User user, ContentEntity contentEntity)
          Logs the given user in, edits the given content and switches to the RTE.
 void logInAndEditMarkup(User user, ContentEntity contentEntity, String newContent)
           
 void merge()
          Click the link to merge an existing draft with the current editor content.
 LinkBrowser openLinkBrowser()
           
 MovePageDialog openLocationEditor()
           
 MacroBrowser openMacroBrowser()
           
 MacroBrowser openMacroBrowserViaShortcut()
           
 PagePermissionsEditor openPermissionsEditor()
           
 void overwriteDraft()
          Click the link to overwrite a conflicting draft with the current editor content.
 void replyToComment(Comment comment)
          Opens the reply page for the given comment
 void resumeDraft()
           
 PageView save()
           
 Editor saveAndExpectToFail()
          Saves the page and expects to return to the editor.
 void selectFirstParagraph()
           
 void selectMarkupText(String text)
          Selects the first occurrence of the given string in the Wiki Markup editor.
 void setContent(String content)
           
 void setCursorPosition(int pos)
          Sets the cursor position in the markup editor.
 void setCursorPositionToEnd()
          Puts the cursor at the end of the Wiki Markup editor.
 void setTitle(String title)
           
 void setWikiMarkupContent(String markup)
           
 void switchToMarkup()
           
 void switchToMode(Editor.EditorMode mode)
           
 EditorPreview switchToPreview()
           
 TinyMce switchToRichText()
           
 void triggerDraft()
          Triggers a draft by switching to preview mode.
 void triggerDraftAndCheckNoUserDrafts(Page page)
          Leaves a unmodified page and checks that the draft screen does NOT contain a draft with the title of the given page.
 void triggerDraftAndCheckUserDrafts()
           
 void triggerDraftAndCheckUserDrafts(BlogPost blogpost)
           
 void triggerDraftAndCheckUserDrafts(Page page)
          Triggers a draft to be saved and then checks that the draft screen contains a draft with the title of the given page.
 void triggerDraftAndEdit(Page page)
          Triggers a draft to be saved.
 void viewConflict()
          Click the link to resolve a conflict between an existing draft and the current editor content.
 void waitForDraftSavedMessage()
           
 void waitForDraftSavedMessage(long timeout)
           
 void waitForEditorPageLoad()
          Waits for the page to load with the configured editor page load timeout.
 void waitForHeartbeatMessage()
          Waits for the heartbeat message container to appear.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MARKUP_EDITOR_ID

public static final String MARKUP_EDITOR_ID
See Also:
Constant Field Values

EDITOR_TIMEOUT_MILLIS

public static final int EDITOR_TIMEOUT_MILLIS
Constructor Detail

Editor

public Editor(ConfluenceSeleniumClient client,
              Confluence confluence)
Method Detail

waitForEditorPageLoad

public void waitForEditorPageLoad()
Waits for the page to load with the configured editor page load timeout. Loading editor pages is quite slow, so it should be higher than the other configured timeouts.


logInAndCreatePage

public void logInAndCreatePage(User user,
                               Space space)

logInAndCreateChildPage

public void logInAndCreateChildPage(User user,
                                    Space space,
                                    long parentPageId)

logInAndCreateBlogPost

public void logInAndCreateBlogPost(User user,
                                   Space space)

logInAndEdit

public void logInAndEdit(User user,
                         ContentEntity contentEntity)

logInAndEdit

public void logInAndEdit(User user,
                         ContentEntity contentEntity,
                         Editor.EditorMode mode)

logInAndAddComment

public void logInAndAddComment(User user,
                               Page page)

logInAndEditInRTE

public TinyMce logInAndEditInRTE(User user,
                                 ContentEntity contentEntity)
Logs the given user in, edits the given content and switches to the RTE.

Returns:
the TinyMce reference

logInAndEditMarkup

public void logInAndEditMarkup(User user,
                               ContentEntity contentEntity,
                               String newContent)

edit

public void edit(ContentEntity contentEntity)

edit

public void edit(ContentEntity contentEntity,
                 Editor.EditorMode mode)
Opens the edit screen for the given content and switches to the required mode


addComment

public void addComment(Page page)

replyToComment

public void replyToComment(Comment comment)
Opens the reply page for the given comment

Parameters:
comment - The comment to reply to. It must have an id and page id set.

createPage

public void createPage(Space space)

createBlogPost

public void createBlogPost(Space space)

getRichTextContent

public String getRichTextContent()

getWikiMarkupContent

public String getWikiMarkupContent()

getTitle

public String getTitle()
Gets the value in the editor Title field. If the field is showing the default greyed-text title an empty string will be returned.


setWikiMarkupContent

public void setWikiMarkupContent(String markup)

setContent

public void setContent(String content)

selectFirstParagraph

public void selectFirstParagraph()

selectMarkupText

public void selectMarkupText(String text)
Selects the first occurrence of the given string in the Wiki Markup editor.


switchToMode

public void switchToMode(Editor.EditorMode mode)

switchToMarkup

public void switchToMarkup()

switchToRichText

public TinyMce switchToRichText()

switchToPreview

public EditorPreview switchToPreview()

getEditorPreview

public EditorPreview getEditorPreview()

triggerDraft

public void triggerDraft()
Triggers a draft by switching to preview mode.


waitForDraftSavedMessage

public void waitForDraftSavedMessage()

waitForDraftSavedMessage

public void waitForDraftSavedMessage(long timeout)

triggerDraftAndCheckUserDrafts

public void triggerDraftAndCheckUserDrafts(Page page)
Triggers a draft to be saved and then checks that the draft screen contains a draft with the title of the given page.


triggerDraftAndCheckUserDrafts

public void triggerDraftAndCheckUserDrafts(BlogPost blogpost)

triggerDraftAndCheckUserDrafts

public void triggerDraftAndCheckUserDrafts()

triggerDraftAndCheckNoUserDrafts

public void triggerDraftAndCheckNoUserDrafts(Page page)
Leaves a unmodified page and checks that the draft screen does NOT contain a draft with the title of the given page.


triggerDraftAndEdit

public void triggerDraftAndEdit(Page page)
Triggers a draft to be saved. It checks that the draft screen contains a draft with the title of the given page and then returns to the edit page screen.


save

public PageView save()

saveAndExpectToFail

public Editor saveAndExpectToFail()
Saves the page and expects to return to the editor. This is different from save() in that uses the editor timeout instead of the normal page view timeout and also fails if there is no editor on the page that shows after save.

Returns:
A reference to this object

cancel

public void cancel()

resumeDraft

public void resumeDraft()

discardDraft

public void discardDraft()

openPermissionsEditor

public PagePermissionsEditor openPermissionsEditor()

setTitle

public void setTitle(String title)

merge

public void merge()
Click the link to merge an existing draft with the current editor content.


viewConflict

public void viewConflict()
Click the link to resolve a conflict between an existing draft and the current editor content.


overwriteDraft

public void overwriteDraft()
Click the link to overwrite a conflicting draft with the current editor content.


setCursorPosition

public void setCursorPosition(int pos)
Sets the cursor position in the markup editor.


setCursorPositionToEnd

public void setCursorPositionToEnd()
Puts the cursor at the end of the Wiki Markup editor.


hasContentChanged

public boolean hasContentChanged()
Returns true if Confluence considers the editor content to have changed. Checks RTE and Wiki markup.


getTinyMce

public TinyMce getTinyMce()

isWikiMarkupMode

public boolean isWikiMarkupMode()

isRichTextMode

public boolean isRichTextMode()

openLocationEditor

public MovePageDialog openLocationEditor()

openMacroBrowserViaShortcut

public MacroBrowser openMacroBrowserViaShortcut()

openMacroBrowser

public MacroBrowser openMacroBrowser()

openLinkBrowser

public LinkBrowser openLinkBrowser()

getMacroBrowser

public MacroBrowser getMacroBrowser()
For use when opening the macro browser manually, e.g. via a context menu selection

Returns:
the macro browser.

insertImage

public InsertImageDialog insertImage()

getContentId

public long getContentId()

getAttachmentSourceContentId

public long getAttachmentSourceContentId()

getLocation

public Location getLocation()

getMarkupEditorPositionTop

public long getMarkupEditorPositionTop()

clickMarkupDefault

public void clickMarkupDefault()

clickRteDefault

public void clickRteDefault()

waitForHeartbeatMessage

public void waitForHeartbeatMessage()
Waits for the heartbeat message container to appear.


clickSelectTemplate

public PageTemplateWizard clickSelectTemplate()


Copyright © 2003-2011 Atlassian. All Rights Reserved.