Repeato
  • Features
  • Pricing
  • Blog
  • About us
  • Get for free
  • Test recorder
  • Running test batches
  • Reporting
  • Test exception handling
  • Test workspaces
  • Advanced testing techniques
  • JavaScript API
  • Share tests within the team
  • Frequently asked questions
  • Release Notes

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.
currentStepIndexstep index of the currently executing step
testRunDiractual directory of the current test run
testDiractual directory of the current test
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
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.getTestRun()access all properties of the current test run. Use log(testRunner.getTestRun()) 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.deviceConnectordirect access to methods which allow you to send commands to the device. See properties and methods list below…
testRunner.setNextStepIndex(index)set the next step number which should be executed by the test runner (starting from 0)
testRunner.setNextStepId(id)set the next step which should be executed after this one by using it’s ID
testRunner.goBackBy(stepCount)test runner will go back by [stepCount] steps and continue to execute from there
DeviceConnector Properties and Methods
testRunner.deviceConnector.selectedDeviceDataall data related to the currently connected device. Use log(testRunner.deviceConnector.selectedDeviceData) to get a picture of what’s available
testRunner.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.
testRunner.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.
testRunner.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
testRunner.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
testRunner.deviceConnector.sendUp(xPerc, yPerc)send a “lift finger” event to the device.

Repeato

  • Home
  • Pricing
  • Blog
  • FAQ
  • About us

Documentation

  • Getting started
  • Advanced testing techniques
  • JavaScript API

Support

  • Contact
  • Documentation
  • Book a demo

Legal

  • Imprint
  • Terms & Conditions
  • Privacy policy
Repeato Reviews

Download Repeato Studio

Please fill out the form below to begin the download