|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object junit.framework.Assert junit.framework.TestCase com.atlassian.selenium.SeleniumTest com.atlassian.jira.webtest.selenium.JiraSeleniumTest com.atlassian.jira.webtest.selenium.gadgets.GadgetTest
public abstract class GadgetTest
Base class for selenium testing JIRA gadgets.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.atlassian.jira.webtest.selenium.JiraSeleniumTest |
---|
JiraSeleniumTest.Check |
Field Summary | |
---|---|
protected static int |
GADGET_DIRECTORY_TIMEOUT
|
protected Locator |
openDropdownLocator
|
protected static int |
TIMEOUT
|
protected String |
title
|
Fields inherited from class com.atlassian.jira.webtest.selenium.JiraSeleniumTest |
---|
ADMIN_PASSWORD, ADMIN_USERNAME, backdoor, DROP_DOWN_WAIT, environmentData, HSP_1, logger, MKY_1, PAGE_LOAD_WAIT, PAGE_LOAD_WAIT_TIME, PRESENT_TO_VISIBLE_DELAY, VK_DOWN, VK_ESC, VK_UP |
Fields inherited from class com.atlassian.selenium.SeleniumTest |
---|
assertThat, client, config, recorder |
Constructor Summary | |
---|---|
GadgetTest()
|
Method Summary | |
---|---|
void |
addGadget(String gadgetTitle)
Adds a gadget with the given name using the gadget directory. |
void |
addGadget(String gadgetTitle,
String iframeTitle)
Adds a gadget with the given name using the gadget directory. |
protected void |
assertAutoComplete(String field,
String hint,
String... autoCompleteLocators)
Asserts autocompletion field. |
protected void |
assertDaysPreviouslyFieldPresent()
Asserts that the 'Days Previously' text field is present |
protected void |
assertFieldOptionLabelsPresent(String field,
String[] labels)
Asserts that the given option labels are present for the given field. |
void |
assertFieldOptionValuePresent(String field,
String optionValue)
|
void |
assertFieldOptionValuesPresent(String field,
String[] optionValues)
Asserts that the given option values are present for the given field. |
protected void |
assertGadgetNotVisible(String expectedTitle)
Asserts that there is no gadget with the title specified |
protected void |
assertGadgetTitle(String expectedTitle)
Asserts the title of the gadget. |
protected void |
assertPeriodFieldPresent()
Asserts that the 'Period' select field and all its options are present |
protected void |
assertRefreshIntervalFieldPresent()
Asserts that the 'Refresh Interval' select field and all its options are present |
void |
assertSelectFieldError(String field,
String badValue,
String expectedError)
Sets a select field to a badValue, submits the form and asserts the expectedMessage is present. |
void |
assertTextFieldError(String field,
String badValue,
String expectedError)
Sets a text field (or hidden field etc.) to the given value, submits the form and asserts the presence of the given error. |
protected boolean |
clickConfigButton()
Clicks the gadget configure button |
protected boolean |
clickRefreshButton()
Clicks the gadget configure button |
protected void |
deleteGadget(String gadgetTitle)
Deletes a gadget if it exists. |
protected String |
getBaseUrl()
|
protected void |
loginAsAdmin()
|
protected void |
maximizeGadget(String gadgetTitle)
Maximizes the gadget if it isn't already |
protected void |
minimizeGadget(String gadgetTitle)
Minimizes the gadget if it isn't already |
void |
onSetUp()
Loads minimal starting data for gadget testing and does an admin login. |
protected void |
onTearDown()
|
protected void |
restoreGadgetData()
|
protected void |
selectByLabels(String selectFieldLocator,
String... labels)
Sets a (multi-) select field by label(s). |
protected void |
selectDashboardFrame()
|
protected void |
selectGadget(String gadgetTitle)
|
protected void |
selectProjectOrFilterFromAutoComplete(String field,
String hint,
String id)
|
protected void |
setSelectField(String field,
String value)
Sets a select field to the given value. |
protected void |
setTextField(String field,
String value)
Sets a text field (or hidden field etc.) to the given value. |
protected void |
submitGadgetConfig()
Submits the "form" that is the gadget config view. |
protected void |
viewGadgetAsAnonymous(String gadgetTitle)
|
protected void |
viewGadgetAsAnonymous(String gadgetTitle,
Runnable configureGadget)
|
protected void |
waitForGadgetConfiguration()
Waits for a gadget to load by waiting for its configuration form |
protected void |
waitForGadgetView(String id)
|
Methods inherited from class com.atlassian.selenium.SeleniumTest |
---|
getRecorder, getSeleniumClient, setUp, tearDown |
Methods inherited from class junit.framework.TestCase |
---|
countTestCases, createResult, getName, run, run, runTest, setName, toString |
Methods inherited from class junit.framework.Assert |
---|
assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertEquals, assertFalse, assertFalse, assertNotNull, assertNotNull, assertNotSame, assertNotSame, assertNull, assertNull, assertSame, assertSame, assertTrue, assertTrue, fail, fail, failNotEquals, failNotSame, failSame, format |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface junit.framework.Test |
---|
countTestCases, run |
Field Detail |
---|
protected static final int TIMEOUT
protected static final int GADGET_DIRECTORY_TIMEOUT
protected String title
protected Locator openDropdownLocator
Constructor Detail |
---|
public GadgetTest()
Method Detail |
---|
public void onSetUp()
onSetUp
in class JiraSeleniumTest
protected void onTearDown() throws Exception
onTearDown
in class com.atlassian.selenium.SeleniumTest
Exception
protected void restoreGadgetData()
protected void loginAsAdmin()
public void addGadget(String gadgetTitle)
gadgetTitle
- the proper title of the gadget, e.g. "Issues: Resolution Time"public void addGadget(String gadgetTitle, String iframeTitle)
gadgetTitle
- the proper title of the gadget, e.g. "Issues: Resolution Time"iframeTitle
- the title of the iframepublic void assertSelectFieldError(String field, String badValue, String expectedError)
null
) cannot be removed. So try to test all valid selections before
this one.
field
- the name of the field.badValue
- the value to give it that should produce the expectedErrorexpectedError
- the error message expected, if it does not occur, it's a failure.protected void setSelectField(String field, String value)
null
, it is, to my knowledge, unable to remove the invaild
value.
field
- the id or the name attribute of the fieldvalue
- the option value (not label) to set, or null
to remove all existing valid selectionsprotected void selectByLabels(String selectFieldLocator, String... labels)
selectFieldLocator
- the Selenium locator to locate the select fieldlabels
- the labels to select. To remove all labels, don't pass this parameter.public void assertTextFieldError(String field, String badValue, String expectedError)
field
- name of the field.badValue
- value to give the field to produce the error.expectedError
- the error expected.protected void setTextField(String field, String value)
field
- name of the field.value
- value to give the field.protected void assertFieldOptionLabelsPresent(String field, String[] labels)
field
- the field.labels
- the labels to assert are present.public void assertFieldOptionValuesPresent(String field, String[] optionValues)
field
- the field.optionValues
- the values to assert are present.public void assertFieldOptionValuePresent(String field, String optionValue)
protected void waitForGadgetConfiguration()
protected void waitForGadgetView(String id)
protected void selectGadget(String gadgetTitle)
protected void submitGadgetConfig()
protected void assertRefreshIntervalFieldPresent()
protected void assertPeriodFieldPresent()
protected void assertDaysPreviouslyFieldPresent()
protected void maximizeGadget(String gadgetTitle)
gadgetTitle
- the gadget to maximize.protected void minimizeGadget(String gadgetTitle)
gadgetTitle
- the gadget to minimize.protected void selectDashboardFrame()
protected void deleteGadget(String gadgetTitle)
gadgetTitle
- the gadget to delete.protected boolean clickConfigButton()
protected boolean clickRefreshButton()
protected void assertGadgetTitle(String expectedTitle)
expectedTitle
- the expected title of the gadgetprotected void assertGadgetNotVisible(String expectedTitle)
expectedTitle
- the expected title of the gadgetprotected String getBaseUrl()
protected void selectProjectOrFilterFromAutoComplete(String field, String hint, String id)
protected void assertAutoComplete(String field, String hint, String... autoCompleteLocators)
field
- the id or name of the field that is autocompletedhint
- the text typed to trigger the suggestion list (at least 3 characters long)autoCompleteLocators
- an array of Selenium locators that should be visibleprotected void viewGadgetAsAnonymous(String gadgetTitle)
protected void viewGadgetAsAnonymous(String gadgetTitle, Runnable configureGadget)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |