|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjunit.framework.Assert
junit.framework.TestCase
org.zkoss.ztl.ZKSeleneseTestCase
org.zkoss.ztl.ZKTestCase
org.zkoss.ztl.ZKClientTestCase
public class ZKClientTestCase
A skeleton of ZK client widget.
Field Summary | |
---|---|
protected int |
_timeout
|
Fields inherited from class org.zkoss.ztl.ZKTestCase |
---|
_selenium, A, ALT, BACKSPACE, browsers, C, caseID, CTRL, DELETE, DELETE_NATIVE, DOWN, END, ENTER, ESC, HOME, INSERT, LEFT, NUM_0, NUM_1, NUM_2, NUM_3, NUM_4, NUM_5, NUM_6, NUM_7, NUM_8, NUM_9, PAGE_DOWN, PAGE_UP, recordCount, RIGHT, SHIFT, TAB, target, UP, V, X |
Fields inherited from class org.zkoss.ztl.ZKSeleneseTestCase |
---|
selenium, timeUUID |
Constructor Summary | |
---|---|
ZKClientTestCase()
|
Method Summary | |
---|---|
void |
addSelection(ClientWidget locator,
java.lang.String optionLocator)
|
void |
assignId(ClientWidget locator,
java.lang.String identifier)
|
void |
blur(ClientWidget locator)
|
void |
check(ClientWidget locator)
|
void |
click(ClientWidget locator)
|
void |
clickAlert()
|
void |
clickAt(ClientWidget locator,
java.lang.String coordString)
|
void |
closeErrorBox()
Close the errorbox for webdriver |
void |
contextMenu(ClientWidget locator)
|
void |
contextMenuAt(ClientWidget locator,
java.lang.String coordString)
|
void |
doScroll(ClientWidget locatorOfObjectToBeDragged,
ClientWidget locatorOfDragDestinationObject,
java.lang.String from,
java.lang.String to)
|
void |
doubleClick(ClientWidget locator)
|
void |
doubleClickAt(ClientWidget locator,
java.lang.String coordString)
|
void |
doubleTap(ClientWidget locator)
Performs a double tap on the element found by locator, analogous to double click using a mouse |
void |
dragAndDrop(ClientWidget locator,
java.lang.String movementsString)
|
void |
dragAndDropToObject(ClientWidget locatorOfObjectToBeDragged,
ClientWidget locatorOfDragDestinationObject)
|
void |
dragdrop(ClientWidget locator,
java.lang.String movementsString)
|
void |
dragdropTo(ClientWidget locatorOfObjectToBeDragged,
java.lang.String from,
java.lang.String to)
|
void |
dragdropToObject(ClientWidget locatorOfObjectToBeDragged,
ClientWidget locatorOfDragDestinationObject,
java.lang.String from,
java.lang.String to)
|
void |
ensureLandscape()
Ensures the device is in landscape orientation |
void |
ensurePortrait()
Ensures the device is in portrait orientation |
void |
fakeClick(ClientWidget locator)
|
void |
fireEvent(ClientWidget locator,
java.lang.String eventName)
|
void |
focus(ClientWidget locator)
|
void |
frozenScroll(ClientWidget locator,
int num)
|
java.lang.String |
getAlertMessage()
a shortcut for getting alert message. |
java.lang.String |
getAttribute(ClientWidget attributeLocator)
|
java.lang.Number |
getCursorPosition(ClientWidget locator)
|
java.lang.Number |
getElementHeight(ClientWidget locator)
|
java.lang.Number |
getElementIndex(ClientWidget locator)
|
java.lang.Number |
getElementPositionLeft(ClientWidget locator)
|
java.lang.Number |
getElementPositionTop(ClientWidget locator)
|
java.lang.Number |
getElementWidth(ClientWidget locator)
|
java.lang.String |
getOrientation()
Returns the current device orientation |
int |
getScrollLeft(Widget widget)
|
int |
getScrollTop(Widget widget)
|
java.lang.String |
getSelectedId(ClientWidget selectLocator)
|
java.lang.String[] |
getSelectedIds(ClientWidget selectLocator)
|
java.lang.String |
getSelectedIndex(ClientWidget selectLocator)
|
java.lang.String[] |
getSelectedIndexes(ClientWidget selectLocator)
|
java.lang.String |
getSelectedLabel(ClientWidget selectLocator)
|
java.lang.String[] |
getSelectedLabels(ClientWidget selectLocator)
|
java.lang.String |
getSelectedValue(ClientWidget selectLocator)
|
java.lang.String[] |
getSelectedValues(ClientWidget selectLocator)
|
java.lang.String[] |
getSelectOptions(ClientWidget selectLocator)
|
java.lang.String |
getTable(ClientWidget tableCellAddress)
|
java.lang.String |
getText(ClientWidget locator)
|
java.lang.String |
getValue(ClientWidget locator)
|
java.lang.String |
getZKLog()
a shortcut to get the value in zk.log textarea |
protected boolean |
hasError()
Returns boolean to indicate if there is any js error or erro window |
boolean |
hasHScrollbar(ClientWidget locator)
detect if it has a horizontal scroll bar |
boolean |
hasNativeScroll(ClientWidget locator)
|
boolean |
hasVScrollbar(ClientWidget locator)
detect if it has a vertical scroll bar |
void |
highlight(ClientWidget locator)
|
void |
horScroll(ClientWidget locator,
double percent)
|
void |
horScrollNoBody(ClientWidget locator,
double percent)
In a case that widget only has 'cave' but 'body', we will calculate sum of all children's width of cave, and move widget's scrollbar |
boolean |
isChecked(ClientWidget locator)
|
boolean |
isEditable(ClientWidget locator)
|
boolean |
isElementPresent(ClientWidget locator)
|
boolean |
isOrdered(ClientWidget locator1,
ClientWidget locator2)
|
boolean |
isSomethingSelected(ClientWidget selectLocator)
|
boolean |
isTextPresent(java.lang.String pattern)
|
boolean |
isVisible(ClientWidget locator)
|
protected JQuery |
jq(ClientWidget el)
Returns the Jquery object of the ZKClientObject. |
protected JQuery |
jq(java.lang.String selector)
Returns the Jquery object of the selector Default: without "#" sign |
void |
keyDown(ClientWidget locator,
java.lang.String keySequence)
|
void |
keyPress(ClientWidget locator,
java.lang.String keySequence)
2010/10/29 TonyQ:note: when typing number in chrome , it failed |
void |
keyPressEnter(ClientWidget locator)
2010/10/27 TonyQ: because there exist a lot of problem to press enter for ENTER key , so we build the method for it. |
void |
keyUp(ClientWidget locator,
java.lang.String keySequence)
|
void |
longPress(ClientWidget locator)
Performs a long press gesture on the element found by locator |
void |
mouseDown(ClientWidget locator)
|
void |
mouseDownAt(ClientWidget locator,
java.lang.String coordString)
|
void |
mouseDownRight(ClientWidget locator)
|
void |
mouseDownRightAt(ClientWidget locator,
java.lang.String coordString)
|
void |
mouseMove(ClientWidget locator)
|
void |
mouseMoveAt(ClientWidget locator,
java.lang.String coordString)
|
void |
mouseOut(ClientWidget locator)
|
void |
mouseOver(org.openqa.selenium.By locator)
|
void |
mouseUp(ClientWidget locator)
|
void |
mouseUpAt(ClientWidget locator,
java.lang.String coordString)
|
void |
mouseUpRight(ClientWidget locator)
|
void |
mouseUpRightAt(ClientWidget locator,
java.lang.String coordString)
|
void |
nativeFrozenScroll(ClientWidget locator,
double dist)
|
static int |
parseInt(java.lang.String number)
Returns the int value from the given string number. |
void |
removeAllSelections(ClientWidget locator)
|
protected void |
removeChildren(Widget w)
Remove all of the children of the given widget. |
void |
removeSelection(ClientWidget locator,
java.lang.String optionLocator)
|
void |
rollup(ClientWidget rollupName,
java.lang.String kwargs)
|
void |
rotate()
Rotate the device |
protected void |
runZscript(java.lang.String zscript)
|
void |
select(ClientWidget selectLocator,
int index)
|
void |
select(ClientWidget selectLocator,
java.lang.String optionLocator)
|
void |
selectFrame(ClientWidget locator)
|
void |
sendKeys(org.openqa.selenium.By by,
java.lang.CharSequence... keysToSend)
Use this method to simulate typing into an element, which may set its value. |
void |
setContext(ClientWidget context)
|
void |
setCursorPosition(ClientWidget locator,
java.lang.String position)
|
void |
singleTap(ClientWidget locator)
Performs a single tap on the element found by locator, analogous to click using a mouse |
void |
singleTapAt(ClientWidget locator,
int xOffset,
int yOffset)
Performs a single tap on the element found by locator tanalogous to click using a mouse The tap position is at an offset position. |
void |
submit(ClientWidget formLocator)
|
void |
swipeDown(ClientWidget locator,
int distance)
Swipe down at the top edge of the element found by locator |
void |
swipeLeft(ClientWidget locator,
int distance)
Swipe left at the right edge of the element found by locator |
void |
swipeRight(ClientWidget locator,
int distance)
Swipe right at the left edge of the element found by locator |
void |
swipeUp(ClientWidget locator,
int distance)
Swipe up at the bottom edge of the element found by locator |
void |
switchTab()
Switch to the next tab by sending "CTRL + TAB" to the browser, if current tab is the last tab, will switch to the first tab. |
void |
type(ClientWidget locator,
java.lang.String value)
Types the value to the locator. |
void |
typeKeys(ClientWidget locator,
java.lang.String value)
Types the value to the locator. |
void |
uncheck(ClientWidget locator)
|
void |
verifyImage()
Verify image after waitResponse(). |
void |
verifyImage(Comparator comparator)
Verifies the image before response has done. |
void |
verScroll(ClientWidget locator,
double percent)
|
void |
verScrollNoBody(ClientWidget locator,
double percent)
In a case that widget only has 'cave' but 'body', we will calculate sum of all children's height of cave, and move widget's scrollbar |
protected void |
waitResponse()
Waits for Ajax response. |
protected void |
waitResponse(boolean includingAnimation)
Waits for Ajax response. |
protected void |
waitResponse(int timeout)
Waits for Ajax response according to the timeout attribute. |
protected void |
waitResponse(int timeout,
boolean includingAnimation)
Waits for Ajax response according to the timeout attribute. |
protected Widget |
widget(int number)
Returns the Widget object of the UUID. |
protected Widget |
widget(JQuery jQuery)
Returns the Widget object from the JQuery object. |
protected Widget |
widget(java.lang.String uuid)
Returns the Widget object of the UUID. |
protected ZK |
zk(ClientWidget el)
Returns the ZK object of the ZKClientObject. |
protected ZK |
zk(java.lang.String selector)
Returns the ZK object of the selector |
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, 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 |
Field Detail |
---|
protected int _timeout
Constructor Detail |
---|
public ZKClientTestCase()
Method Detail |
---|
protected void waitResponse()
By default the timeout time is specified in config.properties
waitResponse(int)
protected void waitResponse(boolean includingAnimation)
By default the timeout time is specified in config.properties
includingAnimation
- if true, it will include animation check.waitResponse(int, boolean)
public void verifyImage(Comparator comparator)
verifyImage
in class ZKTestCase
comparator
- an image comparator.protected void waitResponse(int timeout, boolean includingAnimation)
timeout
- includingAnimation
- if true, it will include animation check.protected void waitResponse(int timeout)
timeout
- the time. (millisecond).waitResponse(int, boolean)
protected void removeChildren(Widget w)
protected void runZscript(java.lang.String zscript)
public void verifyImage()
verifyImage
in class ZKTestCase
DefaultComparator
protected Widget widget(int number)
number
- the number of the widget ID.ZKTestCase.uuid(int)
,
widget(String)
protected Widget widget(java.lang.String uuid)
uuid
- the widget ID.protected Widget widget(JQuery jQuery)
jQuery
- the JQuery object.protected JQuery jq(java.lang.String selector)
Default: without "#" sign
selector
- the selectorprotected JQuery jq(ClientWidget el)
el
- the ZKClientObjectprotected boolean hasError()
protected ZK zk(ClientWidget el)
el
- the ZKClientObjectprotected ZK zk(java.lang.String selector)
selector
- the selector of the elementpublic static int parseInt(java.lang.String number)
number
- the string number, if null or empty, 0 is assumed.public void addSelection(ClientWidget locator, java.lang.String optionLocator)
public void assignId(ClientWidget locator, java.lang.String identifier)
public void check(ClientWidget locator)
public void click(ClientWidget locator)
public void fakeClick(ClientWidget locator)
public void closeErrorBox()
public void clickAt(ClientWidget locator, java.lang.String coordString)
public void contextMenu(ClientWidget locator)
public void contextMenuAt(ClientWidget locator, java.lang.String coordString)
public void doubleClick(ClientWidget locator)
public void doubleClickAt(ClientWidget locator, java.lang.String coordString)
public void dragAndDrop(ClientWidget locator, java.lang.String movementsString)
public void dragdropTo(ClientWidget locatorOfObjectToBeDragged, java.lang.String from, java.lang.String to)
public void dragdropToObject(ClientWidget locatorOfObjectToBeDragged, ClientWidget locatorOfDragDestinationObject, java.lang.String from, java.lang.String to)
public void dragAndDropToObject(ClientWidget locatorOfObjectToBeDragged, ClientWidget locatorOfDragDestinationObject)
public void dragdrop(ClientWidget locator, java.lang.String movementsString)
public void fireEvent(ClientWidget locator, java.lang.String eventName)
public void focus(ClientWidget locator)
locator
- public void blur(ClientWidget locator)
locator
- public java.lang.String getAttribute(ClientWidget attributeLocator)
public java.lang.Number getCursorPosition(ClientWidget locator)
public java.lang.Number getElementHeight(ClientWidget locator)
public java.lang.Number getElementIndex(ClientWidget locator)
public java.lang.Number getElementPositionLeft(ClientWidget locator)
public java.lang.Number getElementPositionTop(ClientWidget locator)
public java.lang.Number getElementWidth(ClientWidget locator)
public java.lang.String[] getSelectOptions(ClientWidget selectLocator)
public java.lang.String getSelectedId(ClientWidget selectLocator)
public java.lang.String[] getSelectedIds(ClientWidget selectLocator)
public java.lang.String getSelectedIndex(ClientWidget selectLocator)
public java.lang.String[] getSelectedIndexes(ClientWidget selectLocator)
public java.lang.String getSelectedLabel(ClientWidget selectLocator)
public java.lang.String[] getSelectedLabels(ClientWidget selectLocator)
public java.lang.String getSelectedValue(ClientWidget selectLocator)
public java.lang.String[] getSelectedValues(ClientWidget selectLocator)
public java.lang.String getTable(ClientWidget tableCellAddress)
public java.lang.String getText(ClientWidget locator)
public java.lang.String getValue(ClientWidget locator)
public void highlight(ClientWidget locator)
public boolean isChecked(ClientWidget locator)
public boolean isEditable(ClientWidget locator)
public boolean isElementPresent(ClientWidget locator)
public boolean isOrdered(ClientWidget locator1, ClientWidget locator2)
public boolean isSomethingSelected(ClientWidget selectLocator)
public boolean isTextPresent(java.lang.String pattern)
isTextPresent
in interface com.thoughtworks.selenium.Selenium
isTextPresent
in class ZKTestCase
public boolean isVisible(ClientWidget locator)
public void keyDown(ClientWidget locator, java.lang.String keySequence)
public void keyPress(ClientWidget locator, java.lang.String keySequence)
locator
- keySequence
- public void sendKeys(org.openqa.selenium.By by, java.lang.CharSequence... keysToSend)
by
- The locating mechanism to usekeysToSend
- public void keyPressEnter(ClientWidget locator)
2010/10/27 TonyQ: because there exist a lot of problem to press enter for ENTER key , so we build the method for it. NOTICE:Because we use the keyPressNative , so you need to let computer focus on browser when you run the test case which use this method, or the native key press will NOT work anyway. If you want modify this ,please make sure that browser compatibility is ok . This is a hard method anyway. It is a issue for selenium.
public void keyUp(ClientWidget locator, java.lang.String keySequence)
public void mouseDown(ClientWidget locator)
public void mouseDownAt(ClientWidget locator, java.lang.String coordString)
public void mouseDownRight(ClientWidget locator)
public void mouseDownRightAt(ClientWidget locator, java.lang.String coordString)
public void mouseMove(ClientWidget locator)
public void mouseMoveAt(ClientWidget locator, java.lang.String coordString)
public void mouseOut(ClientWidget locator)
public void mouseOver(org.openqa.selenium.By locator)
public void mouseUp(ClientWidget locator)
public void mouseUpAt(ClientWidget locator, java.lang.String coordString)
public void mouseUpRight(ClientWidget locator)
public void mouseUpRightAt(ClientWidget locator, java.lang.String coordString)
public void removeAllSelections(ClientWidget locator)
public void removeSelection(ClientWidget locator, java.lang.String optionLocator)
public void rollup(ClientWidget rollupName, java.lang.String kwargs)
public void select(ClientWidget selectLocator, java.lang.String optionLocator)
public void select(ClientWidget selectLocator, int index)
public void selectFrame(ClientWidget locator)
public void setContext(ClientWidget context)
public void setCursorPosition(ClientWidget locator, java.lang.String position)
public void submit(ClientWidget formLocator)
public void frozenScroll(ClientWidget locator, int num)
locator
- num
- public void nativeFrozenScroll(ClientWidget locator, double dist)
locator
- percent
- public boolean hasNativeScroll(ClientWidget locator)
public void verScroll(ClientWidget locator, double percent)
locator
- percent
- public void horScroll(ClientWidget locator, double percent)
locator
- percent
- public void horScrollNoBody(ClientWidget locator, double percent)
locator
- percent
- public void verScrollNoBody(ClientWidget locator, double percent)
locator
- percent
- public boolean hasHScrollbar(ClientWidget locator)
locator
-
public boolean hasVScrollbar(ClientWidget locator)
locator
-
public void doScroll(ClientWidget locatorOfObjectToBeDragged, ClientWidget locatorOfDragDestinationObject, java.lang.String from, java.lang.String to)
public int getScrollTop(Widget widget)
public int getScrollLeft(Widget widget)
public void type(ClientWidget locator, java.lang.String value)
The method will call focus() before typing and blur() after typed.
public java.lang.String getAlertMessage()
public java.lang.String getZKLog()
public void clickAlert()
public void typeKeys(ClientWidget locator, java.lang.String value)
The method will call focus() before typing and blur() after typed.
public void uncheck(ClientWidget locator)
public void singleTap(ClientWidget locator)
locator
- an element locatorpublic void singleTapAt(ClientWidget locator, int xOffset, int yOffset)
locator
- an element locatorxOffset
- px toward the rightyOffset
- px toward the bottompublic void doubleTap(ClientWidget locator)
locator
- an element locatorpublic void longPress(ClientWidget locator)
locator
- an element locatorpublic void swipeUp(ClientWidget locator, int distance)
locator
- an element locatordistance
- amount to swipe (in device pixel)public void swipeDown(ClientWidget locator, int distance)
locator
- an element locatordistance
- amount to swipe (in device pixel)public void swipeLeft(ClientWidget locator, int distance)
locator
- an element locatordistance
- amount to swipe (in device pixel)public void swipeRight(ClientWidget locator, int distance)
locator
- an element locatordistance
- amount to swipe (in device pixel)public java.lang.String getOrientation()
public void rotate()
public void ensureLandscape()
public void ensurePortrait()
public void switchTab()
Will also switch WebDriver's focus to the newly switched tab, so other operations can proceed as normal.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |