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 CancelAnyAlertcancelAnyAlertCancelAnyEditorAuiModalDialogcancelAnyEditorAuiModalDialogprotected static Editoreditorprotected static EditorContenteditorContentcom.atlassian.webdriver.testing.rule.IgnoreBrowserRuleignoreRulecom.atlassian.webdriver.testing.rule.LogPageSourceRulelogPageSourceRuleLogTimeRulelogTimeRuleprotected static StringOS_CTRL_KEYprotected static ConfluenceTestedProductproductprotected static ConfluenceRpcrpccom.atlassian.webdriver.testing.rule.WebDriverScreenshotRulewebDriverScreenshotRule
-
Constructor Summary
Constructors Constructor Description AbstractEditorContentWebDriverTest()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected 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 voidassertEditorHtmlContains(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 voidassertEditorHtmlDoesNotContain(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 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.voidclearContent()protected 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 voidignoreBrowserDecoratorSetup()protected voidignoreBrowserDecoratorTearDown()protected 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 voidpressBackspace()Simulates pressing backspace on the TinyMCE iframe.protected voidpressDelete()Simulates pressing the delete key on the TinyMCE iframe.protected voidpressDown()Simulates pressing the down arrow key on the TinyMCE iframe.protected voidpressEnter()Simulates pressing the enter key on the TinyMCE iframe.protected voidpressEsc()Simulates pressing the escape key on the TinyMCE iframe.protected voidpressLeft()Simulates pressing the left arrow key on the TinyMCE iframe.protected voidpressMultipleKeys(String keysChord)Simulates pressing multiple keys at once on the TinyMCE iframe.protected voidpressReturn()Simulates pressing the return key on the TinyMCE iframe.protected voidpressRight()Simulates 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 voidsetupEditor()static voidtearDownEditor()protected voidtypeInTheEditor(String string)Simulates typing in the editor.protected voidundo()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
-
-