Skip to content

Commit 136e046

Browse files
authored
Merge pull request #256 from flexbox/feature/maestro
feature/maestro
2 parents 926e43b + 9f43cb9 commit 136e046

File tree

6 files changed

+47
-29
lines changed

6 files changed

+47
-29
lines changed

challenges/ecosystem/06.md

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,32 +9,33 @@
99

1010
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.
1111

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

1414
- Check the [Maestro documentation](https://maestro.mobile.dev/getting-started/installing-maestro).
1515

1616
## 👨‍🚀 Exercise 6
1717

1818
### Setting Up Maestro
1919

20-
1. **Install Maestro**:
21-
Follow the [getting started guide](https://maestro.mobile.dev/getting-started/installing-maestro) to install Maestro on your laptop.
20+
- [ ] Install Maestro
21+
22+
Follow the [getting started guide](https://maestro.mobile.dev/getting-started/installing-maestro) to install Maestro on your laptop.
2223

2324
### Writing Your First Test
2425

2526
1. **Create a Tests Folder**:
26-
- [ ] At the root of your project, create a `tests` folder.
27+
- [ ] At the root of your project, create a `e2e` folder.
2728

2829
2. **Create a Test File**:
29-
- [ ] Create a file named `process.yaml` in the `tests` folder.
30+
- [ ] Create a file named `process.yaml` in the `e2e` folder.
3031

3132
3. **Add Maestro Script**:
3233
- [ ] Add the following script to your `package.json`:
3334

34-
```json
35-
"scripts": {
36-
"maestro": "maestro test tests/process.yaml"
37-
}
35+
```json
36+
"scripts": {
37+
"e2e": "maestro test e2e/process.yaml"
38+
}
3839
```
3940

4041
4. **Write Your Test**:
@@ -62,9 +63,9 @@ appId: host.exp.Exponent
6263
1. **Run Your Test**:
6364
- [ ] Run your test by lanching your project on a simulator and executing the following command:
6465
65-
```console
66-
npm run maestro
67-
```
66+
```console
67+
npm run maestro
68+
```
6869

6970
2. **Check the Results**:
7071
You should see the test running on your simulator.
@@ -73,4 +74,4 @@ appId: host.exp.Exponent
7374

7475
- [ ] Write more tests for your application.
7576
- [ ] Explore Maestro's documentation to learn more about its capabilities.
76-
- [ ] Write a more complex test that involves testIDs.
77+
- [ ] Write a more complex test that involves `testID`s.

hackathon/spacecraft/e2e/process.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
appId: weshipit.today.spacecraft
2+
---
3+
4+
- tapOn: "Email Email"
5+
- inputText: "yoda@mozmail.com"
6+
- tapOn: "Password Password "
7+
- inputText: "123456"
8+
- tapOn: "Login"
9+
- tapOn: "Not Now"
10+
- tapOn: "CR90 corvette"
11+
- swipe:
12+
start: "67%,87%"
13+
end: "69%,51%"
14+
duration: 661

hackathon/spacecraft/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
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",
1211
"test": "jest",
1312
"test:watch": "jest --watch",
1413
"build-storybook": "build-storybook",
1514
"storybook-generate": "sb-rn-get-stories",
1615
"storybook-watch": "sb-rn-watcher",
1716
"storybook": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start",
1817
"storybook:ios": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start --ios",
19-
"storybook:android": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start --android"
18+
"storybook:android": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start --android",
19+
"e2e": "maestro test e2e/process.yaml"
2020
},
2121
"jest": {
2222
"preset": "jest-expo",

hackathon/spacecraft/src/screens/PlusScreen.tsx

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,19 @@ import { View } from "react-native";
33
import { List, Text } from "react-native-paper";
44

55
import { ScreenContainer } from "~/components/ScreenContainer";
6+
import { useAuthentication } from "~/context/Authentication";
67
import { Routes } from "~/navigation/Routes";
78

8-
interface Props {}
9-
10-
export const PlusScreen = ({ navigation }: Props) => {
9+
export const PlusScreen = ({ navigation }: any) => {
1110
const navigateToDoYouLikeScreen = () => {
1211
navigation.navigate(Routes.DO_YOU_LIKE_SCREEN);
1312
};
1413

14+
const { setUser } = useAuthentication();
15+
const handleLogout = () => {
16+
setUser(false);
17+
};
18+
1519
return (
1620
<ScreenContainer title={"Plus"}>
1721
<View style={{ flex: 1 }}>
@@ -25,6 +29,16 @@ export const PlusScreen = ({ navigation }: Props) => {
2529
onPress={navigateToDoYouLikeScreen}
2630
title="Do you like Spacecraft?"
2731
/>
32+
<List.Item
33+
left={(props) => (
34+
<List.Icon
35+
{...props}
36+
icon="logout"
37+
/>
38+
)}
39+
onPress={handleLogout}
40+
title="Logout"
41+
/>
2842
</View>
2943
<View
3044
style={{

hackathon/spacecraft/src/screens/StarshipDetailsScreen.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ export const StarshipDetailsScreen = ({
5555
const scale = useSharedValue(1);
5656

5757
const theme = useTheme();
58-
console.log("🚀 ~ theme:", theme);
5958

6059
return (
6160
<View style={{ backgroundColor: theme.colors.background }}>

hackathon/spacecraft/tests/process.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)