Skip to content

An example of how to mock the network layer in Maestro tests.

Notifications You must be signed in to change notification settings

edgarmiro/maestro-tests-with-mocks

Repository files navigation

Maestro tests with Mocks

Overview

An example of how to mock the network layer in Maestro tests.

You can find more info about the motivation behind this approach in the post The Night’s Watch: Safeguarding store operations

Demo

demo.mp4

Used tools

Get started

  1. Start the emulator. You can run your emulator or create one through Maestro:
maestro start-device --platform=android
  1. Install the maestro build variant:
./gradlew installMaestro
  1. Start Mocks Server:
docker compose -f mocks/docker-compose.yml up
  1. Run Maestro tests:
maestro test maestro/

Build variants

There are three different build variants.

  • debug: To develop the application.
  • release: The final version.
  • maestro: The mocked version.

Notes

For the sake of simplicity, we've omitted, in purpose, some important pieces in a production application like using ViewModels or adding Retrofit or Ktor for the network calls, as well as adding other types of tests.

About

An example of how to mock the network layer in Maestro tests.

Topics

Resources

Stars

Watchers

Forks