The separator character for iOS is the semicolon “,”.
To find the package names to write after “applicationStart”: https://mrvirk.com/how-to-find-app-bundle-id-ios.html.
For more information about commands using predicates, which provides a general means of specifying queries in Cocoa, see https://developer.apple.com/library/archive/documentation/Cocoa/Conceptual/Predicates/AdditionalChapters/Introduction.html.
Exemple testreference.testgb :
...
aim of the Greenspector Domain-Specific Language is to help writing automated tests by reducing the time to write tests and to avoid using an IDE. Thus non developer people can write automated tests.
Write the commands in a text file with the extension .testgb.
Example test.testgb :
Code Block | ||
---|---|---|
| ||
#Launching the app measureStart,CHRGT_homePage applicationStart,com.google.ios.youtube waitUntilText,Home pause,5000${PAUSEAFTERLOAD} measureStop #Break on home page measureStart,PAUSEYTPAUSE_homePage pause,30000${PAUSEDURATION} measureStop |
Application
Command | Parameters | Description |
---|---|---|
applicationStart | String |
bundleId: the |
bundle id | Starts an application from its |
bundle id. | |
applicationKill | String |
bundleId: the |
bundle id | Forces an application to stop from its |
bundle id. |
Assert
Command | Parameters | Description |
---|---|---|
assertNotExistsText | String selector: the text that should not exist | Check if the element which text contains the text selector doesn't exist. |
assertNotExistsTextExact | String selector: the exact text that should not exist | Check if the element which text is the exact given selector doesn't exist. |
assertNotExistsClass | String selector: the class name that should not exist | Check if the element with the class selector doesn't exist. |
BrowserManager
So far, the BrowserManager functions only work with some version of Google Chrome.
Command | Parameters | Description |
---|---|---|
launchBrowser | Launches Google Chrome. | |
browserClearCache | Clears the cache of Google Chrome. | |
browserNewTab | Opens a new tab on Google Chrome. | |
browserGoToUrl | String url: the url to browse. | Browses the given url on Google Chrome. |
browserCloseAllTabs | Closes every opened tabs on Google Chrome. | |
waitUntilPageLoaded | long timeout: the timeout for the wait (in milliseconds). | Waits until the current web page is loaded. |
browserCloseAllTabsAndOpen | Closes all browser tabs and open a new tab. (Browser will be closed during process). |
Click
Command | Parameters | Description |
---|---|---|
longClickById | String selector: the id of the element to click on. | Performs a long click for the given duration on the element which contains the given id selector. |
longClickByText | String selector: the text of the element to click on. | Performs a long click for the given duration on the element which contains the given text selector. |
longClickByXY | int x: the abscissa coordinates. | Performs a long click on the element located at the given coordinates. |
click | Clicks on the last element stored (after the Find commands). | |
clickByText | String selector: the text of the element to click on. |
Clicks on the element which contains the given text selector. | |
clickByTextExact | String selector: the exact text of the element to click on. |
Clicks on the element which contains the exact given text selector. | ||
clickByTextEndsWith | String selector: the end of the text of the element to click on. | Clicks on the element which finishes with the given text selector. |
clickByTextBeginsWith | String selector: the beginning of the text of the element to click on. | Clicks on the element which starts with the given text selector. |
clickByClass | String |
selector: the |
class name. | Clicks on the element |
with the given |
clickByPredicate
String selector: the predicate of the element to click on.
class selector. In case of several matching elements, it clicks on the first one found. | ||
clickByXY | int x: the abscissa coordinates. int y: the ordinate coordinates. | Clicks on the element located at the given coordinates. |
clickById | String id: the id of the element to click on. | Clicks on the element which contains the given id. |
Device
Command | Parameters | Description |
---|---|---|
pressHome | Presses the home button. | |
pause | long timeMillis : the time in |
milliseconds. | Waits the amount of time in |
milliseconds passed as argument. |
Dump
Command | Parameters | Description |
---|---|---|
dump | String path: the path where the dump file is saved. | Takes a dump of the current state of the device. |
Find
Command | Parameters | Description |
---|
searchByText | String selector: the text |
selector. | Finds the first element which text contains the given |
findElementByExactName
String selector: the exact text of the element to find. This is case sensitive.
Finds on the element which contains the exact given text selector.
selector and sets it as the last element found. | |
searchByTextExact | String selector: |
the text |
selector. | Finds the first element |
with the |
findElementByPredicate
String selector: the predicate of the element to find.
Finds the element which matches the given predicate.
exact text and sets it as the last element found. | ||
searchElementEndingWith | String selector: the end of the text of the element to find. | Finds the element which finishes with the given text selector. |
searchElementBeginningWith | String selector: the beginning of the text of the element to find. | Finds on the element which starts with the given text selector. |
findChildElement | String |
textSelector: the name of the |
child element. | Finds a child element with the name |
textSelector from a parent. |
Probe
Command | Parameters | Description |
---|---|---|
measureStart |
Starts a measure.
String stepName: the name of the measure. |
Starts a measure which can be identified by the given name. | ||
measureStop | Stops the current measure. |
Screen
Command | Parameters | Description |
---|---|---|
setLandscapeOrientation | Sets device orientation to landscape. | |
setPortraitOrientation | Sets device orientation to portrait. | |
takeScreenshot | String path: the path where the screenshot is saved. | Takes a screenshot of the current screen. |
takeScreenshotByType | String elementId: the |
id of the element to take in screenshot. String path: the path where the screenshot is saved. | Takes a screenshot of the element which contains the given |
id. |
Scroll
Command | Parameters | Description |
---|---|---|
scrollDown | Scrolls down the screen. | |
scrollUp | Scrolls up the screen. | |
swipe | int x1: the abscissa of the device screen where the swipe begins. int y1: the ordinate of the device screen where the swipe begins. int x2: the abscissa of the device screen where the swipe ends. int y2: the ordinate of the device screen where the swipe ends. | Swipes the screen. |
swipeVertical | int percStartY: the percentage of the ordinate coordinates of the device screen where the swipe |
begin. int percEndY: the percentage of the ordinate coordinates of the device screen where the swipe |
end. int percX: the percentage of the abscissa coordinates of the device screen where the swipe is done. | Swipes vertically the screen. The swipe gesture is from screen point A with coordinates (X percX, Y percStartY) to screen point B with coordinates (X percX, Y percEndY). The perc or % is used for the percentage of the screen size. (Example to make a swipe from A (X 65%, Y 15%) to B (X 65%, Y 50%), use: swipeVertical,15,50,65). |
swipeHorizontal | int percStartX: the percentage of the abscissa coordinates of the device screen where the swipe |
begin. |
Int percEndX: the percentage of the abscissa coordinates of the device screen where the swipe |
end. int percY: the percentage of the ordinate coordinates of the device screen where the swipe is done. | Swipes horizontally the screen. The swipe gesture is from screen poinwhicht A with coordinates (X percStartX, Y percY) to screen point B with coordinates (X percEndX, Y percY). The perc or % is used for the percentage of the screen size. (Example to make a swipe from A (X 20%, Y 40%) to B (X 80%, Y 40%), use: swipeHorizontal,20,80,40). |
SetText
Command | Parameters | Description |
---|---|---|
setTextByText | String textToSet: the text to set. String textSelector: the text selector. | Pastes the given text into the element which contains the given text selector. |
setTextByTextExact | String textToSet: the text to set. String textSelector: the text selector. | Pastes the given text into the element which has the given exact text selector. |
setTextById | String textToSet: the text to set. String idSelector: the id selector. | Pastes the given text into the element which contains the given id selector. |
enterText | String text: the text to enter. | Enters the given text in the current selected field clicking on the keyboard keys for each character. |
WaitObject
Command | Parameters | Description |
---|---|---|
waitUntilText | String selector: the selector, here the text to be visible on screen. |
long timeout: the timeout in milliseconds (60 000 ms by default). (optional) | Waits until element which contains the text selector is visible on screen. |
waitUntilTextExact | String selector: the selector, here the exact text value. |
long timeout: the timeout in milliseconds (60 000 ms by default). (optional) | Waits until element with exact text selector is visible on screen |
. | ||
waitUntilTextBeginsWith | String selector: the selector, here the beginning of the text to be visible on screen. long timeout: the timeout in milliseconds (60 000 ms by default). (optional) | Waits until element which starts with the text selector is visible on screen |
. | |
waitUntilGoneTextExact | String selector: the selector, here the exact text value. |
long timeout: the timeout in milliseconds (60 000 ms by default). (optional) | Waits until element with exact text selector disappears from the screen |
waitUntilPredicate
String selector: the selector, here the predicate.
. |