Skip to content

Latest commit

 

History

History
77 lines (52 loc) · 1.94 KB

File metadata and controls

77 lines (52 loc) · 1.94 KB

Exercise 6: End-to-End Testing with Maestro

📡 What you will learn

  • Set up end-to-end (E2E) tests for your React Native application.
  • Use Maestro to write and run automated E2E tests.

👾 Before we start the exercise

End-to-end (E2E) testing involves testing the complete functionality of an application from the user's perspective, ensuring all components work together as expected.

Maestro is a library for automating user interactions in your React Native app, allowing you to write and run E2E tests.

👨‍🚀 Exercise 6

Setting Up Maestro

  • Install Maestro

Follow the getting started guide to install Maestro on your laptop.

Writing Your First Test

  1. Create a Tests Folder:
  • At the root of your project, create a e2e folder.
  1. Create a Test File:
  • Create a file named process.yaml in the e2e folder.
  1. Add Maestro Script:
  • Add the following script to your package.json:
"scripts": {
  "e2e": "maestro test e2e/process.yaml"
}
  1. Write Your Test:
  • Write a test in the process.yaml file.

You should have something like this:

appId: host.exp.Exponent
---

- launchApp
- tapOn: "Email"
- inputText: "[email protected]"
- tapOn: "Password"
- inputText: "123456"
- tapOn: "Login"
- waitFor: "Welcome"
- tapOn: "Buy this ship"
- tapOn: "Confirm"

Running Your Test

  1. Run Your Test:
  • Run your test by lanching your project on a simulator and executing the following command:
npm run e2e
  1. Check the Results: You should see the test running on your simulator.

👽 Bonus

  • Write more tests for your application.
  • Explore Maestro's documentation to learn more about its capabilities.
  • Write a more complex test that involves testIDs.