Class AbstractEditorContentWebDriverTest
- java.lang.Object
-
- com.atlassian.confluence.webdriver.AbstractEditorContentWebDriverTest
-
public abstract class AbstractEditorContentWebDriverTest extends Object
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
Fields Modifier and Type Field Description CancelAnyAlert
cancelAnyAlert
CancelAnyEditorAuiModalDialog
cancelAnyEditorAuiModalDialog
protected static Editor
editor
protected static EditorContent
editorContent
com.atlassian.webdriver.testing.rule.IgnoreBrowserRule
ignoreRule
com.atlassian.webdriver.testing.rule.LogPageSourceRule
logPageSourceRule
LogTimeRule
logTimeRule
protected static String
OS_CTRL_KEY
protected static ConfluenceTestedProduct
product
protected static ConfluenceRpc
rpc
com.atlassian.webdriver.testing.rule.WebDriverScreenshotRule
webDriverScreenshotRule
-
Constructor Summary
Constructors Constructor Description AbstractEditorContentWebDriverTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected 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
assertEditorHtmlContains(String html)
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
assertEditorHtmlDoesNotContain(String html)
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
clearContent()
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
ignoreBrowserDecoratorSetup()
protected void
ignoreBrowserDecoratorTearDown()
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
pressBackspace()
Simulates pressing backspace on the TinyMCE iframe.protected void
pressDelete()
Simulates pressing the delete key on the TinyMCE iframe.protected void
pressDown()
Simulates pressing the down arrow key on the TinyMCE iframe.protected void
pressEnter()
Simulates pressing the enter key on the TinyMCE iframe.protected void
pressEsc()
Simulates pressing the escape key on the TinyMCE iframe.protected void
pressLeft()
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
pressReturn()
Simulates pressing the return key on the TinyMCE iframe.protected void
pressRight()
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
setupEditor()
static void
tearDownEditor()
protected void
typeInTheEditor(String string)
Simulates typing in the editor.protected void
undo()
Executes the undo editor command.
-
-
-
Field Detail
-
editor
protected static Editor editor
-
editorContent
protected static EditorContent editorContent
-
product
protected static ConfluenceTestedProduct product
-
rpc
protected static ConfluenceRpc rpc
-
OS_CTRL_KEY
protected static final String 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
public LogTimeRule logTimeRule
-
cancelAnyEditorAuiModalDialog
@Inject public CancelAnyEditorAuiModalDialog cancelAnyEditorAuiModalDialog
-
cancelAnyAlert
@Inject public CancelAnyAlert cancelAnyAlert
-
-
Method Detail
-
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
protected 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'. 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
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'. 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
protected void assertEditorHtmlContains(String html)
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
protected void assertEditorHtmlDoesNotContain(String html)
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
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.- 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
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 quantity- Parameters:
quantity
- The number of expected matchesselector
- CSS selector to be used for matching elements in the editor content- Since:
- 5.6
-
assertElementText
protected void assertElementText(String text, String selector)
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
protected void assertElementText(String message, String text, String selector)
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
protected void assertElementTextContains(String text, String selector)
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
protected void clickOnElement(String selector)
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
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.- Parameters:
fixture
- Normalised HTML content to be set in the editor- Since:
- 5.6
-
insertAndWaitForFixture
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. 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
protected void placeCursorAtTheEndOfElement(String selector)
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
protected void placeCursorAtTheStartOfElement(String selector)
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
protected void pressMultipleKeys(String keysChord)
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
protected void typeInTheEditor(String string)
Simulates typing in the editor.- Parameters:
string
- Content to type into the editor- Since:
- 5.6
-
-