com.atlassian.confluence.selenium.client
Class TinyMce

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

public class TinyMce
extends java.lang.Object


Nested Class Summary
static class TinyMce.Bookmark
          Represents a TinyMCE bookmark.
static class TinyMce.Format
           
static class TinyMce.ShortCut
           
static class TinyMce.SimpleToolbarButton
           
 
Field Summary
static java.lang.String TINYMCE_LOCATOR
           
 
Constructor Summary
TinyMce(ConfluenceSeleniumClient client, Editor editor)
           
 
Method Summary
 void clickFormatMenuLink()
           
 void clickHorizontalRuler()
           
 InsertCharacterPopup clickInsertCharacter()
           
 void clickInsertColAfter()
           
 void clickInsertColBefore()
           
 EmoticonPickerPopup clickInsertEmoticon()
           
 void clickInsertRowAfter()
           
 void clickInsertRowBefore()
           
 InsertTablePopup clickInsertTable()
           
 ColorPickerPopup clickMoreColors()
           
 void clickOutsideEditor()
          Used for clicking something outside of the TinyMCE editor that is (currently) known to not have any click-handler on it.
 void clickSelectedColor()
           
 void clickToolbarButton(TinyMce.SimpleToolbarButton button)
           
 void dispatchClickEventForSelector(java.lang.String selector)
          Triggers ed.onClick.dispatch on TinyMCE
 void dispatchDoubleClickEventForSelector(java.lang.String selector)
          Triggers ed.onClick.dispatch on TinyMCE
 java.lang.String getAttributeForSelector(java.lang.String selector, java.lang.String attribute)
          Returns the value of the given attribute for the given selector.
 TinyMce.Bookmark getBookmark()
           
 ConfluenceSeleniumClient getClient()
           
 java.lang.String getContent()
          Returns the current content of the Editor as HTML.
 java.lang.String getCurrentSelectionText()
          Returns the text of the current editor selection.
 java.lang.String getExpressionValue(java.lang.String expression)
          Makes the TinyMCE doc available to the passed expression and evaluates it, returning the string result.
 java.lang.String getFirstMatchingNodeText(java.lang.String selector)
          Retrieve the text of the first node that matches the given selector.
 java.lang.String getFullscreenFrameId()
           
static java.lang.String getLocatorForTags(java.lang.String tagNames, com.atlassian.selenium.SeleniumClient.Browser browser)
          Returns a selenium locator for the specified html tag in the TinyMCE editor.
 int getNumberOfCols()
           
 int getNumberOfRows()
           
 int getSelectorCount(java.lang.String selector)
           
 java.lang.String getSelectorPresentScript(java.lang.String selector)
          Returns a javascript function that checks for the presence of an element with given jquery selector in the TinyMCE editor.
 java.lang.String getSelectorScript(java.lang.String selector)
          Returns a javascript function that checks for the presence of an element with given jquery selector in the TinyMCE editor.
 java.lang.String getToolbarButtonId(TinyMce.SimpleToolbarButton button)
           
 void hideFullScreen()
          Returns to the normal editor from fullscreen mode and resets the active frame.
 boolean isMacroPresent(java.lang.String macroName)
           
 boolean isToolbarButtonEnabled(TinyMce.SimpleToolbarButton button)
           
 EditorInsertMenu openInsertMenu()
           
 void placeCursor(java.lang.String selector, int position)
          Positions the cursor at the specified position in the first matched element for the provided CSS selector.
 void placeCursorAtStart(boolean addingContent)
          Places the cursor at the begining of the RTE.
 void placeCursorAtStart(java.lang.String selector)
          Positions the cursor at the start of the first matched element for the provided CSS selector.
 void pressBackspace()
          Types the "Backspace" key at the current cursor position.
 void pressDown()
          Types the "Down arrow" key at the current cursor position.
 void pressEnter()
          Types the "Enter" key at the current cursor position.
 void pressEscape()
          Types the "Escape" key at the current cursor position.
 void pressShortcut(TinyMce.ShortCut shortCut)
           
 void pressShortcut(TinyMce.SimpleToolbarButton button)
           
 void pressUp()
          Types the "Up arrow" key at the current cursor position.
 void putCursorAtStartOfFirstElementWithSelector(java.lang.String selector)
          Place the cursor at the start of the first element matching the given selector.
 void scrollTopTo(int scrollTop)
          Scroll the RTE vertically to a certain position.
 void selectEditorFrame()
          Selects the TinyMCE iframe.
 void selectElementWithSelectorAndIndex(java.lang.String selector, int elementIndex)
          Select the nth element matching the given selector.
 void selectEmptyFirstParagraph()
           
 void selectFirstElementWithSelector(java.lang.String selector)
          Select the first element matching the given selector.
 void selectFirstParagraph()
           
 void selectFormat(TinyMce.Format format)
           
 void selectFullscreenFrame()
          Selects the TinyMCE fullscreen iframe.
 void selectMacro(java.lang.String macroName)
           
 void selectMainFrame()
          Selects the main/top frame for Confluence.
 void selectTextColor(java.lang.String rgbColor)
           
 void setContent(java.lang.String content)
           
 void showFullScreen()
          Clicks the fullscreen toolbar icon in the TinyMCE editor.
 EditorAutocomplete triggerAutocomplete(TinyMce.ShortCut shortCut)
          Launches the autocomplete by pressing a shortcut key combination at the current cursor position.
 void type(java.lang.String content)
          Only works for Firefox, and period doesn't work.
 void typeTextInFullScreen(java.lang.String content)
          Types in the given content in fullscreen mode.
 void typeWithFullKeyEvents(java.lang.String content)
           
 void waitForSelectorCount(java.lang.String selector, int count)
           
 void waitForSelectorPresent(java.lang.String selector)
          Wait for the given jQuery selector to be present in the TinyMCE editor.
 void waitForTableCellPresent()
           
 void waitForTableHeadingCellPresent()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TINYMCE_LOCATOR

