From 68fe2ab1b0dfe79450983479ac0aecb37ca66db3 Mon Sep 17 00:00:00 2001 From: David Leuliette Date: Tue, 17 Sep 2024 16:43:57 +0200 Subject: [PATCH 1/4] add logout --- .../spacecraft/src/screens/PlusScreen.tsx | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/hackathon/spacecraft/src/screens/PlusScreen.tsx b/hackathon/spacecraft/src/screens/PlusScreen.tsx index 15fe3170..ac6d8754 100644 --- a/hackathon/spacecraft/src/screens/PlusScreen.tsx +++ b/hackathon/spacecraft/src/screens/PlusScreen.tsx @@ -3,15 +3,19 @@ import { View } from "react-native"; import { List, Text } from "react-native-paper"; import { ScreenContainer } from "~/components/ScreenContainer"; +import { useAuthentication } from "~/context/Authentication"; import { Routes } from "~/navigation/Routes"; -interface Props {} - -export const PlusScreen = ({ navigation }: Props) => { +export const PlusScreen = ({ navigation }: any) => { const navigateToDoYouLikeScreen = () => { navigation.navigate(Routes.DO_YOU_LIKE_SCREEN); }; + const { setUser } = useAuthentication(); + const handleLogout = () => { + setUser(false); + }; + return ( @@ -25,6 +29,16 @@ export const PlusScreen = ({ navigation }: Props) => { onPress={navigateToDoYouLikeScreen} title="Do you like Spacecraft?" /> + ( + + )} + onPress={handleLogout} + title="Logout" + /> Date: Tue, 17 Sep 2024 16:44:21 +0200 Subject: [PATCH 2/4] migrate to e2e --- hackathon/spacecraft/e2e/process.yaml | 14 ++++++++++++++ hackathon/spacecraft/package.json | 4 ++-- hackathon/spacecraft/tests/process.yaml | 10 ---------- 3 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 hackathon/spacecraft/e2e/process.yaml delete mode 100644 hackathon/spacecraft/tests/process.yaml diff --git a/hackathon/spacecraft/e2e/process.yaml b/hackathon/spacecraft/e2e/process.yaml new file mode 100644 index 00000000..07c61985 --- /dev/null +++ b/hackathon/spacecraft/e2e/process.yaml @@ -0,0 +1,14 @@ +appId: weshipit.today.spacecraft +--- + +- tapOn: "Email Email" +- inputText: "yoda@mozmail.com" +- tapOn: "Password Password " +- inputText: "123456" +- tapOn: "Login" +- tapOn: "Not Now" +- tapOn: "CR90 corvette" +- swipe: + start: "67%,87%" + end: "69%,51%" + duration: 661 diff --git a/hackathon/spacecraft/package.json b/hackathon/spacecraft/package.json index 43aa1d01..99d59cd9 100644 --- a/hackathon/spacecraft/package.json +++ b/hackathon/spacecraft/package.json @@ -8,7 +8,6 @@ "web": "expo start --web", "eject": "expo eject", "lint": "eslint --ignore-path .gitignore --ext .js,.ts,.tsx .", - "maestro": "maestro test tests/process.yaml", "test": "jest", "test:watch": "jest --watch", "build-storybook": "build-storybook", @@ -16,7 +15,8 @@ "storybook-watch": "sb-rn-watcher", "storybook": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start", "storybook:ios": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start --ios", - "storybook:android": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start --android" + "storybook:android": "sb-rn-get-stories && STORYBOOK_ENABLED='true' expo start --android", + "e2e": "maestro test e2e/process.yaml" }, "jest": { "preset": "jest-expo", diff --git a/hackathon/spacecraft/tests/process.yaml b/hackathon/spacecraft/tests/process.yaml deleted file mode 100644 index f1ac0d9c..00000000 --- a/hackathon/spacecraft/tests/process.yaml +++ /dev/null @@ -1,10 +0,0 @@ -appId: host.exp.Exponent ---- - -- tapOn: "Email" -- inputText: "test@gmail.com" -- tapOn: "Password" -- inputText: "123456" -- tapOn: "Login" -- tapOn: "Buy this ship" -- tapOn: "Ok" \ No newline at end of file From 2eebfc2f75e513e2443f6467bafe073b83e67e92 Mon Sep 17 00:00:00 2001 From: David Leuliette Date: Tue, 17 Sep 2024 17:17:16 +0200 Subject: [PATCH 3/4] upate --- challenges/ecosystem/06.md | 9 +++++---- .../spacecraft/src/screens/StarshipDetailsScreen.tsx | 1 - 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/challenges/ecosystem/06.md b/challenges/ecosystem/06.md index 8acfa067..c18be7d6 100644 --- a/challenges/ecosystem/06.md +++ b/challenges/ecosystem/06.md @@ -9,7 +9,7 @@ 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 powerful library for automating user interactions in your React Native app, allowing you to write and run E2E tests. +Maestro is a library for automating user interactions in your React Native app, allowing you to write and run E2E tests. - Check the [Maestro documentation](https://maestro.mobile.dev/getting-started/installing-maestro). @@ -17,8 +17,9 @@ Maestro is a powerful library for automating user interactions in your React Nat ### Setting Up Maestro -1. **Install Maestro**: - Follow the [getting started guide](https://maestro.mobile.dev/getting-started/installing-maestro) to install Maestro on your laptop. +- [ ] Install Maestro + +Follow the [getting started guide](https://maestro.mobile.dev/getting-started/installing-maestro) to install Maestro on your laptop. ### Writing Your First Test @@ -73,4 +74,4 @@ appId: host.exp.Exponent - [ ] Write more tests for your application. - [ ] Explore Maestro's documentation to learn more about its capabilities. -- [ ] Write a more complex test that involves testIDs. +- [ ] Write a more complex test that involves `testID`s. diff --git a/hackathon/spacecraft/src/screens/StarshipDetailsScreen.tsx b/hackathon/spacecraft/src/screens/StarshipDetailsScreen.tsx index 602abd30..097273aa 100644 --- a/hackathon/spacecraft/src/screens/StarshipDetailsScreen.tsx +++ b/hackathon/spacecraft/src/screens/StarshipDetailsScreen.tsx @@ -55,7 +55,6 @@ export const StarshipDetailsScreen = ({ const scale = useSharedValue(1); const theme = useTheme(); - console.log("🚀 ~ theme:", theme); return ( From 9f43cb9e6ea8d4148fdc39d6e226040dfe1f03b3 Mon Sep 17 00:00:00 2001 From: David Leuliette Date: Tue, 17 Sep 2024 17:18:27 +0200 Subject: [PATCH 4/4] upate --- challenges/ecosystem/06.md | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/challenges/ecosystem/06.md b/challenges/ecosystem/06.md index c18be7d6..908f1d6b 100644 --- a/challenges/ecosystem/06.md +++ b/challenges/ecosystem/06.md @@ -24,18 +24,18 @@ Follow the [getting started guide](https://maestro.mobile.dev/getting-started/in ### Writing Your First Test 1. **Create a Tests Folder**: - - [ ] At the root of your project, create a `tests` folder. + - [ ] At the root of your project, create a `e2e` folder. 2. **Create a Test File**: - - [ ] Create a file named `process.yaml` in the `tests` folder. + - [ ] Create a file named `process.yaml` in the `e2e` folder. 3. **Add Maestro Script**: - [ ] Add the following script to your `package.json`: - ```json - "scripts": { - "maestro": "maestro test tests/process.yaml" - } +```json +"scripts": { + "e2e": "maestro test e2e/process.yaml" +} ``` 4. **Write Your Test**: @@ -63,9 +63,9 @@ appId: host.exp.Exponent 1. **Run Your Test**: - [ ] Run your test by lanching your project on a simulator and executing the following command: - ```console - npm run maestro - ``` +```console +npm run maestro +``` 2. **Check the Results**: You should see the test running on your simulator.