Skip to content

Commit 0bb86dd

Browse files
committed
feat: 🎸 add ecosystem-06 with maesto
1 parent 4672603 commit 0bb86dd

File tree

2 files changed

+76
-32
lines changed

2 files changed

+76
-32
lines changed

challenges/ecosystem/05.md

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -219,35 +219,4 @@ Now you can run `npm run test:watch` to watch your files and run tests automatic
219219

220220
### 👽 Bonus
221221

222-
We can automate the user interaction in the app with [`Maestro`](https://maestro.mobile.dev/) —a library that allows you to write end-to-end tests for your React Native app.
223-
224-
- [ ] Follow the [getting started guide](https://maestro.mobile.dev/getting-started/installing-maestro) to install `Maestro` on your laptop.
225-
226-
- [ ] Check the [Maestro React Native Exemple](https://maestro.mobile.dev/platform-support/react-native) to see how to write your first test.
227-
228-
- [ ] At the root of your project, create a `tests` folder
229-
- [ ] Create a test file named `process.yaml` in the `tests` folder
230-
- [ ] Add the following script to your `package.json`
231-
232-
```json
233-
"maestro": "maestro test tests/process.yaml"
234-
```
235-
236-
- [ ] Write `process.yaml` test and run `npm run maestro` to see the test running.
237-
238-
You should have something like this:
239-
240-
```yaml
241-
appId: host.exp.Exponent
242-
---
243-
244-
- tapOn: "Email"
245-
- inputText: "[email protected]"
246-
- tapOn: "Password"
247-
- inputText: "123456"
248-
- tapOn: "Login"
249-
- tapOn: "Buy this ship"
250-
- tapOn: "Ok"
251-
```
252-
253-
You can write more complex tests with `Maestro` and automate the user interaction in your app.
222+
- [ ] Check the [React Native Testing Library Cookbook](https://callstack.github.io/react-native-testing-library/cookbook/index) and add a new test to your component.

challenges/ecosystem/06.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Exercise 6: End-to-End Testing with Maestro
2+
3+
## 📡 What you will learn
4+
5+
- Set up end-to-end (E2E) tests for your React Native application.
6+
- Use Maestro to write and run automated E2E tests.
7+
8+
## 👾 Before we start the exercise
9+
10+
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.
11+
12+
Maestro is a powerful library for automating user interactions in your React Native app, allowing you to write and run E2E tests.
13+
14+
- Check the [Maestro documentation](https://maestro.mobile.dev/getting-started/installing-maestro).
15+
16+
## 👨‍🚀 Exercise 6
17+
18+
### Setting Up Maestro
19+
20+
1. **Install Maestro**:
21+
Follow the [getting started guide](https://maestro.mobile.dev/getting-started/installing-maestro) to install Maestro on your laptop.
22+
23+
### Writing Your First Test
24+
25+
1. **Create a Tests Folder**:
26+
- [ ] At the root of your project, create a `tests` folder.
27+
28+
2. **Create a Test File**:
29+
- [ ] Create a file named `process.yaml` in the `tests` folder.
30+
31+
3. **Add Maestro Script**:
32+
- [ ] Add the following script to your `package.json`:
33+
34+
```json
35+
"scripts": {
36+
"maestro": "maestro test tests/process.yaml"
37+
}
38+
39+
4. **Write Your Test**:
40+
- [ ] Write a test in the `process.yaml` file.
41+
42+
You should have something like this:
43+
44+
```yaml
45+
appId: host.exp.Exponent
46+
---
47+
48+
- launchApp
49+
- tapOn: "Email"
50+
- inputText: "[email protected]"
51+
- tapOn: "Password"
52+
- inputText: "123456"
53+
- tapOn: "Login"
54+
- waitFor: "Welcome"
55+
- tapOn: "Buy this ship"
56+
- tapOn: "Confirm"
57+
```
58+
59+
### Running Your Test
60+
61+
1. **Run Your Test**:
62+
- [ ] Run your test by lanching your project on a simulator and executing the following command:
63+
64+
```console
65+
npm run maestro
66+
```
67+
68+
2. **Check the Results**:
69+
You should see the test running on your simulator.
70+
71+
### 👽 Bonus
72+
73+
- [ ] Write more tests for your application.
74+
- [ ] Explore Maestro's documentation to learn more about its capabilities.
75+
- [ ] Write a more complex test that involves testIDs.

0 commit comments

Comments
 (0)