public static final java.lang.String TINYMCE_LOCATOR
See Also:
Constant Field Values
Constructor Detail

TinyMce

public TinyMce(ConfluenceSeleniumClient client,
               Editor editor)
Method Detail

getClient

public ConfluenceSeleniumClient getClient()

getFullscreenFrameId

public java.lang.String getFullscreenFrameId()

getLocatorForTags

public static java.lang.String getLocatorForTags(java.lang.String tagNames,
                                                 com.atlassian.selenium.SeleniumClient.Browser browser)
Returns a selenium locator for the specified html tag in the TinyMCE editor. Depending on the browser, it will return the appropriate locator. This is required as different browsers have different implementations of the executing wywsiwyg commands such as bold, italic etc.


selectEditorFrame

public void selectEditorFrame()
Selects the TinyMCE iframe. You can then use Selenium assert methods normally. Use selectMainFrame() to reselect the main outer frame.


selectFullscreenFrame

public void selectFullscreenFrame()
Selects the TinyMCE fullscreen iframe. You can then use Selenium assert methods normally. Use selectMainFrame() to reselect the main outer frame.


selectMainFrame

public void selectMainFrame()
Selects the main/top frame for Confluence.


showFullScreen

public void showFullScreen()
Clicks the fullscreen toolbar icon in the TinyMCE editor. It also selects the fullscreen editor frame. Be sure to select the main frame again (or use hideFullScreen()) in a finally block.


hideFullScreen

public void hideFullScreen()
Returns to the normal editor from fullscreen mode and resets the active frame.


typeTextInFullScreen

public void typeTextInFullScreen(java.lang.String content)
Types in the given content in fullscreen mode. Note that this method leaves the editor in full screen mode and is only applicable to Firefox.


selectFormat

public void selectFormat(TinyMce.Format format)

clickFormatMenuLink

public void clickFormatMenuLink()

getToolbarButtonId

public java.lang.String getToolbarButtonId(TinyMce.SimpleToolbarButton button)

isToolbarButtonEnabled

public boolean isToolbarButtonEnabled(TinyMce.SimpleToolbarButton button)

clickToolbarButton

public void clickToolbarButton(TinyMce.SimpleToolbarButton button)

pressShortcut

public void pressShortcut(TinyMce.SimpleToolbarButton button)

pressShortcut

public void pressShortcut(TinyMce.ShortCut shortCut)

clickHorizontalRuler

public void clickHorizontalRuler()

clickInsertTable

public InsertTablePopup clickInsertTable()

clickInsertRowBefore

public void clickInsertRowBefore()

clickInsertRowAfter

public void clickInsertRowAfter()

clickInsertColBefore

public void clickInsertColBefore()

clickInsertColAfter

public void clickInsertColAfter()

clickInsertEmoticon

public EmoticonPickerPopup clickInsertEmoticon()

clickInsertCharacter

public InsertCharacterPopup clickInsertCharacter()

clickSelectedColor

public void clickSelectedColor()

selectTextColor

public void selectTextColor(java.lang.String rgbColor)

clickMoreColors

public ColorPickerPopup clickMoreColors()

waitForTableHeadingCellPresent

public void waitForTableHeadingCellPresent()

waitForTableCellPresent

public void waitForTableCellPresent()

getNumberOfRows

public int getNumberOfRows()

getNumberOfCols

public int getNumberOfCols()

setContent

public void setContent(java.lang.String content)

getContent

public java.lang.String getContent()
Returns the current content of the Editor as HTML.


type

