Class AbstractEditorContentWebDriverTest
java.lang.Object
com.atlassian.confluence.webdriver.AbstractEditorContentWebDriverTest
Base class for Confluence Editor Content WebDriver tests
Makes easier to run all the editor content related tests in the same Confluence editor page sequentially.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static Editor
protected static EditorContent
com.atlassian.webdriver.testing.rule.IgnoreBrowserRule
com.atlassian.webdriver.testing.rule.LogPageSourceRule
protected static final String
protected static ConfluenceTestedProduct
protected static ConfluenceRpc
com.atlassian.webdriver.testing.rule.WebDriverScreenshotRule
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
assertEditorHtml
(String html) Asserts that the HTML content of the editor matches the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers, and HTML content returned by TinyMCE is 'cleaned up'.protected void
assertEditorHtml
(String html, boolean normalizeSpaces) Asserts that the HTML content of the editor matches the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers, and HTML content returned by TinyMCE is 'cleaned up'.protected void
Asserts that the HTML content of the editor contains the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers, and HTML content returned by TinyMCE is 'cleaned up'.protected void
Asserts that the HTML content of the editor does not contain the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers.protected void
assertEditorText
(String text) Asserts that the textual content of the editor matches the given string - use with care, there can be spacing inconsistencies across browsers.protected void
assertElementAttributeValue
(String selector, String attributeName, String expectedAttributeValue) Deprecated.protected void
assertElementAttributeValueMatches
(String selector, String attributeName, org.hamcrest.Matcher<String> attributeValueMatcher) protected void
assertElementNumberOfMatches
(int quantity, String selector) Asserts that the number of matches for a particular selector query within the editor content is consistent with the expected quantityprotected void
assertElementText
(String text, String selector) Asserts that text in the provided selection within the editor content matches the given string.protected void
assertElementText
(String message, String text, String selector) Asserts that text in the provided selection within the editor content matches the given string.protected void
assertElementTextContains
(String text, String selector) Asserts that text in the provided selection within the editor content contains the given string.void
protected void
clickOnElement
(String selector) Simulates clicking on the matched element in the editor content.protected void
ignoreBrowserDecorator
(Runnable runnable, com.atlassian.pageobjects.browser.Browser... ignoredBrowsers) Used for comet assertions in order to allow specific private assertions to be ignored on certain browsersprotected void
protected void
protected void
insertAndWaitForFixture
(String fixture) Sets the content of the editor using the TinyMCE API and waits for the exact same content to be present - if the content being set in the editor contains any HTML tags it's safer to useinsertAndWaitForFixture(String, String)
instead.protected void
insertAndWaitForFixture
(String fixture, String htmlToWaitFor) Sets the content of the editor using the TinyMCE API and waits for the specified content to be present.protected void
placeCursorAtTheEndOfElement
(String selector) Positions the cursor at the end of the first matched element for the provided CSS selector.protected void
placeCursorAtTheStartOfElement
(String selector) Positions the cursor at the start of the first matched element for the provided CSS selector.protected void
Simulates pressing backspace on the TinyMCE iframe.protected void
Simulates pressing the delete key on the TinyMCE iframe.protected void
Simulates pressing the down arrow key on the TinyMCE iframe.protected void
Simulates pressing the enter key on the TinyMCE iframe.protected void
pressEsc()
Simulates pressing the escape key on the TinyMCE iframe.protected void
Simulates pressing the left arrow key on the TinyMCE iframe.protected void
pressMultipleKeys
(String keysChord) Simulates pressing multiple keys at once on the TinyMCE iframe.protected void
Simulates pressing the return key on the TinyMCE iframe.protected void
Simulates pressing the right arrow key on the TinyMCE iframe.protected void
pressTab()
Simulates pressing the tab key on the TinyMCE iframe.protected void
pressUp()
Simulates pressing the up arrow key on the TinyMCE iframe.static void
static void
protected void
typeInTheEditor
(String string) Simulates typing in the editor.protected void
undo()
Executes the undo editor command.
-
Field Details
-
editor
-
editorContent
-
product
-
rpc
-
OS_CTRL_KEY
-
ignoreRule
public com.atlassian.webdriver.testing.rule.IgnoreBrowserRule ignoreRule -
webDriverScreenshotRule
public com.atlassian.webdriver.testing.rule.WebDriverScreenshotRule webDriverScreenshotRule -
logPageSourceRule
public com.atlassian.webdriver.testing.rule.LogPageSourceRule logPageSourceRule -
logTimeRule
-
cancelAnyEditorAuiModalDialog
-
cancelAnyAlert
-
-
Constructor Details
-
AbstractEditorContentWebDriverTest
public AbstractEditorContentWebDriverTest()
-
-
Method Details
-
setupEditor
public static void setupEditor() -
tearDownEditor
public static void tearDownEditor() -
clearContent
public void clearContent() -
ignoreBrowserDecorator
protected void ignoreBrowserDecorator(Runnable runnable, com.atlassian.pageobjects.browser.Browser... ignoredBrowsers) Used for comet assertions in order to allow specific private assertions to be ignored on certain browsers -
ignoreBrowserDecoratorSetup
protected void ignoreBrowserDecoratorSetup() -
ignoreBrowserDecoratorTearDown
protected void ignoreBrowserDecoratorTearDown() -
assertEditorHtml
Asserts that the HTML content of the editor matches the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers, and HTML content returned by TinyMCE is 'cleaned up'. If you don't need to verify that the editor doesn't contain additional content, you should useassertEditorHtmlContains(String)
instead.- Parameters:
html
- HTML content to match- Since:
- 5.6
-
assertEditorHtml
Asserts that the HTML content of the editor matches the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers, and HTML content returned by TinyMCE is 'cleaned up'. If you don't need to verify that the editor doesn't contain additional content, you should useassertEditorHtmlContains(String)
instead.- Parameters:
html
- HTML content to matchnormalizeSpaces
- boolean indicating whether spaces should be normalised- Since:
- 5.6
-
assertEditorHtmlContains
Asserts that the HTML content of the editor contains the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers, and HTML content returned by TinyMCE is 'cleaned up'.- Parameters:
html
- HTML content to match- Since:
- 5.6
-
assertEditorHtmlDoesNotContain
Asserts that the HTML content of the editor does not contain the given HTML - use with care, HTML produced by the editor can be inconsistent across browsers.- Parameters:
html
- HTML content to search for- Since:
- 5.6
-
assertEditorText
Asserts that the textual content of the editor matches the given string - use with care, there can be spacing inconsistencies across browsers.- Parameters:
text
- Text to match- Since:
- 5.6
-
assertElementAttributeValue
@Deprecated protected void assertElementAttributeValue(String selector, String attributeName, String expectedAttributeValue) Deprecated.Asserts that the value of the specified attribute belonging to the element matching the given selector matches the expected attribute value.- Parameters:
selector
- CSS selector for locating element in the editor contentattributeName
- Name of the attribute to read the value forexpectedAttributeValue
- Expected value for the attribute- Since:
- 5.6
-
assertElementAttributeValueMatches
protected void assertElementAttributeValueMatches(String selector, String attributeName, org.hamcrest.Matcher<String> attributeValueMatcher) - Since:
- 5.9
-
assertElementNumberOfMatches
Asserts that the number of matches for a particular selector query within the editor content is consistent with the expected quantity- Parameters:
quantity
- The number of expected matchesselector
- CSS selector to be used for matching elements in the editor content- Since:
- 5.6
-
assertElementText
Asserts that text in the provided selection within the editor content matches the given string.- Parameters:
text
- Text we expect to matchselector
- CSS selector for locating element in the editor content- Since:
- 5.6
-
assertElementText
Asserts that text in the provided selection within the editor content matches the given string.- Parameters:
message
- Error messagetext
- Text we expect to matchselector
- CSS selector for locating element in the editor content- Since:
- 5.6
-
assertElementTextContains
Asserts that text in the provided selection within the editor content contains the given string.- Parameters:
text
- Text we expect the element to containselector
- CSS selector for locating element in the editor content- Since:
- 5.6
-
clickOnElement
Simulates clicking on the matched element in the editor content.- Parameters:
selector
- CSS selector for locating element in the editor content- Since:
- 5.6
-
insertAndWaitForFixture
Sets the content of the editor using the TinyMCE API and waits for the exact same content to be present - if the content being set in the editor contains any HTML tags it's safer to useinsertAndWaitForFixture(String, String)
instead.- Parameters:
fixture
- Normalised HTML content to be set in the editor- Since:
- 5.6
-
insertAndWaitForFixture
Sets the content of the editor using the TinyMCE API and waits for the specified content to be present. It's advisable to use a simple (perhaps text-only) portion of the content to be inserted for checking that the editor content has been updated, as TinyMCE may apply some changes to the supplied HTML.- Parameters:
fixture
- HTML content to be set in the editorhtmlToWaitFor
- Content to be used for checking that the editor has been updated- Since:
- 5.6
-
placeCursorAtTheEndOfElement
Positions the cursor at the end of the first matched element for the provided CSS selector.- Parameters:
selector
- CSS selector to be used for positioning the cursor.- Since:
- 5.6
-
placeCursorAtTheStartOfElement
Positions the cursor at the start of the first matched element for the provided CSS selector.- Parameters:
selector
- CSS selector to be used for positioning the cursor.- Since:
- 5.6
-
pressUp
protected void pressUp()Simulates pressing the up arrow key on the TinyMCE iframe.- Since:
- 5.6
-
pressDown
protected void pressDown()Simulates pressing the down arrow key on the TinyMCE iframe.- Since:
- 5.6
-
pressLeft
protected void pressLeft()Simulates pressing the left arrow key on the TinyMCE iframe.- Since:
- 5.6
-
pressRight
protected void pressRight()Simulates pressing the right arrow key on the TinyMCE iframe.- Since:
- 5.6
-
pressBackspace
protected void pressBackspace()Simulates pressing backspace on the TinyMCE iframe.- Since:
- 5.6
-
pressDelete
protected void pressDelete()Simulates pressing the delete key on the TinyMCE iframe.- Since:
- 5.6
-
pressEnter
protected void pressEnter()Simulates pressing the enter key on the TinyMCE iframe. Please make sure you don't want to use pressReturn instead- Since:
- 5.6
-
pressReturn
protected void pressReturn()Simulates pressing the return key on the TinyMCE iframe.- Since:
- 5.6
-
pressEsc
protected void pressEsc()Simulates pressing the escape key on the TinyMCE iframe.- Since:
- 5.6
-
pressMultipleKeys
Simulates pressing multiple keys at once on the TinyMCE iframe.- Parameters:
keysChord
- A representation of keys to press - seeKeys.chord(CharSequence...)
- Since:
- 5.6
-
pressTab
protected void pressTab()Simulates pressing the tab key on the TinyMCE iframe.- Since:
- 5.6
-
undo
protected void undo()Executes the undo editor command.- Since:
- 5.6
-
typeInTheEditor
Simulates typing in the editor.- Parameters:
string
- Content to type into the editor- Since:
- 5.6
-
assertElementAttributeValueMatches(String, String, Matcher)