Skip to content

Test Commands

TestSweets comes with auto complete to guide you when writing tests. But it helps to know which commands are available and how they work.

TestSweets Commands

Fresh Install

Description: Uninstalls the application and installs a new one.

Use cases:

  • Commonly used as the first command for the first test.

Open Application

Description: Launches the application on the target device

Use cases:

  • Commonly used after a Fresh Install

Close Application

Description: Closes the application on the target device

Use cases:

  • Used as apart of the test case that tests startup logic. Typically you would close the application after a login, then use Open Application and confirm that the starting view is not your login form

Wait For

Structure: Wait For interaction / view

Description: Pauses TestSweets until the interaction/view is avaialble on screen

Use cases:

  • After an action that can navigate, we wait for the next view to be visible. This serves as an expectation check as well to ensure the app is performing as expected

Tap

Structure: Tap touchableInteraction In viewName

Description: Performs a tap on the touchableInteraction in the specific viewName.

Use cases:

  • To tap on buttons, list items, checkboxes, etc

Scroll

Structure: Scroll scrollableInteraction In viewName direction pixels

Description: Performs a scroll on the defined scrollable in the direction, by the pixel amount.

Direction:

  • Left: Simulates your finger moving to the left on a scroll view
  • Right: Simulates your finger moving right on a scroll view
  • Up: Simulates your finger moving up on a scroll view
  • Down: Simulates your finder moving down on a scroll view

Pixels: A number between 0 and 99999999. No Decimals

Use cases:

  • Scrolling a scrollable UI into postition

Input

Structure: Input inputInteraction In viewName “Text to Input”

Description: Enters text in quotations, into the inputInteraction

Use cases:

  • Inputs the text into the specified input spot

Expect text

Structure: Expect text “Text to Expect”

Description: Checks for the text on the current view

Use cases:

  • Validates if “Text to Expect” is on screen

Pause Runner

Structure: Pause Runner secondsToPause

Description: Pauses TestSweets for the specified number of seconds

Use cases:

  • When there is a long running animation you want to wait for before coneinuing the test case
  • When you are trying to wait for something that we can’t track through TestSweets
  • When there are issues with how fast the actions are being perfomed. This commonly happens when you tap on interactions that might not be active yet.

Take Manual Input

Structure: Take Manual Input

Description: Pauses TestSweets and allows the tester to interact with the device. When the manual interaction is complete the tester can continue in TestSweets or Fail the step.

Use cases:

  • When you need to sign in with native Auth
  • When you have to interact with a web view
  • When you need to accept permission dialogs
  • When you need to make native payment interactions
  • When you need to leave the app to do something and come back