Repeato
  • Features
  • Pricing
  • Blog
  • Resources
  • Get for free
  • Getting started
  • Running test batches
  • Reporting
  • Test devices
  • Screenshot testing
  • Test exception handling
  • Tags
  • Automate switching devices
  • Advanced Configuration
  • Test workspaces
  • Advanced testing techniques
  • JavaScript API
  • Share tests within the team
  • Continuous Integration Support

JavaScript API

Repeato allows you to execute scripts via so-called “Script steps”.

Here is the full JavaScript API:

General Variables
data object which you can use to share data between your steps.
data.scannedText holds the string which was scanned by the last executed “Check for text” step
currentStepIndex step index of the currently executing step
workspaceDir actual directory of the workspace directory
testDir actual directory of the current test
testRunDir actual directory of the current test run
General Methods
log(message) log message or object
await sleep(x) delay for x milliseconds
await getResponse(host, path, headers) sends a GET request
await sendPost(host, path, body, acceptHeader, headers) sends a POST request

 

BatchRunner Properties and Methods
batchRunner.testBatch returns the batch of tests
batchRunner.currentExceptionHandlerIndex returns the index of current exceptional handler
batchRunner.currentTestIndex returns the index of current test
batchRunner.batchRun access the current test run object. Use log(batchRunner.batchRun) to print all properties of the batchRun run object
batchRunner.isPlaying batch runner is currently playing or not
batchRunner.runMode get run mode
batchRunner.setTestBatchById(batchId) set the test batch for batch runner
batchRunner.setRunMode(mode) set the run mode of batch to all or failed only e.g batchRunner.setRunMode(‘AllTests’) or batchRunner.setRunMode(‘OnlyFailed’)
batchRunner.addOnBatchStart(key, callback) will execute the callback function just before batch start, callback function will recieve batch as parameter e.g batchRunner.addOnBatchStart(‘config’, (batch) => log(batch))
batchRunner.addOnTestFail(key, callback) will execute the callback function on test fail, callback function will recieve stepResult and test as parameter e.g batchRunner.addOnTestFail(‘config’, (test, testRun, stepResult) => log(test))
batchRunner.addOnTestSuccess(key, callback) will execute the callback function on test fail, callback function will recieve test and testRun as parameter e.g batchRunner.addOnTestSuccess(‘config’, (test, testRun) => log(test))
batchRunner.addOnStepCompleted(key, callback) will execute the callback function each time a step was executed, callback function will recieve the step execution result as parameter e.g batchRunner.addOnStepCompleted(‘config’, (stepResult) => log(test))
batchRunner.addOnBatchCompleted(key, callback) will execute the callback function on completion regardless of fail or sucess, callback function will recieve the batchRun object as parameter e.g batchRunner.addOnBatchCompleted(‘config’, (batchRun) => log(batchRun))
batchRunner.removeOnBatchStart(key) will remove the specific callback of addOnBatchStart by key e.g batchRunner.removeOnBatchStart(‘config’)
batchRunner.removeOnTestFail(key) will remove the specific callback of addOnTestFail by key e.g batchRunner.removeOnTestFail(‘config’)
batchRunner.removeOnTestSuccess(key) will remove the specific callback of addOnTestSuccess by key e.g batchRunner.removeOnTestSuccess(‘config’)
batchRunner.removeOnStepCompleted(key) will remove the specific callback of addOnStepCompleted by key e.g batchRunner.addOnStepCompleted(‘config’)
batchRunner.removeOnBatchCompleted(key) will remove the specific callback of addOnBatchCompleted by key e.g batchRunner.removeOnBatchCompleted(‘config’)
batchRunner.testRunner access all the props and methods of testRunner. You can try log(batchRunner.testRunner) to see which properties there are…
TestRunner Properties and Methods
testRunner.currentTest access all properties of the current test. Use log(testRunner.currentTest) to print all properties of the test object
testRunner.currentTestRun access the current test run object. Use log(testRunner.currentTestRun) to print all properties of the test run object
testRunner.lastStepResult returns the result of the previously executed step. You can try log(testRunner.lastStepResult) to see which properties there are…
testRunner.currentStepIndex a index which represents the index of the current step (starting from 0)
testRunner.setNextStepId(id) set the next step which should be executed after this one. E.g. testRunner.setNextStepId(“AH23D6”)
testRunner.setNextStepIndex(index) set the next step number which should be executed by the test runner (starting from 0)
testRunner.goBackBy(stepCount) test runner will go back by [stepCount] steps and continue to execute from there

 

DeviceConnector Properties and Methods
deviceConnector.selectedDeviceData all data related to the currently connected device. Use log(testRunner.deviceConnector.selectedDeviceData) to get a picture of what’s available
deviceConnector.sendString(string) sends a string to the device. The app under test must have an input field to receive the data and the field must be focused.
deviceConnector.sendClick(xPerc, yPerc) send a touch event to the device. Internally sendClick sends a sendDown followed by a sendUp. xPerc and yPerc are relative coordinates between 0 and 1. sendClick(0.5,0.5) will send a click in the very center of the screen.
deviceConnector.sendDown(xPerc, yPerc) send a touch event to the device. Each sendDown needs a sendUp. Usually sendDown is used with sendMove to simulate a drag guesture
deviceConnector.sendMove(xPerc, yPerc) send a “move finger” event to the device. Use sendDown before sendMove to simulate a drag. Finish your drag with sendUp
deviceConnector.sendUp(xPerc, yPerc) send a “lift finger” event to the device.
await deviceConnector.sendAdbCommand(command) send an ADB command via JS. e.g. send an ADB command via JS. e.g. await deviceConnector.sendAdbCommand(command) to get all connected devices to get all connected devices

Repeato

  • Home
  • Pricing
  • Blog
  • FAQ
  • About us

Documentation

  • Getting started
  • Test exception handling
  • Advanced testing techniques
  • JavaScript API
  • Release notes

Support

  • Support & Resources
  • Documentation
  • Book a demo
  • Contact

Legal

  • Imprint
  • Terms & Conditions
  • Privacy policy
Repeato Reviews
[activecampaign form=5 css=0]
Manage Cookie Consent
To provide the best experiences, we use technologies like cookies to store and/or access device information. Consenting to these technologies will allow us to process data such as browsing behavior or unique IDs on this site. Not consenting or withdrawing consent, may adversely affect certain features and functions.
Functional Always active
The technical storage or access is strictly necessary for the legitimate purpose of enabling the use of a specific service explicitly requested by the subscriber or user, or for the sole purpose of carrying out the transmission of a communication over an electronic communications network.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
The technical storage or access that is used exclusively for statistical purposes. The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
The technical storage or access is required to create user profiles to send advertising, or to track the user on a website or across several websites for similar marketing purposes.
Manage options Manage services Manage {vendor_count} vendors Read more about these purposes
View preferences
{title} {title} {title}