public class TinyMce extends Object
Modifier and Type | Class and Description |
---|---|
static class |
TinyMce.Format |
static class |
TinyMce.Position |
static class |
TinyMce.ShortCut |
static class |
TinyMce.SimpleToolbarButton |
Modifier and Type | Field and Description |
---|---|
static char |
NBSP |
static String |
TINYMCE_LOCATOR |
static String |
TOOLBAR_LOCATOR |
Constructor and Description |
---|
TinyMce(ConfluenceSeleniumClient client) |
Modifier and Type | Method and Description |
---|---|
void |
clickFormatMenuLink() |
EmoticonPickerPopup |
clickInsertEmoticon() |
InsertTablePopup |
clickInsertTable() |
void |
clickOutsideEditor()
Used for clicking something outside of the TinyMCE editor that is (currently) known to not have any click-handler
on it.
|
void |
clickToolbarButton(TinyMce.SimpleToolbarButton button) |
void |
copyAndPaste(String selector)
Copies the content specified by the selector, and pastes
it before the content.
|
void |
dispatchClickEventForSelector(String selector)
Triggers ed.onClick.dispatch on TinyMCE
|
void |
editorContentFocus() |
String |
getAttributeForSelector(String selector,
String attribute)
Returns the value of the given attribute for the given selector.
|
ConfluenceSeleniumClient |
getClient() |
String |
getContent()
Returns the current content of the Editor as HTML.
|
String |
getContent(String selector,
boolean removeNewLines)
Returns the current content specified by the selector from the Editor as HTML.
|
String |
getContentIncludingNode(String selector)
Returns the current content specified by the selector from the Editor as HTML, including the selector itself.
|
String |
getCssAttributeForSelector(String selector,
String attribute)
Returns the value of the given attribute for the given selector.
|
String |
getCurrentSelectionText()
Returns the text of the current editor selection.
|
String |
getExpressionValue(String expression)
Makes the TinyMCE doc available to the passed expression and evaluates it, returning the string result.
|
String |
getFirstRowSelector() |
String |
getMacroBodyText(String macroName)
Returns the body text of the macro.
|
int |
getNumberOfCols() |
int |
getNumberOfRows() |
String |
getRowSelector(int row) |
int |
getSelectorCount(String selector)
Returns the number of elements present in the editor specified by the given selector.
|
String |
getSelectorPresentScript(String selector)
Returns a javascript function that checks for the presence of an element
with given jquery selector in the TinyMCE editor.
|
String |
getTextAfterMacro(String macroName)
Returns the text in the Paragraph element after the macro (or its wrapper).
|
String |
getTextBeforeMacro(String macroName)
Returns the text in the Paragraph element before the macro (or its wrapper).
|
String |
getToolbarButtonId(TinyMce.SimpleToolbarButton button) |
boolean |
isCellHighlighted(int row,
int column,
String colour)
Checks if the row and column is highlighted.
|
boolean |
isColumnHeading(int column)
Checks if the nth column is column row.
|
boolean |
isImagePresent(Attachment attachment)
Returns true if the given attachment is present in the RTE.
|
boolean |
isMacroPresent(Macro macro)
Returns true if a macro with given name is present in the editor.
|
boolean |
isMacroPresent(String macroName) |
boolean |
isMacroPresent(String macroName,
String parameters) |
boolean |
isMacroPresent(String macroName,
String parameters,
String bodyText) |
boolean |
isMacroPresent(String macroName,
String parameters,
String bodyText,
String defaultParameter)
Returns true if the macro with given parameters and body text, is present in the editor.
|
boolean |
isMacroPropertyPanelPresent() |
boolean |
isRowHeading(int row)
Checks if the nth row is a heading row
|
boolean |
isSelectorPresent(String selector) |
boolean |
isTableHeaderRow(int row) |
boolean |
isTableNormalRow(int row) |
boolean |
isTablePresent() |
boolean |
isToolbarButtonActive(TinyMce.SimpleToolbarButton button) |
EditorInsertMenu |
openInsertMenu() |
EditorMoreMenu |
openMoreMenu() |
void |
pasteContent(String html)
Pastes the content as though it came from the clipboard.
|
void |
placeCursor(String selector,
int position)
Positions the cursor at the specified position in the first matched element for the provided CSS selector.
|
void |
placeCursorAtStart(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 |
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 |
putCursorAtStartOfElementWithSelectorAndIndex(String selector,
int elementIndex)
Place the cursor at the start of the element matching the given selector and index.
|
void |
putCursorAtStartOfFirstElementWithSelector(String selector)
Place the cursor at the start of the first element matching the given selector.
|
void |
selectEditorFrame()
Selects the TinyMCE iframe.
|
void |
selectElementWithSelectorAndIndex(String selector,
int elementIndex)
Select the nth element matching the given selector.
|
void |
selectEmptyFirstParagraph() |
void |
selectFirstElementWithSelector(String selector)
Select the first element matching the given selector.
|
void |
selectFirstParagraph() |
void |
selectFormat(TinyMce.Format format) |
MacroPropertyPanel |
selectMacro(String macroName) |
void |
selectMainFrame()
Selects the main/top frame for Confluence.
|
void |
setContent(String content) |
void |
setContentForSelector(String selector,
String text)
Sets the passed text in the RTE element matching the selector.
|
void |
setHtmlContent(String html)
Used by tests rather than to replicate user behaviour.
|
EditorAutocomplete |
triggerAutocomplete(TinyMce.ShortCut shortCut)
Launches the autocomplete by pressing a shortcut key combination at the
current cursor position.
|
void |
type(String content)
Only works for Firefox, and period doesn't work.
|
void |
typeWithFullKeyEvents(String content)
Only works for Firefox, and period doesn't work.
|
void |
waitForImage(Attachment image)
Wait for the specified image to load.
|
void |
waitForMacroPresent(String macroName) |
void |
waitForSelectorCount(String selector,
int count) |
void |
waitForSelectorPresent(String selector)
Wait for the given jQuery selector to be present in the TinyMCE editor.
|
void |
waitForSelectorPresentWithText(String selector,
int index,
String bodyText) |
void |
waitForSelectorPresentWithText(String selector,
String bodyText) |
void |
waitForTableCellPresent() |
void |
waitForTableHeadingCellPresent() |
Boolean |
wasInsertedCorrectDirection(TinyMce.Position pos,
int selectedRow) |
public static final String TINYMCE_LOCATOR
public static final String TOOLBAR_LOCATOR
public static final char NBSP
public TinyMce(ConfluenceSeleniumClient client)
public ConfluenceSeleniumClient getClient()
public void selectEditorFrame()
Use selectMainFrame()
to reselect the main outer frame.
public void selectMainFrame()
public void selectFormat(TinyMce.Format format)
public void clickFormatMenuLink()
public String getToolbarButtonId(TinyMce.SimpleToolbarButton button)
public boolean isToolbarButtonActive(TinyMce.SimpleToolbarButton button)
public void clickToolbarButton(TinyMce.SimpleToolbarButton button)
public void pressShortcut(TinyMce.SimpleToolbarButton button)
public void pressShortcut(TinyMce.ShortCut shortCut)
public InsertTablePopup clickInsertTable()
public EmoticonPickerPopup clickInsertEmoticon()
public void waitForTableHeadingCellPresent()
public void waitForTableCellPresent()
public int getNumberOfRows()
public String getFirstRowSelector()
public String getRowSelector(int row)
public int getNumberOfCols()
public boolean isTableHeaderRow(int row)
public boolean isTableNormalRow(int row)
public Boolean wasInsertedCorrectDirection(TinyMce.Position pos, int selectedRow)
public void setContent(String content)
public void setHtmlContent(String html)
html
- valid HTML (not blank)public String getContent()
public String getContent(String selector, boolean removeNewLines)
public String getContentIncludingNode(String selector)
public void editorContentFocus()
public void type(String content)
public void typeWithFullKeyEvents(String content)
SeleniumClient.typeWithFullKeyEvents(String, String)
public void selectFirstElementWithSelector(String selector)
selector
- see tiny_mce_src.DOMUtils.selectpublic void selectElementWithSelectorAndIndex(String selector, int elementIndex)
selector
- see tiny_mce_src.DOMUtils.selectelementIndex
- index of matched element to select, 0-indexedpublic String getCurrentSelectionText()
public void putCursorAtStartOfElementWithSelectorAndIndex(String selector, int elementIndex)
putCursorAtStartOfFirstElementWithSelector(String)
into it.selector
- see tiny_mce_src.DOMUtils.selectelementIndex
- index of matched element to select, 0-indexedpublic void putCursorAtStartOfFirstElementWithSelector(String selector)
selector
- see tiny_mce_src.DOMUtils.selectpublic void placeCursorAtStart(String selector)
public void placeCursor(String selector, int position)
public void selectEmptyFirstParagraph()
public void selectFirstParagraph()
public boolean isMacroPropertyPanelPresent()
public MacroPropertyPanel selectMacro(String macroName)
public boolean isTablePresent()
public boolean isRowHeading(int row)
row
- - the position of the row in the table (the first row == 1)public boolean isColumnHeading(int column)
column
- - the position of the column in the table (the first column == 1)public boolean isCellHighlighted(int row, int column, String colour)
row
- - the position of the row in the table (the first row == 1)column
- - the position of the column in the table (the first column == 1)colour
- - highlight colourpublic void waitForMacroPresent(String macroName)
public boolean isMacroPresent(String macroName)
public boolean isMacroPresent(String macroName, String parameters, String bodyText, String defaultParameter)
macroName
- name of the macroparameters
- String in the wiki markup format key=value|key=value with keys in alphabetical order.bodyText
- expected raw text of the macro bodypublic boolean isMacroPresent(Macro macro)
macro
- instance of Macropublic String getMacroBodyText(String macroName)
macroName
- name of macro with bodypublic void waitForSelectorPresentWithText(String selector, String bodyText)
public void waitForSelectorPresentWithText(String selector, int index, String bodyText)
public String getTextBeforeMacro(String macroName)
public String getTextAfterMacro(String macroName)
public boolean isImagePresent(Attachment attachment)
public void pressBackspace()
public void pressEnter()
public void pressEscape()
public void pressUp()
public void dispatchClickEventForSelector(String selector)
selector
- jQuery selector for element to click, should only select one elementpublic void waitForSelectorPresent(String selector)
public String getSelectorPresentScript(String selector)
public boolean isSelectorPresent(String selector)
selector
- jquery selector to check forpublic void waitForImage(Attachment image)
image
- The image that should be present in the editor.public int getSelectorCount(String selector)
selector
- jQuery selectorpublic String getExpressionValue(String expression)
expression
- a JavaScript expression, can assume "doc" is the TinyMCE document.public void waitForSelectorCount(String selector, int count)
public String getAttributeForSelector(String selector, String attribute)
public String getCssAttributeForSelector(String selector, String attribute)
public void setContentForSelector(String selector, String text)
public EditorInsertMenu openInsertMenu()
public EditorMoreMenu openMoreMenu()
public void clickOutsideEditor()
public EditorAutocomplete triggerAutocomplete(TinyMce.ShortCut shortCut)
public void copyAndPaste(String selector)
selector
- public void pasteContent(String html)
html
- Copyright © 2003–2017 Atlassian. All rights reserved.