Repeato
  • Features
  • Pricing
  • Blog
  • About us
  • Get for free
  • Getting started
  • Running test batches
  • Reporting
  • Test exception handling
  • Test workspaces
  • Advanced testing techniques
  • JavaScript API
  • Virtual Test Devices
  • 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
dataobject which you can use to share data between your steps.
data.scannedTextholds the string which was scanned by the last executed “Check for text” step
currentStepIndexstep index of the currently executing step
workspaceDiractual directory of the workspace directory
testDiractual directory of the current test
testRunDiractual 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.testBatchreturns the batch of tests
batchRunner.currentExceptionHandlerIndexreturns the index of current exceptional handler
batchRunner.currentTestIndexreturns the index of current test
batchRunner.batchRunaccess the current test run object. Use log(batchRunner.batchRun) to print all properties of the batchRun run object
batchRunner.isPlayingbatch runner is currently playing or not
batchRunner.runModeget 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.testRunneraccess all the props and methods of testRunner. You can try log(batchRunner.testRunner) to see which properties there are…
TestRunner Properties and Methods
testRunner.currentTestaccess all properties of the current test. Use log(testRunner.currentTest) to print all properties of the test object
testRunner.currentTestRunaccess the current test run object. Use log(testRunner.currentTestRun) to print all properties of the test run object
testRunner.lastStepResultreturns the result of the previously executed step. You can try log(testRunner.lastStepResult) to see which properties there are…
testRunner.currentStepIndexa 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.selectedDeviceDataall 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

  • Contact
  • Documentation
  • Book a demo

Legal

  • Imprint
  • Terms & Conditions
  • Privacy policy
Repeato Reviews