Custom defined commands that can be used for testing. Provides a number of
helper commands such as element finding, touch actions and screenshot testing.
- Source:
Methods
(static) alertAccept()
Accept the alert on the display to clear it away.
- Source:
(static) androidHideKeyboard()
Used for hiding the keyboard on Android devices, as it
sometimes focuses on new text fields.
- Source:
(static) backspace()
Use the backspace key on the keyboard for the required platform.
- Source:
(static) doubleClick()
Double click on the passed element.
- Source:
(static) elementClassName(className)
Return an element by its platform specific class name.
Parameters:
| Name | Type | Description |
|---|---|---|
className |
String | The class name of the desired element. |
- Source:
(static) elementId(element)
Return an element by its ID.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
String | The element ID used to identify the element. |
- Source:
(static) elementsClassName(className)
Count the number of elements by its platform specific class name.
Parameters:
| Name | Type | Description |
|---|---|---|
className |
String | The class name of the desired element. |
- Source:
(static) elementsId(element)
Count the number of elements by its ID.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
String | The element ID used to identify the element. |
- Source:
(static) elementsText(text)
Count the number of elements by its text content.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
String | The text to identify the element |
- Source:
(static) elementsXPath(xPath)
Count the number of elements by its XPath.
Parameters:
| Name | Type | Description |
|---|---|---|
xPath |
String | The XPath selector of the desired element. |
- Source:
(static) elementText(text)
Return an element by its text content.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
String | The text to identify the element |
- Source:
(static) elementXPath(xPath)
Return an element by its XPath.
Parameters:
| Name | Type | Description |
|---|---|---|
xPath |
String | The XPath selector of the desired element. |
- Source:
(static) enter(term)
Equivelant to hitting the return key, do so for the required platform.
Parameters:
| Name | Type | Description |
|---|---|---|
term |
String | The enter term to be clicked on iOS devices. |
- Source:
(static) fullScreenshotTest(file, modRoot, opts)
Compares a screenshot of the app in its current state, to a stored
reference image to see how they match. (Leaves the status bar in, for
tests which may require it).
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
file |
String | The path to the reference image | ||||||||||||
modRoot |
String | The path to the root of the project being tested | ||||||||||||
opts |
Object | Arguments
Properties
|
- Source:
(static) getBounds()
Get the dimensions, and coordinates of an element, then return them.
- Source:
(static) getDensity()
Used for finding the screen density of Android devices
- Source:
(static) getDensity()
Used for finding the screen density of Android devices
- Source:
(static) getLog()
Return the latest log capture from Appium.
- Source:
(static) getPlatform()
Return the OS of the current device, using the session.
- Source:
(static) getText()
Get the text from the passed UI elements.
- Source:
(static) logCount(log, searchString, iterations)
Count the amount of times a message appears in a log.
Parameters:
| Name | Type | Description |
|---|---|---|
log |
Array.<String> | The Log to be searched through |
searchString |
String | String that should be present in the log |
iterations |
Int | The amount of times the string should be present |
- Source:
(static) logShouldContain(log, searchStrings)
Check that a message appears in the device log.
Parameters:
| Name | Type | Description |
|---|---|---|
log |
Array.<String> | The Log to be searched through |
searchStrings |
Array.<String> | Strings that should be present in the log |
- Source:
(static) logShouldNotContain(log, searchStrings)
Check that a message doesn't appear in the device log.
Parameters:
| Name | Type | Description |
|---|---|---|
log |
Array.<String> | The Log to be searched through |
searchStrings |
Array.<String> | Strings that shouldn't be present in the log |
- Source:
(static) longpress()
Longpress on the passed element.
- Source:
(static) screenshotTest(file, modRoot, opts)
Take a screenshot on the device, and then compare it to a reference
screenshot and validate the result against a configurable threshold.
Parameters:
| Name | Type | Description | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
file |
String | The path to the reference image | ||||||||||||
modRoot |
String | The path to the root of the project being tested | ||||||||||||
opts |
Object | Optional arguments
Properties
|
- Source:
(static) scrollDown()
Scroll down on the entire height of the passed element.
- Source:
(static) scrollUp()
Scroll up on the entire height of the passed element.
- Source:
(static) swipeLeft()
Swipe left across the entire width of the passed element.
- Source:
(static) swipeRight()
Swipe right across the entire width of the passed element.
- Source:
(static) waitForElementClassName(className, time)
Return an element by its platform specific class name, but allow wait.
Parameters:
| Name | Type | Description |
|---|---|---|
className |
String | The class name of the desired element. |
time |
Int | How long to wait in milliseconds. |
- Source:
(static) waitForElementId(element, time)
Return an element by its ID, but allow wait.
Parameters:
| Name | Type | Description |
|---|---|---|
element |
String | The element ID used to identify the element. |
time |
Int | How long to wait in milliseconds. |
- Source:
(static) waitForElementText(text, time)
Return an element by its text content, but allow wait.
Parameters:
| Name | Type | Description |
|---|---|---|
text |
String | The text to identify the element |
time |
Int | How long to wait in milliseconds |
- Source:
(static) waitForElementXPath(xPath, time)
Return an element by its XPath, but allow wait.
Parameters:
| Name | Type | Description |
|---|---|---|
xPath |
String | The XPath selector of the desired element. |
time |
Int | How long to wait in milliseconds. |
- Source: