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 Editorprotected static EditorContentcom.atlassian.webdriver.testing.rule.IgnoreBrowserRulecom.atlassian.webdriver.testing.rule.LogPageSourceRuleprotected static final Stringprotected static ConfluenceTestedProductprotected static ConfluenceRpccom.atlassian.webdriver.testing.rule.WebDriverScreenshotRule -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidassertEditorHtml(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 voidassertEditorHtml(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 voidAsserts 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 voidAsserts 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 voidassertEditorText(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 voidassertElementAttributeValue(String selector, String attributeName, String expectedAttributeValue) Deprecated.protected voidassertElementAttributeValueMatches(String selector, String attributeName, org.hamcrest.Matcher<String> attributeValueMatcher) protected voidassertElementNumberOfMatches(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 voidassertElementText(String text, String selector) Asserts that text in the provided selection within the editor content matches the given string.protected voidassertElementText(String message, String text, String selector) Asserts that text in the provided selection within the editor content matches the given string.protected voidassertElementTextContains(String text, String selector) Asserts that text in the provided selection within the editor content contains the given string.voidprotected voidclickOnElement(String selector) Simulates clicking on the matched element in the editor content.protected voidignoreBrowserDecorator(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 voidprotected voidprotected voidinsertAndWaitForFixture(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 voidinsertAndWaitForFixture(String fixture, String htmlToWaitFor) Sets the content of the editor using the TinyMCE API and waits for the specified content to be present.protected voidplaceCursorAtTheEndOfElement(String selector) Positions the cursor at the end of the first matched element for the provided CSS selector.protected voidplaceCursorAtTheStartOfElement(String selector) Positions the cursor at the start of the first matched element for the provided CSS selector.protected voidSimulates pressing backspace on the TinyMCE iframe.protected voidSimulates pressing the delete key on the TinyMCE iframe.protected voidSimulates pressing the down arrow key on the TinyMCE iframe.protected voidSimulates pressing the enter key on the TinyMCE iframe.protected voidpressEsc()Simulates pressing the escape key on the TinyMCE iframe.protected voidSimulates pressing the left arrow key on the TinyMCE iframe.protected voidpressMultipleKeys(String keysChord) Simulates pressing multiple keys at once on the TinyMCE iframe.protected voidSimulates pressing the return key on the TinyMCE iframe.protected voidSimulates pressing the right arrow key on the TinyMCE iframe.protected voidpressTab()Simulates pressing the tab key on the TinyMCE iframe.protected voidpressUp()Simulates pressing the up arrow key on the TinyMCE iframe.static voidstatic voidprotected voidtypeInTheEditor(String string) Simulates typing in the editor.protected voidundo()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)