Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

The 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 :

#Launching the app
measureStart,CHRGT_homePage
applicationStart,com.google.ios.youtube
waitUntilText,Home
pause,30000
measureStop

#Break on home page
measureStart,PAUSE_homePage
pause,30000
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.

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.

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 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 selector and sets it as the last element found.

searchByTextExact

String selector: the text selector.

Finds the first element with the 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

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

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.

  • No labels