/
Mobile app automated testing

Mobile app automated testing

Introduction

The Totara mobile app uses Expo as a framework for running React Native and largely follows the existing Expo documentation for the core of the app. As of version 2.1.0, for end-to-end (E2E) testing we use the Expo-recommended approach using Maestro.

Testing with Maestro

Maestro lets you run test suites in the cloud so you don't need to worry about setting up your own environment for testing.

You can write your tests using Maestro's commands in yaml. You can refer to the simple.yml test file in the repository for an example of what a basic E2E test will look like.

Once your tests have been written, there is some extra config required to get them running in EAS. Please refer to the Expo documentation on this subject for an in-depth and step-by-step guide on how to get a version built in EAS that the tests can be executed against. You can find the current EAS config used for this in the eas.json file under the build-and-maestro-e2e key.

An important thing to note about E2E testing is how to handle network requests. A mock server is required to catch the outgoing requests and send back some mock data. The service current in place for this is wiremock.

Testing with something else

While Maestro is the recommended system used for testing Expo applications, it's not the only tool you can use. Prior to version 2.1.0, Detox was the tool of choice for testing and is still widely used.

Detox is not cloud-based, so you'll need to have your own environment configured for iOS and Android to be able to use it for testing. If your environment is configured for iOS and Android development then you should be able to run Detox, though EAS may not be able to run the tests for you. Please refer to the Detox's documentation for detailed instructions on getting set up. EAS does have some documentation on using Detox, though it is deprecated as of July 2024.

Related content

Environment set-up
Read with this
Getting started with the Totara Mobile app
Getting started with the Totara Mobile app
More like this