public class

Editor

extends Object
java.lang.Object
   ↳ com.atlassian.confluence.selenium.client.Editor

Summary

Nested Classes
enum Editor.EditorMode  
Constants
String EDITOR_ID
Fields
public static final int EDITOR_TIMEOUT_MILLIS
Public Constructors
Editor(ConfluenceSeleniumClient client, Confluence confluence)
Public Methods
void addComment(PageView pageView)
Add a comment from a page view.
void addComment(Page page)
void addErrorMessage(String id, String message, boolean showInAllModes)
Adds the specified error message to the screen.
void cancel()
PageTemplateWizard clickSelectTemplate()
void closeCalanderPickerByClickInEditor()
Has the unfortunate side effect of losing your cursor position, blame tinymce.
void closeDraftMessage()
void createBlogPost(Space space)
void createPage(Space space)
PageTemplateWizard createPageFromTemplate(Space space)
PageTemplateWizard createPageFromTemplate(Space space, long parentPageId)
void discardDraft()
TinyMce edit(ContentEntity contentEntity)
long getAttachmentSourceContentId()
String getContent()
long getContentId()
EditorPreview getEditorPreview()
String getFirstMatchingPreviewNodeText(String selector)
String getHtmlSourceContent()
Location getLocation()
MacroBrowser getMacroBrowser()
For use when opening the macro browser manually, e.g.
Map<StringString> getMacroParameters(String name)
Retrieve a macro's parameters from the editor.
String getNormalisedContent()
Returns a version of getContent() that should be the same in all browsers.
String getPreviewContent()
String getPreviewSelectorScript(String selector)
String getPreviewTableCellText(int row, int column)
String getRichTextContent()
This method is deprecated. since 4.0 Use getContent() instead
TinyMce getTinyMce()
String getTitle()
Gets the value in the editor Title field.
long getToolbarPositionTop()
String getWikiMarkupContent()
This method is deprecated. No replacement.
boolean hasContentChanged()
Returns true if Confluence considers the editor content to have changed.
void insertImage(Attachment attachment)
InsertImageDialog insertImage()
Opens the image dialog if in RTE mode.
boolean isBlogPost()
boolean isCreatePage()
boolean isHeartbeatMessageVisible()
boolean isMacroPresent(String name, Map<StringString> parameters)
Encapsulate the editor representation of macros in a single place for testing.
boolean isPermisionsEditorPresent()
boolean isPermissionsSet()
Returns true if permissions have been set in the editor.
boolean isRichTextMode()
boolean isSourceMode()
boolean isTitleEditable()
TinyMce logInAndAddComment(User user, Page page)
TinyMce logInAndAddComment(User user, BlogPost blogpost)
TinyMce logInAndCopyPage(User user, Page page)
TinyMce logInAndCreateBlogPost(User user, Space space)
TinyMce logInAndCreateChildPage(User user, Space space, long parentPageId)
TinyMce logInAndCreatePage(User user, Space space)
TinyMce logInAndEdit(User user, ContentEntity contentEntity)
TinyMce logInAndEditInRTE(User user, ContentEntity contentEntity)
Logs the given user in, edits the given content and switches to the RTE.
void merge()
Click the link to merge an existing draft with the current editor content.
void openCalenderPicker()
LinkBrowser openLinkBrowser()
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()
PageView save(MovePageDialog dialog)
String saveAndExpectAlert()
Clicks save but expects an alert mesage without leaving the page.
Editor saveAndExpectToFail()
Saves the page and expects to return to the editor.
PageView saveWithKeyboardShortcut()
MovePageDialog saveWithLocation()
Note that this is only available as a dark feature now.
void selectFirstParagraph()
void setContent(String content)
Note: Be careful with \n characters as they behave differently in IE and FF at the moment.
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 setHtmlContent(String htmlContent)
void setHtmlSource(String source)
void setTitle(String title)
void setVersionComment(String versionComment)
void setWikiMarkupContent(String markup)
This method is deprecated. Try setHtmlContent(String) for injecting content into the Editor without typing.
void switchToMarkup()
This method is deprecated. No more markup editor.
EditorPreview switchToPreview()
TinyMce switchToRichText()
void swtichToSource()
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 waitForCalanderPickerClose()
void waitForCalendarPicker()
void waitForDraftSavedMessage()
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.
void waitForPreviewToLoad()
Wait until the preview is loaded
void waitUntilEditorIsVisible()
Wait until the RTE is visible after switching back from the preview
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final String EDITOR_ID

Constant Value: "wysiwyg"

Fields

public static final int EDITOR_TIMEOUT_MILLIS

Public Constructors

public Editor (ConfluenceSeleniumClient client, Confluence confluence)

Public Methods

public void addComment (PageView pageView)

Add a comment from a page view. This method actually clicks on the load rte link for the comment rather than going to the add comment url directly.

public void addComment (Page page)

public void addErrorMessage (String id, String message, boolean showInAllModes)

Adds the specified error message to the screen.

Parameters
id the element id for the error to be added
message the message to display
showInAllModes true will show the error in both editor and preview modes, false only in editor mode.

public void cancel ()

public PageTemplateWizard clickSelectTemplate ()

public void closeCalanderPickerByClickInEditor ()

Has the unfortunate side effect of losing your cursor position, blame tinymce.

