Native Apps
List of all native commands:
Commands: | ||
---|---|---|
|
|
|
|
|
|
|
|
|
|
|
|
<click>
Description: command to perform click
Required parameters:
- comment
- locator – locator, where the click will be performed
Optional parameters:
- method – click method (selenium or javascript)
- highlight – boolean, where 'true' means imputed text will be highlighted with a grey body and 3px solid yellow border
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<click comment="Click continue with email"
locator="demoNative.clickContinue"/>
<input>
Description: command to enter a value into the specific field (requires a locator of this field)
Required parameters:
- comment
- locator of the field into which a value will be inputted
- value – non-empty string
Optional parameters:
- highlight – boolean, where 'true' means imputed text will be highlighted with a grey body and 3px solid yellow border
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<input comment="Input comment text"
locator="todoistMini.commentField"
value="Thank you for your attention!!!"/>
<clear>
Description: command to clear the data that has been entered in the specific field (requires a locator of this field)
Required parameters:
- comment
- locator of the field which must be cleared
- highlight - boolean, where 'true' means cleared text will be highlighted with a grey body and 3px solid yellow border
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<clear comment="Clear password"
locator="demoNative.clear"
highlight="true"/>
<image>
Description: command to take a screenshot and compare it with the expected result
There are two types:
- fullScreen (compare a full screenshot)
- part (compare a part screenshot of the specific element by locator)
Required attribute for each type:
- comment
- file - expected image file to compare with screenshot
Optional attribute for each type :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- highlightDifference - parameter that turns on/off highlighting of difference
Required parameters according to the type:
fullScreen
- percentage - the percentage of accuracy of the screenshot comparison, where 100% is the comparison of the entire screenshot (if not indicated it will be considered as 100)
part
- locator - locator of the specific element what to compare
- percentage - the percentage of accuracy of the screenshot comparison, where 100% is the comparison of the entire screenshot (if not indicated it will be considered as 100)
NOTE:
Image comparison is a test feature. On multiple devices, the same window can have different dimensions so the comparison will be failed. Comparison of specific elements works fine due to our tests.
<image comment="Compare full screen with percentage less then 100" file="compare1.png">
<fullScreen percentage="88"/>
</image>
<image comment="Compare full screen" file="compare2.png" highlightDifference="true">
<fullScreen/>
</image>
<image comment="Compare a part of screen with percentage less then 100" file="compare3.png">
<part locator="forms.form" percentage="99"/>
</image>
<refresh>
Description: command to refresh the app if it has such functionality as “swipe down to refresh”
Required parameters:
- comment
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<refresh comment="Refreshing"/>
<navigate>
Description: command to perform navigation
Required parameters:
- comment
- destination – how to perform navigation. Has three types:
- home
- back
- overview
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- NOTE: Overview destination works only on Android devices and cannot be applied to IOS.
<navigate comment="Use navigate back button"
destination="back"/>
<dragAndDrop>
Description: command that allows you to check by clicking on an object and dragging it to another location
Required parameters:
- comment
- fromLocator - locator id of the element which you need to drag and drop
- toLocator - locator id of the place, where you need to drop an element
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<dragAndDrop comment="Drag one task to another area"
fromLocator="bottomBarNative.drag2"
toLocator="bottomBarNative.drop2"/>
<swipe>
Description: command to perform a swipe gesture
Required parameters:
comment
direction – the direction of the swipe
- down
- left
- right
- up
type – a type of swipe: element or page
- element
- page
Optional parameters:
- locator - if 'element' type is chosen, you have to specify locator of the UI element, which has to be swiped
- percent – percent value of the swipe due to the screen dimensions. From 1-100%. The default value is 70 if percent isn`t declared.
- quantity – the number of swipes to be performed in the chain. Integer value. The default value is 1 if quantity isn`t declared
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
<swipe comment="Swipe right"
type="page"
percent="100"
direction="right"/>
<webView>
Description: command to switch to the web view
Required parameters:
- comment
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<webView comment="Switching to the web view"/>
<assert>
Description: command to check whether the data is entered or the element is displayed on the page
There are three types:
- attribute - assert by any UI element's attribute
- equal - equality of two or more values is checked
- notEqual - the inequality of two or more values is checked
Required attribute for each type:
- comment
Optional attribute for each type :
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
- locatorStrategy - to select the type of locator, if necessary writing it directly in the field for locator (locatorId - default value) more in Locators tab
- negative - when 'true' is selected, it is checked that the expected and actual content do not match (default value - false)
Required parameters according to the type:
attribute
- comment
- locator - locator of the UI element
- name - name of attribute
- content - content of the attribute
equal
- comment
- content - values for comparison (The minimum number must be two)
- comment
notEqual
- comment
- content - values for comparison (The minimum number must be two)
- comment
<assert comment="Check that element is present on the page">
<attribute comment="Assert 'password' field"
name="name" - name of attribute for asserting (id,name,outerHTML,etc)
locator="registration.inputPassword"> - locator of the element to assert
<content>password</content> - content of the attribute
</attribute>
</assert>
You can assert several elements within one <assert>:
<assert comment="Test for Assert with sub-commands - notEqual, equal, attribute">
<attribute comment="Assert 'password' field" name="name" locator="registration.inputPassword">
<content>password</content>
</attribute>
<notEqual comment="Assert for check that 3 different contents is not equal">
<content>one</content>
<content>1</content>
<content>ONE</content>
</notEqual>
<equal comment="Assert for check that two contents is equal">
<content>one</content>
<content>one</content>
</equal>
</assert>
<wait>
Description: command that pauses the passage of the scenario to perform a certain function that requires a wait. The scenario continues running in the usual way after this command
Required parameters:
- comment
- time – integer value
Optional parameters:
- unit – seconds or milliseconds. Seconds are used as default if the unit param is not used
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, where the maximum execution time of the command is defined (milliseconds), if the execution time is exceeded, the step will be defined as failed
<wait comment="Wait 3 seconds"
time="3"
unit="seconds"/>
<repeat>
Description: command that allows you to repeat any action used in the commands
Required parameters:
- comment
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
- times - is to set the number of repeating (not used with variations)
- variations - attribute for the variations file (not used with times)
<native comment="Start native scripts">
<repeat comment="Check the ability to run variations in repeat" variations="variations_2.csv">
<click comment="Click on drop down filed" locator="uiElements.dropDownField"/>
<click comment="Click on first options" locator="uiElements.firstOptions"/>
<wait comment="Wait for 1 second" time="1"/>
</repeat>
</native>
Inside the native <repeat> command you can use any native commands.
<include>
Description: the command that allows you to run a ‘scenario inside a scenario’ (often used to bundle different scenarios)
Required parameters:
- comment
- scenario - path to the scenario you need to launch. Since all scenarios must be stored in 'scenarios' folder, in this parameter you need specify path to your scenario from 'scenario' folder
Optional parameters:
- condition - condition according to which this test step will or won't be executed
- threshold - parameter, that set maximum allowed test step execution time
<include comment="Include login steps"
scenario="/includes/login/scenario.xml"/>