Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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 testreferenceaim 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,LAUNCHYTCHRGT_homePage
applicationStart,com.google.ios.youtube
waitUntilText,Home
pause,500030000
measureStop

#Break on home page
measureStart,PAUSEYTPAUSE_homePage
pause,30000
measureStop

Application

Command

Parameters

Description

applicationStart

String appPackageName bundleId: the application package name.bundle id

Starts an application from its package namebundle id.

applicationKill

String appPackageName bundleId: the application package name.bundle id

Forces an application to stop from its package namebundle id.

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.
int duration: the click duration in milliseconds (1000 ms by default). (optional)

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.
int duration: the click duration in milliseconds (1000 ms by default). (optional)

Performs a long click for the given duration on the element which contains the given text selector.

longClickByXY

int x: the abscissa coordinates.
int y: the ordinate coordinates.
int duration: the click duration in milliseconds (1000 ms by default). (optional)

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. This is case insensitive.

Clicks on the element which contains the given text selector.

clickByTextExact

String selector: the exact text of the element to click on. This is case sensitive.

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.

clickByIdclickByClass

String id selector: the identification of the element to click onclass name.

Clicks on the element which contains with the given identification.

clickByPredicate

String selector: the predicate of the element to click on.

Clicks on the element which matches the given predicateclass 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 millisecondmilliseconds.

Waits the amount of time in millisecond 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

findElementByNamesearchByText

String selector: the text of the element to find. This is case insensitive.selector.

Finds the first element which text contains the given text selector.

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.

findElementByPartialNameselector and sets it as the last element found.

searchByTextExact

String selector: a part of the text of the element to findselector.

Finds the first element which partially contains with the given text selector.

findElementByPredicate

String selector: the predicate of the element to find.

Finds the element which matches the given predicate.

findElementEndingWithexact 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.

findElementBeginningWithsearchElementBeginningWith

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 parent: the name of the parent element.String elementNametextSelector: the name of the child element.

Finds a child element with the name elementName textSelector from a parent.

Probe

Command

Parameters

Description

measureStart

Starts a measure.

measureStop

String stepName: the name of the measure.

Stops the current 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 identification 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 identificationid.

Scroll

Command

Parameters

Description

scrollDown

Scrolls down the screen.

scrollUp

Scrolls up the screen.

swipe

int percStartY: the percentage of the ordinate coordinates of the device screen where the swipe begins.

int percEndY: the percentage of the ordinate coordinates of the device screen where the swipe ends.

int percStartX: the percentage of the abscissa coordinates of the device screen where the swipe begins.

int percEndX: the percentage of the abscissa coordinates of the device screen where the swipe ends.

Swipes the screen.

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.

tapTextenterText

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. This is case insensitive.

long timeout: the timeout in milliseconds (60 000 ms by default). (optional)

Waits until element which contains the text selector is visible on screen. The timeout is equal to 60 seconds.

waitUntilTextExact

String selector: the selector, here the exact text value. This is case sensitive.

long timeout: the timeout in milliseconds (60 000 ms by default). (optional)

Waits until element with exact text selector is visible on screen. The timeout is equal to 60 seconds.

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. The timeout is equal to 60 seconds.

waitUntilGoneTextExact

String selector: the selector, here the exact text value. This is case sensitive.

long timeout: the timeout in milliseconds (60 000 ms by default). (optional)

Waits until element with exact text selector disappears from the screen. The timeout is equal to 60 seconds.

waitUntilPredicate

String selector: the selector, here the predicate.

Waits until element which matches the predicate. The timeout is equal to 60 seconds.