public void closeDraftMessage ()

public void createBlogPost (Space space)

public void createPage (Space space)

public PageTemplateWizard createPageFromTemplate (Space space)

public PageTemplateWizard createPageFromTemplate (Space space, long parentPageId)

public void discardDraft ()

public TinyMce edit (ContentEntity contentEntity)

public long getAttachmentSourceContentId ()

public String getContent ()

public long getContentId ()

public EditorPreview getEditorPreview ()

public String getFirstMatchingPreviewNodeText (String selector)

public String getHtmlSourceContent ()

public Location getLocation ()

public MacroBrowser getMacroBrowser ()

For use when opening the macro browser manually, e.g. via a context menu selection

Returns
  • the macro browser.

public Map<StringString> getMacroParameters (String name)

Retrieve a macro's parameters from the editor.

Parameters
name the name of the macro to be checked for
Returns
  • the hashmap of the params of the macro, or an empty hashmap if the macro doesn't exist.
Throws
SeleniumException if the macro doesn't exist.

public String getNormalisedContent ()

Returns a version of getContent() that should be the same in all browsers. The content is:

  • stripped of \r and \n
  • trimmed
  • converted to lowercase
  • /ul>

public String getPreviewContent ()

public String getPreviewSelectorScript (String selector)

public String getPreviewTableCellText (int row, int column)

public String getRichTextContent ()

This method is deprecated.
since 4.0 Use getContent() instead

public TinyMce getTinyMce ()

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.

public long getToolbarPositionTop ()

public String getWikiMarkupContent ()

This method is deprecated.
No replacement.

public boolean hasContentChanged ()

Returns true if Confluence considers the editor content to have changed. Checks RTE and Wiki markup.

public void insertImage (Attachment attachment)

public InsertImageDialog insertImage ()

Opens the image dialog if in RTE mode.

public boolean isBlogPost ()

public boolean isCreatePage ()

public boolean isHeartbeatMessageVisible ()

public boolean isMacroPresent (String name, Map<StringString> parameters)

Encapsulate the editor representation of macros in a single place for testing.

Parameters
name the name of the macro to be checked for
parameters the parameters to be checked for or null if there are none.
Returns
  • true if the content of the editor contains the macro as specified.

public boolean isPermisionsEditorPresent ()

public boolean isPermissionsSet ()

Returns true if permissions have been set in the editor. This method checks for the permissions button label and ensures that at least one of hidden input permission fields have been set.

Returns
  • true if permissions have been set in the editor

public boolean isRichTextMode ()

public boolean isSourceMode ()

public boolean isTitleEditable ()

public TinyMce logInAndAddComment (User user, Page page)

public TinyMce logInAndAddComment (User user, BlogPost blogpost)

public TinyMce logInAndCopyPage (User user, Page page)

public TinyMce logInAndCreateBlogPost (User user, Space space)

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

public TinyMce logInAndCreatePage (User user, Space space)

public TinyMce logInAndEdit (User user, ContentEntity contentEntity)

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

public void merge ()

Click the link to merge an existing draft with the current editor content.

public void openCalenderPicker ()

public LinkBrowser openLinkBrowser ()

public MacroBrowser openMacroBrowser ()

public MacroBrowser openMacroBrowserViaShortcut ()

public PagePermissionsEditor openPermissionsEditor ()

public void overwriteDraft ()

Click the link to overwrite a conflicting draft with the current editor content.

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.

public void resumeDraft ()

public PageView save ()

public PageView save (MovePageDialog dialog)

public String saveAndExpectAlert ()

Clicks save but expects an alert mesage without leaving the page.

Returns
  • The alerted message

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

public PageView saveWithKeyboardShortcut ()

public MovePageDialog saveWithLocation ()

Note that this is only available as a dark feature now.

public void selectFirstParagraph ()

public void setContent (String content)

Note: Be careful with \n characters as they behave differently in IE and FF at the moment. (IE->p, FF->br)

public void setCursorPosition (int pos)

Sets the cursor position in the markup editor.

public void setCursorPositionToEnd ()

Puts the cursor at the end of the Wiki Markup editor.

public void setHtmlContent (String htmlContent)

public void setHtmlSource (String source)

public void setTitle (String title)

public void setVersionComment (String versionComment)

public void setWikiMarkupContent (String markup)

This method is deprecated.
Try setHtmlContent(String) for injecting content into the Editor without typing.

public void switchToMarkup ()

This method is deprecated.
No more markup editor.

public EditorPreview switchToPreview ()

public TinyMce switchToRichText ()

public void swtichToSource ()

public void triggerDraft ()

Triggers a draft by switching to preview mode.

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.

public void triggerDraftAndCheckUserDrafts ()

public void triggerDraftAndCheckUserDrafts (BlogPost blogpost)

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.

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.

public void viewConflict ()

Click the link to resolve a conflict between an existing draft and the current editor content.

public void waitForCalanderPickerClose ()

public void waitForCalendarPicker ()

public void waitForDraftSavedMessage ()

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.

public void waitForHeartbeatMessage ()

Waits for the heartbeat message container to appear.

public void waitForPreviewToLoad ()

Wait until the preview is loaded

public void waitUntilEditorIsVisible ()

Wait until the RTE is visible after switching back from the preview