public void type(java.lang.String content)
Only works for Firefox, and period doesn't work. http://jira.openqa.org/browse/SEL-521


typeWithFullKeyEvents

public void typeWithFullKeyEvents(java.lang.String content)
See Also:
SeleniumClient#typeWithFullKeyEvents}

selectFirstElementWithSelector

public void selectFirstElementWithSelector(java.lang.String selector)
Select the first element matching the given selector.

Parameters:
selector - see tiny_mce_src.DOMUtils.select

selectElementWithSelectorAndIndex

public void selectElementWithSelectorAndIndex(java.lang.String selector,
                                              int elementIndex)
Select the nth element matching the given selector.

Parameters:
selector - see tiny_mce_src.DOMUtils.select
elementIndex - index of matched element to select, 0-indexed

getCurrentSelectionText

public java.lang.String getCurrentSelectionText()
Returns the text of the current editor selection.


putCursorAtStartOfFirstElementWithSelector

public void putCursorAtStartOfFirstElementWithSelector(java.lang.String selector)
Place the cursor at the start of the first element matching the given selector.

Parameters:
selector - see tiny_mce_src.DOMUtils.select

placeCursorAtStart

public void placeCursorAtStart(boolean addingContent)
Places the cursor at the begining of the RTE.

Parameters:
addingContent - use true if adding content and there is nothing present in the editor.

placeCursorAtStart

public void placeCursorAtStart(java.lang.String selector)
Positions the cursor at the start of the first matched element for the provided CSS selector.


placeCursor

public void placeCursor(java.lang.String selector,
                        int position)
Positions the cursor at the specified position in the first matched element for the provided CSS selector. Doesn't work for IE very well.


selectEmptyFirstParagraph

public void selectEmptyFirstParagraph()

selectFirstParagraph

public void selectFirstParagraph()

selectMacro

public void selectMacro(java.lang.String macroName)

isMacroPresent

public boolean isMacroPresent(java.lang.String macroName)

pressBackspace

public void pressBackspace()
Types the "Backspace" key at the current cursor position.


pressEnter

public void pressEnter()
Types the "Enter" key at the current cursor position. Known to have problems in IE.


pressEscape

public void pressEscape()
Types the "Escape" key at the current cursor position.


pressDown

public void pressDown()
Types the "Down arrow" key at the current cursor position.


pressUp

public void pressUp()
Types the "Up arrow" key at the current cursor position.


dispatchClickEventForSelector

public void dispatchClickEventForSelector(java.lang.String selector)
Triggers ed.onClick.dispatch on TinyMCE

Parameters:
selector - jQuery selector for element to click, should only select one element

dispatchDoubleClickEventForSelector

public void dispatchDoubleClickEventForSelector(java.lang.String selector)
Triggers ed.onClick.dispatch on TinyMCE

Parameters:
selector - jQuery selector for element to click, should only select one element

waitForSelectorPresent

public void waitForSelectorPresent(java.lang.String selector)
Wait for the given jQuery selector to be present in the TinyMCE editor.


getSelectorPresentScript

public java.lang.String getSelectorPresentScript(java.lang.String selector)
Returns a javascript function that checks for the presence of an element with given jquery selector in the TinyMCE editor.


getSelectorCount

public int getSelectorCount(java.lang.String selector)

getExpressionValue

public java.lang.String getExpressionValue(java.lang.String expression)
Makes the TinyMCE doc available to the passed expression and evaluates it, returning the string result.

Parameters:
expression - a JavaScript expression, can assume "doc" is the TinyMCE document.
Returns:
String result of the expression

waitForSelectorCount

public void waitForSelectorCount(java.lang.String selector,
                                 int count)

getAttributeForSelector

public java.lang.String getAttributeForSelector(java.lang.String selector,
                                                java.lang.String attribute)
Returns the value of the given attribute for the given selector.


getSelectorScript

public java.lang.String getSelectorScript(java.lang.String selector)
Returns a javascript function that checks for the presence of an element with given jquery selector in the TinyMCE editor.


getFirstMatchingNodeText

public java.lang.String getFirstMatchingNodeText(java.lang.String selector)
Retrieve the text of the first node that matches the given selector.


getBookmark

public TinyMce.Bookmark getBookmark()

openInsertMenu

public EditorInsertMenu openInsertMenu()

scrollTopTo

public void scrollTopTo(int scrollTop)
Scroll the RTE vertically to a certain position.


clickOutsideEditor

public void clickOutsideEditor()
Used for clicking something outside of the TinyMCE editor that is (currently) known to not have any click-handler on it.


triggerAutocomplete

public EditorAutocomplete triggerAutocomplete(TinyMce.ShortCut shortCut)
Launches the autocomplete by pressing a shortcut key combination at the current cursor position.



Copyright © 2003-2010 Atlassian. All Rights Reserved.