public class CrowdWebTestCase extends Object
WebTestCase
.Modifier and Type | Field and Description |
---|---|
ResourceBundle |
i18n |
Constructor and Description |
---|
CrowdWebTestCase() |
Modifier and Type | Method and Description |
---|---|
void |
addRequestHeader(String header,
String value)
Adds a request header for all subsequent requests.
|
void |
assertButtonNotPresent(String buttonId) |
void |
assertButtonPresent(String buttonId) |
void |
assertCheckboxNotPresent(String checkBoxName) |
void |
assertCheckboxNotSelected(String checkBoxName) |
void |
assertCheckboxPresent(String checkBoxName) |
void |
assertCheckboxSelected(String checkBoxName) |
void |
assertElementIsDisabled(String elementID)
Assert that a given element's disabled attribute is set with value = 'disabled'.
|
void |
assertElementIsEnabled(String elementID)
Assert that a given element's disabled attribute is not present.
|
void |
assertElementNotPresent(String anID) |
void |
assertElementNotPresentByXPath(String xpath) |
void |
assertElementPresent(String anID) |
void |
assertElementPresentByXPath(String xpath) |
void |
assertErrorNotPresent()
Makes sure the page does not contain an error, as when an exception has occurred.
|
void |
assertErrorPresent()
Makes sure the page does contain an error, as when an exception has occurred.
|
void |
assertErrorPresentWithKey(String keyName)
Makes sure the page does contain an error and that it also contains the text of the key.
|
void |
assertFieldErrorPresentWithKey(String keyName)
Makes sure the page does contain a field error that contains the text of the key, as when a validation error occurs in a form.
|
void |
assertFormPresent(String nameOrID) |
void |
assertInfoPresent()
Makes sure the page contains an info box
|
void |
assertKeyInElement(String elementID,
String key)
Assert that a given element contains a specific web resource's value.
|
void |
assertKeyNotPresent(String key) |
void |
assertKeyPresent(String key)
Assert that a web resource's value is present.
|
void |
assertKeyPresent(String key,
List args)
Assert that a web resource's value is present.
|
void |
assertKeyPresent(String key,
String... args) |
void |
assertKeyPresentOnce(String key)
Checks that the text of a given key only occurs once on the page, such as validation error messages
|
void |
assertLinkNotPresent(String linkId) |
void |
assertLinkPresent(String linkId) |
void |
assertLinkPresentWithExactText(String linkText) |
void |
assertLinkPresentWithKey(String keyName)
Assert that a link containing the text of the key is present.
|
void |
assertMatchInTable(String tableSummaryNameOrId,
String regexp) |
void |
assertMatchInTable(String tableSummaryNameOrId,
String[] regexp) |
void |
assertRadioOptionNotPresent(String name,
String radioOption) |
void |
assertRadioOptionSelected(String name,
String radioOption) |
void |
assertSelectedOptionEquals(String selectName,
String optionLabel) |
void |
assertSelectedOptionValueEquals(String selectName,
String value) |
void |
assertSelectOptionNotPresent(String selectName,
String optionLabel) |
void |
assertSelectOptionsEqual(String selectName,
String[] optionLabels) |
void |
assertServerResponseContains(String string)
Ensures the server's response (HTTP header + body)
contains a string.
|
void |
assertServerResponseDoesNotContain(String string)
Ensures the server's response (HTTP header + body)
dos not contain a string.
|
void |
assertSubmitButtonNotPresent() |
void |
assertSuccessPresent()
Makes sure the page contains a success message
|
void |
assertTableEquals(String tableSummaryNameOrId,
net.sourceforge.jwebunit.html.Table expectedTable) |
void |
assertTableNotPresent(String tableSummaryNameOrId) |
void |
assertTablePresent(String tableSummaryNameOrId) |
void |
assertTableRowCountEquals(String tableSummaryNameOrId,
int expectedRowCount) |
void |
assertTextFieldEquals(String formElementName,
String expectedValue) |
void |
assertTextInElement(String elementId,
String text) |
void |
assertTextInTable(String tableSummaryNameOrId,
String text) |
void |
assertTextInTable(String tableSummaryNameOrId,
String[] text) |
void |
assertTextNotInTable(String tableSummaryNameOrId,
String text) |
void |
assertTextNotInTable(String tableSummaryNameOrId,
String[] text) |
void |
assertTextNotPresent(String text) |
void |
assertTextPresent(String text) |
void |
assertTextPresent(String text,
boolean suppressMessage)
Assert that supplied text is present.
|
void |
assertTitleEquals(String expectedTitle) |
void |
assertTitleMatch(String regexp) |
void |
assertTitleNotEquals(String title) |
void |
assertWarningAndErrorNotPresent() |
void |
assertWarningNotPresent()
Makes sure the page doesn't contain a warning, as when an exception has occurred.
|
void |
beginAt(String aRelativeURL) |
void |
checkCheckbox(String checkBoxName) |
void |
checkCheckbox(String checkBoxName,
String value) |
void |
clickButton(String buttonId) |
void |
clickButtonWithText(String buttonValueText) |
void |
clickElementByXPath(String xpath) |
void |
clickLink(String linkId) |
void |
clickLinkInNavbar(String linkId) |
void |
clickLinkWithExactText(String linkText) |
void |
clickLinkWithKey(String key)
Clicks a link
|
void |
clickLinkWithText(String linkText) |
void |
clickLinkWithText(String linkText,
int index) |
void |
clickRadioOption(String radioGroup,
String radioOption) |
void |
closeBrowser() |
protected static org.hamcrest.Matcher<String> |
equalToIgnoringWhiteSpace(String s)
Override
IsEqualIgnoringWhiteSpace and also ignore no-break space. |
net.sourceforge.jwebunit.api.ITestingEngine |
getDialog() |
String |
getElementAttributeByXPath(String xpath,
String attribute) |
net.sourceforge.jwebunit.api.IElement |
getElementById(String id) |
net.sourceforge.jwebunit.api.IElement |
getElementByXPath(String xPath) |
List<net.sourceforge.jwebunit.api.IElement> |
getElementsByXPath(String xPath) |
String |
getElementTextById(String elementId) |
String |
getElementTextByXPath(String xpath) |
String |
getElementValueByID(String elementID)
Returns the content of the 'value' attribute of an element, given the element id
|
String |
getMessage(String key) |
String |
getMessage(String key,
String... args) |
String |
getName() |
String |
getPageSource() |
protected String |
getPageText() |
List<net.sourceforge.jwebunit.api.HttpHeader> |
getResponseHeaders() |
net.sourceforge.jwebunit.html.Table |
getTable(String tableSummaryNameOrId) |
net.sourceforge.jwebunit.util.TestContext |
getTestContext() |
net.sourceforge.jwebunit.api.ITestingEngine |
getTestingEngine() |
protected String |
getText(String key) |
protected com.google.common.collect.ImmutableList<String> |
getTextForList(String... keys) |
net.sourceforge.jwebunit.junit.WebTester |
getWebTester() |
void |
gotoPage(String url) |
boolean |
isTextPresent(String text)
Checks if text is present on the page
|
protected void |
log(String message) |
protected <T> List<T> |
scrapeTable(String id,
com.google.common.base.Function<List<String>,T> mapper) |
protected <T> List<T> |
scrapeTable(String id,
List<String> headings,
com.google.common.base.Function<List<String>,T> mapper) |
protected <T> List<T> |
scrapeTable(String id,
List<String> headings,
com.google.common.base.Function<List<String>,T> mapper,
boolean hasFooter) |
void |
selectOption(String selectName,
int index,
String label) |
void |
selectOption(String selectName,
String label) |
void |
selectOptionByValue(String selectName,
String value) |
void |
setRadioButton(String radioButtonName,
String value)
Sets a specific radio button.
|
void |
setScriptingEnabled(boolean value) |
void |
setTester(net.sourceforge.jwebunit.junit.WebTester tester)
Required so tester can be manually set externally when required.
|
void |
setTextField(String inputName,
String value) |
void |
setWorkingForm(int index) |
void |
setWorkingForm(String nameOrId) |
void |
submit() |
void |
submit(String buttonName) |
void |
uncheckCheckbox(String checkboxName) |
protected boolean |
waitFor(Callable<Boolean> isPresent) |
net.sourceforge.jwebunit.api.IElement |
waitForElementById(String id) |
void |
waitForElementByXPath(String xpath) |
void |
waitForElementToDisappearByXPath(String xpath) |
void |
waitForText(String text) |
void |
waitForText(String text,
long interval,
long maxInterval)
Waits for the specified key to appear on the page.
|
public ResourceBundle i18n
public void assertKeyPresent(String key)
key
- web resource namepublic void assertKeyPresent(String key, List args)
key
- web resource namepublic void assertTextNotPresent(String text)
public void assertTextPresent(String text, boolean suppressMessage)
public void assertTextPresent(String text)
public void assertSuccessPresent()
public void assertWarningNotPresent()
public void assertErrorNotPresent()
public void assertWarningAndErrorNotPresent()
assertWarningNotPresent()
,
assertErrorNotPresent()
public void assertErrorPresent()
public void assertErrorPresentWithKey(String keyName)
public void assertFieldErrorPresentWithKey(String keyName)
public void assertInfoPresent()
public void assertLinkPresentWithKey(String keyName)
keyName
- The key whose associated text will be searched for.public void assertKeyInElement(String elementID, String key)
elementID
- id of element to be inspectedkey
- the web resource's keypublic void assertElementIsDisabled(String elementID)
elementID
- id of element to be inspectedpublic void assertElementIsEnabled(String elementID)
elementID
- id of element to be inspectedpublic String getElementValueByID(String elementID)
elementID
- the id of the element we are looking forpublic void setRadioButton(String radioButtonName, String value)
radioButtonName
- The name of the radio button.value
- The value to set it too.public void clickLinkWithKey(String key)
key
- The value of this key is the link clickedpublic void addRequestHeader(String header, String value)
header
- header paramater.value
- parameter value.public void assertServerResponseContains(String string)
string
- string to search for.public void assertElementPresentByXPath(String xpath)
public void assertServerResponseDoesNotContain(String string)
string
- string to search for.public void assertTitleEquals(String expectedTitle)
public String getPageSource()
public void clickButtonWithText(String buttonValueText)
public void assertElementNotPresentByXPath(String xpath)
public void assertTitleNotEquals(String title)
public void assertLinkPresent(String linkId)
public void assertButtonPresent(String buttonId)
public void assertLinkPresentWithExactText(String linkText)
public List<net.sourceforge.jwebunit.api.HttpHeader> getResponseHeaders()
public void clickLinkWithText(String linkText, int index)
public net.sourceforge.jwebunit.api.ITestingEngine getDialog()
public net.sourceforge.jwebunit.api.ITestingEngine getTestingEngine()
public void setTester(net.sourceforge.jwebunit.junit.WebTester tester)
tester
- new tester.protected void log(String message)
protected String getPageText()
public void waitForText(String text, long interval, long maxInterval) throws Exception
Exception
public void waitForElementByXPath(String xpath) throws Exception
Exception
public void waitForElementToDisappearByXPath(String xpath) throws Exception
Exception
public net.sourceforge.jwebunit.api.IElement waitForElementById(String id) throws Exception
Exception
public void setWorkingForm(String nameOrId)
public void submit()
public void clickLinkWithExactText(String linkText)
public void checkCheckbox(String checkBoxName)
public void assertTextFieldEquals(String formElementName, String expectedValue)
public void clickLink(String linkId)
public void clickLinkInNavbar(String linkId)
public void clickButton(String buttonId)
public net.sourceforge.jwebunit.junit.WebTester getWebTester()
public void setScriptingEnabled(boolean value)
public void assertTableRowCountEquals(String tableSummaryNameOrId, int expectedRowCount)
public void assertTableNotPresent(String tableSummaryNameOrId)
public void assertSelectedOptionEquals(String selectName, String optionLabel)
public void assertSelectOptionsEqual(String selectName, String[] optionLabels)
public void assertSelectOptionNotPresent(String selectName, String optionLabel)
public void clickLinkWithText(String linkText)
public void assertCheckboxPresent(String checkBoxName)
public void assertCheckboxNotSelected(String checkBoxName)
public List<net.sourceforge.jwebunit.api.IElement> getElementsByXPath(String xPath)
public void assertTitleMatch(String regexp)
public net.sourceforge.jwebunit.api.IElement getElementByXPath(String xPath)
public void clickElementByXPath(String xpath)
public void uncheckCheckbox(String checkboxName)
public void assertElementNotPresent(String anID)
public void assertButtonNotPresent(String buttonId)
public void assertSelectedOptionValueEquals(String selectName, String value)
public void assertCheckboxSelected(String checkBoxName)
public void assertCheckboxNotPresent(String checkBoxName)
public void assertKeyNotPresent(String key)
public net.sourceforge.jwebunit.api.IElement getElementById(String id)
public void assertRadioOptionNotPresent(String name, String radioOption)
public void submit(String buttonName)
public void gotoPage(String url)
public void assertElementPresent(String anID)
public void assertTablePresent(String tableSummaryNameOrId)
public void assertTableEquals(String tableSummaryNameOrId, net.sourceforge.jwebunit.html.Table expectedTable)
public void assertLinkNotPresent(String linkId)
public void assertSubmitButtonNotPresent()
public void closeBrowser()
public net.sourceforge.jwebunit.html.Table getTable(String tableSummaryNameOrId)
public void assertFormPresent(String nameOrID)
public void setWorkingForm(int index)
public net.sourceforge.jwebunit.util.TestContext getTestContext()
public void beginAt(String aRelativeURL)
public String getName()
public boolean isTextPresent(String text)
text
- the text to match forpublic void assertKeyPresentOnce(String key)
key
- the key to check occurrences ofprotected <T> List<T> scrapeTable(String id, com.google.common.base.Function<List<String>,T> mapper)
protected <T> List<T> scrapeTable(String id, List<String> headings, com.google.common.base.Function<List<String>,T> mapper)
protected <T> List<T> scrapeTable(String id, List<String> headings, com.google.common.base.Function<List<String>,T> mapper, boolean hasFooter)
protected static org.hamcrest.Matcher<String> equalToIgnoringWhiteSpace(String s)
IsEqualIgnoringWhiteSpace
and also ignore no-break space.Copyright © 2020 Atlassian. All rights reserved.