Skip to content

Commit 4672603

Browse files
committed
feat: 🎸 add bonus section with maestro
✅ Closes: #229
1 parent 742955d commit 4672603

File tree

3 files changed

+48
-1
lines changed

3 files changed

+48
-1
lines changed

‎challenges/ecosystem/05.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,39 @@ Now you can run `npm run test:watch` to watch your files and run tests automatic
215215

216216
- https://reactnativetesting.io/
217217
- https://github.com/vanGalilea/react-native-testing?tab=readme-ov-file#covered-examples-
218+
219+
220+
### 👽 Bonus
221+
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.

‎hackathon/spacecraft/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"web": "expo start --web",
99
"eject": "expo eject",
1010
"lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .",
11+
"maestro": "maestro test tests/process.yaml",
1112
"test": "jest",
1213
"test:watch": "jest --watch",
1314
"build-storybook": "build-storybook",
@@ -103,4 +104,4 @@
103104
"prettier": "^3.2.5",
104105
"typescript": "~5.3.3"
105106
}
106-
}
107+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
appId: host.exp.Exponent
2+
---
3+
4+
- tapOn: "Email"
5+
- inputText: "[email protected]"
6+
- tapOn: "Password"
7+
- inputText: "123456"
8+
- tapOn: "Login"
9+
- tapOn: "Buy this ship"
10+
- tapOn: "Ok"

0 commit comments

Comments
 (0)