|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jboss.test.selenium.AbstractSeleniumTestCase
public abstract class AbstractSeleniumTestCase
Class that serves as basis for all Selenium-based tests.
| Field Summary | |
|---|---|
static long |
AJAX_LOAD
Generic timeout in miliseconds used for AJAX timeouts |
static int |
ELEM_TIMEOUT
Element timeout in seconds used in waitForElement functions |
protected java.util.Properties |
locatorsProperties
|
protected java.util.Properties |
messagesProperties
|
static java.lang.String |
PAGE_LOAD
Generic timeout in miliseconds used in every selenium function waitForPageToLoad() |
protected com.thoughtworks.selenium.Selenium |
selenium
|
| Constructor Summary | |
|---|---|
AbstractSeleniumTestCase()
|
|
| Method Summary | ||
|---|---|---|
void |
addRequiredScript(java.lang.String script)
Add required script to page once. |
|
boolean |
assertTextOrder(java.lang.String text)
Asserts the text order on the page. |
|
boolean |
belongsClass(java.lang.String className,
java.lang.String locator)
Checks if element given by locator is member of CSS class given by className. |
|
void |
clickAndWait(java.lang.String locator)
Click and wait. |
|
void |
clickIfVisible(java.lang.String id)
Click on an element only in the case element is present on the screen. |
|
int |
countTableRows(java.lang.String tableLocation)
Counts table rows for selected table. |
|
int |
findTableRow(java.lang.String tableLocation,
java.lang.String searchName,
int searchCol)
Finding the correct row in a table due to input string and columns. |
|
static java.lang.String |
format(java.lang.String format,
java.lang.Object... args)
Uses a MessageFormat.format() to prepare given format string and use it to format result with given arguments. |
|
java.lang.String |
formatLoc(java.lang.String prop,
java.lang.Object... args)
Gets the property from messagesProperties and use it to format Message with given arguments |
|
java.lang.String |
formatMsg(java.lang.String prop,
java.lang.Object... args)
Gets the property from messagesProperties and use it to format Message with given arguments |
|
java.lang.String |
getAttributeOrNull(java.lang.String attributeLocator)
Gets the value of an element attribute. |
|
int |
getJQueryCount(java.lang.String selector)
Returns the count of elements for given jQuery selector |
|
java.lang.String |
getLoc(java.lang.String prop)
Gets the property from locatorsProperties |
|
java.lang.String |
getLoc(java.lang.String prop,
java.lang.String subst)
Gets the property from locatorsProperties |
|
protected java.util.Properties |
getLocatorsProperties()
This method initializes properties with locators. |
|
java.lang.String |
getMess(java.lang.String prop)
Deprecated. |
|
java.lang.String |
getMess(java.lang.String prop,
java.lang.String subst)
Deprecated. |
|
protected java.util.Properties |
getMessagesProperties()
This method initializes properties with messages. |
|
java.lang.String |
getMsg(java.lang.String prop)
Gets the property from messagesProperties. |
|
java.lang.String |
getMsg(java.lang.String prop,
java.lang.String subst)
Gets the property from messagesProperties. |
|
protected
|
getNamedPropertiesForClass(java.lang.Class<T> tClass,
java.lang.String name)
Loads properties from specified resource file in context of specified class' package. |
|
protected static java.util.Properties |
getProperties(java.lang.String resource)
Loads properties from specified resource file |
|
java.lang.String |
getStyle(java.lang.String locator,
java.lang.String property)
Get current style value of element given by locator. |
|
java.lang.String |
getTextOrNull(java.lang.String locator)
Gets the text of an element. |
|
boolean |
isDisplayed(java.lang.String locator)
Returns whether the element is displayed on the page. |
|
void |
mouseOverAt(java.lang.String locator,
java.lang.String coordString)
Simulates a user hovering a mouse over the specified element at specific coordinates relative to element. |
|
void |
openAndWait(java.lang.String locator)
Open and wait. |
|
java.lang.String |
removeJQueryPrefix(java.lang.String jqueryLocator)
Remove *jquery= prefix of locators given by jQuery selector |
|
void |
safeSelect(java.lang.String locator,
java.lang.String value)
Selects a value only if the value is present in the select. |
|
void |
scrollIntoView(java.lang.String locator,
boolean alignToTop)
Aligns screen to top (resp. |
|
void |
selectIfNotSelected(java.lang.String selector,
java.lang.String label)
Select if not selected. |
|
void |
waitFor(long time)
Waits for specified time in ms. |
|
void |
waitForAttributeChanges(java.lang.String attributeLocator,
java.lang.String attributeValue)
Wait for attribute of element given by attributeLocator changes from attributeValue to another value. |
|
java.lang.String |
waitForAttributeChangesAndReturn(java.lang.String attributeLocator,
java.lang.String attributeValue)
Wait for attribute of element given by attributeLocator changes from attributeValue to another value and returns this new value. |
|
void |
waitForElement(java.lang.String locator)
Waits for element to appear on the screen. |
|
void |
waitForElement(java.lang.String locator,
int step)
Waits for element to appear on the screen. |
|
void |
waitForElement(java.lang.String locatorElem,
long timeToWait)
Waits for element to appear on the screen. |
|
void |
waitForElement(java.lang.String locatorElem,
java.lang.String locatorLink,
long timeToWait,
long n)
Deprecated. |
|
void |
waitForText(java.lang.String text)
Waits for text to appear on the screen. |
|
void |
waitForTextChanges(java.lang.String locator,
java.lang.String lastText)
Wait for text of element given by locator changes from lastText to another text. |
|
java.lang.String |
waitForTextChangesAndReturn(java.lang.String locator,
java.lang.String lastText)
Wait for text of element given by locator changes from lastText to another text and returns this new text. |
|
void |
waitForTextEquals(java.lang.String locator,
java.lang.String pattern)
Waits for element specified by locator does contain text specified by pattern |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.Properties locatorsProperties
protected java.util.Properties messagesProperties
protected com.thoughtworks.selenium.Selenium selenium
public static java.lang.String PAGE_LOAD
public static long AJAX_LOAD
public static int ELEM_TIMEOUT
| Constructor Detail |
|---|
public AbstractSeleniumTestCase()
| Method Detail |
|---|
protected java.util.Properties getMessagesProperties()
protected java.util.Properties getLocatorsProperties()
protected static java.util.Properties getProperties(java.lang.String resource)
throws java.io.IOException
resource - where in classpath the file is located
java.io.IOException - if an error occurred when reading resource file
protected <T> java.util.Properties getNamedPropertiesForClass(java.lang.Class<T> tClass,
java.lang.String name)
throws java.lang.IllegalStateException
tClass - named resource will be searched in context of this classname - name of resource contained in current class' package
java.lang.IllegalStateException - if an error occurred when reading resource file
@Deprecated
public java.lang.String getMess(java.lang.String prop,
java.lang.String subst)
prop - the name of the propertysubst - the value which is returned in the case the property isn't set
java.lang.IllegalStateException - when property wasn't found and substitution isn't setgetMsg(String, String),
getMessagesProperties()@Deprecated public java.lang.String getMess(java.lang.String prop)
prop - the name of the property
java.lang.IllegalStateException - when property wasn't foundgetMsg(String),
getMessagesProperties()
public java.lang.String getMsg(java.lang.String prop,
java.lang.String subst)
prop - the name of the propertysubst - the value which is returned in the case the property isn't set
java.lang.IllegalStateException - when property wasn't found and substitution isn't setgetMessagesProperties()public java.lang.String getMsg(java.lang.String prop)
prop - the name of the property
java.lang.IllegalStateException - when property wasn't foundgetMessagesProperties()
public java.lang.String formatMsg(java.lang.String prop,
java.lang.Object... args)
prop - the name of the property with message format.args - an array of atributes to be formatted and substituted to prop
java.lang.IllegalStateException - when property wasn't found
public java.lang.String getLoc(java.lang.String prop,
java.lang.String subst)
prop - the name of the propertysubst - the value which is returned in the case the property isn't set
java.lang.IllegalStateException - when property wasn't found and substitution isn't setgetLocatorsProperties()public java.lang.String getLoc(java.lang.String prop)
prop - the name of the property
java.lang.IllegalStateException - when property wasn't foundgetLocatorsProperties()
public java.lang.String formatLoc(java.lang.String prop,
java.lang.Object... args)
prop - the name of the property with message format.args - an array of atributes to be formatted and substituted to prop
java.lang.IllegalStateException - when property wasn't foundgetLocatorsProperties()
public static java.lang.String format(java.lang.String format,
java.lang.Object... args)
format - string used in MessageFormat.format()args - used to formatting given format string
public void clickIfVisible(java.lang.String id)
id - element locator
public int findTableRow(java.lang.String tableLocation,
java.lang.String searchName,
int searchCol)
tableLocation - the table locatorsearchName - the string which the function searches forsearchCol - the column in which the function searches for
public int countTableRows(java.lang.String tableLocation)
tableLocation - the table locator
public void safeSelect(java.lang.String locator,
java.lang.String value)
locator - the locator of the select tagvalue - the value which should be selectedpublic void clickAndWait(java.lang.String locator)
locator - the locator of the element to be clicked onpublic void openAndWait(java.lang.String locator)
locator - the address to be opened
public void selectIfNotSelected(java.lang.String selector,
java.lang.String label)
selector - the selector locatorlabel - the label to be selectedpublic boolean assertTextOrder(java.lang.String text)
text - input text in comma separated format which order is to be
asserted
public void waitFor(long time)
time - the time (in ms) to be waited for.public void waitForElement(java.lang.String locator)
locator - the locator of the element to be waited for
public void waitForElement(java.lang.String locator,
int step)
locator - the locator of the element to be waited forstep - interval between two pollings
public void waitForElement(java.lang.String locatorElem,
long timeToWait)
locatorElem - the element locatortimeToWait - the time (in ms) to wait until timeout is reached
@Deprecated
public void waitForElement(java.lang.String locatorElem,
java.lang.String locatorLink,
long timeToWait,
long n)
locatorElem - the element locatorlocatorLink - the link locator - not usedtimeToWait - the time (in ms) to wait until timeout is reachedn - the nwaitForElement(String, long)public void waitForText(java.lang.String text)
text - the text to be waited for
public void waitForTextEquals(java.lang.String locator,
java.lang.String pattern)
locator - text of this locator's element will be tested for equivalence
to pattern textpattern - pattern text, which will be tested to equivalence to element's
text given by locator
public void waitForTextChanges(java.lang.String locator,
java.lang.String lastText)
locator - locator of elementlastText - current text what we are waiting for change
public java.lang.String waitForTextChangesAndReturn(java.lang.String locator,
java.lang.String lastText)
locator - locator of elementlastText - current text what we are waiting for change
public void waitForAttributeChanges(java.lang.String attributeLocator,
java.lang.String attributeValue)
attributeLocator - locator of attributeattributeValue - current value attribute what we are waiting for change
public java.lang.String waitForAttributeChangesAndReturn(java.lang.String attributeLocator,
java.lang.String attributeValue)
attributeLocator - locator of attributeattributeValue - current value attribute what we are waiting for change
public java.lang.String getStyle(java.lang.String locator,
java.lang.String property)
locator - of element from what we want to get current style valueproperty - CSS style property what we can to recognize
java.lang.IllegalStateException - if is caught unrecognized throwable
public void scrollIntoView(java.lang.String locator,
boolean alignToTop)
locator - of element which should be screen aligned toalignToTop - should be top border of screen aligned to top border of
elementpublic int getJQueryCount(java.lang.String selector)
selector - jQuery selector
public boolean belongsClass(java.lang.String className,
java.lang.String locator)
className - name of CSS classlocator - element's locator
public boolean isDisplayed(java.lang.String locator)
locator - element locator
public void mouseOverAt(java.lang.String locator,
java.lang.String coordString)
locator - element's locatorcoordString - specifies the x,y position (i.e. - 10,20) of the mouse event
relative to the element returned by the locator.public java.lang.String getTextOrNull(java.lang.String locator)
locator - an element locator
public java.lang.String getAttributeOrNull(java.lang.String attributeLocator)
attributeLocator - an element's attribute locator
public void addRequiredScript(java.lang.String script)
script - what should be added to the pagepublic java.lang.String removeJQueryPrefix(java.lang.String jqueryLocator)
jqueryLocator - locator in jQuery selector's syntax
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||