From 22f9a718299c70bc92fdc5435985b40f1b7d13b7 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 16:08:31 +0100 Subject: [PATCH 01/14] test(e2e): fix navigation tests --- app/e2e/navigate.test.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/app/e2e/navigate.test.js b/app/e2e/navigate.test.js index ba5a6fcd..b0f8752c 100644 --- a/app/e2e/navigate.test.js +++ b/app/e2e/navigate.test.js @@ -14,22 +14,18 @@ describe('Navigation', () => { // Tattoo artists list tab await element(by.id('tab-tatoueurs')).tap(); - await expect(element(by.label('Tatoueurs'))).toBeVisible(); - - await waitFor(element(by.id('tab-messagerie'))) - .toBeVisible() - .withTimeout(5000); + await expect(element(by.label('Tatoueurs')).atIndex(0)).toBeVisible(); // Messaging tab await element(by.id('tab-messagerie')).tap(); - await expect(element(by.label('Messagerie'))).toBeVisible(); + await expect(element(by.label('Messagerie')).atIndex(0)).toBeVisible(); // Account tab await element(by.id('tab-compte')).tap(); - await expect(element(by.label('Compte'))).toBeVisible(); + await expect(element(by.label('Compte')).atIndex(0)).toBeVisible(); // Home tab await element(by.id('tab-accueil')).tap(); - await expect(element(by.label('Accueil'))).toBeVisible(); + await expect(element(by.label('Accueil')).atIndex(0)).toBeVisible(); }); }); From 801b9259ae2811ae6f213bcc1d5ee792913ffe29 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 16:09:04 +0100 Subject: [PATCH 02/14] test(e2e): always allow location permission --- app/e2e/login.test.js | 4 +++- app/e2e/navigate.test.js | 4 +++- app/e2e/utils.js | 5 +---- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/app/e2e/login.test.js b/app/e2e/login.test.js index 89c36345..8ad10945 100644 --- a/app/e2e/login.test.js +++ b/app/e2e/login.test.js @@ -2,7 +2,9 @@ import { login } from './utils.js'; describe('Login', () => { beforeAll(async () => { - await device.launchApp(); + await device.launchApp({ + permissions: { location: 'always' }, + }); }); beforeEach(async () => { diff --git a/app/e2e/navigate.test.js b/app/e2e/navigate.test.js index b0f8752c..5c6df8f2 100644 --- a/app/e2e/navigate.test.js +++ b/app/e2e/navigate.test.js @@ -2,7 +2,9 @@ import { login } from './utils.js'; describe('Navigation', () => { beforeAll(async () => { - await device.launchApp(); + await device.launchApp({ + permissions: { location: 'always' }, + }); await login(); await login(); }); diff --git a/app/e2e/utils.js b/app/e2e/utils.js index 5e94abd8..ee8b16ac 100644 --- a/app/e2e/utils.js +++ b/app/e2e/utils.js @@ -2,11 +2,8 @@ export const login = async () => { const username = 'admin@linkink.fr'; const password = 'password'; - await element(by.id('username')).clearText(); await element(by.id('username')).typeText(username); await element(by.id('password')).typeText(password); - - const loginButton = element(by.text('Se connecter')); - await loginButton.tap(); + await element(by.text('Se connecter')).tap(); await new Promise((resolve) => setTimeout(resolve, 2000)); }; From 8862b505d458a6ae6019d9421504289eee3e6bf1 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 16:35:17 +0100 Subject: [PATCH 03/14] chore: add e2e tests to github CI --- .github/workflows/ci-app.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index 670774ef..d6cdc2db 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -3,10 +3,10 @@ name: App CI Pipeline on: push: paths: - - "app/**" + - 'app/**' pull_request: paths: - - "app/**" + - 'app/**' jobs: build: @@ -41,3 +41,9 @@ jobs: - name: Run tests run: yarn run test working-directory: ./app + + - name: Run Detox build + run: yarn e2e:build ios.sim.release + + - name: Run Detox tests + run: yarn e2e:test ios.sim.release From a425966ca38b5943bdc665408718a77952d4d569 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 16:49:03 +0100 Subject: [PATCH 04/14] chore: run e2e tests on macos --- .github/workflows/ci-app.yml | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index d6cdc2db..a30fb76e 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -42,8 +42,30 @@ jobs: run: yarn run test working-directory: ./app - - name: Run Detox build - run: yarn e2e:build ios.sim.release +ios-e2e-tests: + needs: build-and-test + timeout-minutes: 60 + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 - - name: Run Detox tests - run: yarn e2e:test ios.sim.release + - name: Install yarn + run: npm install -g yarn + + - name: Install dependencies + run: yarn install + working-directory: ./app + + - name: Install CocoaPods + run: sudo gem install cocoapods + + - name: Install Pods + run: cd app/ios && pod install + + - name: Run Detox build + run: yarn e2e:build ios.sim.release + working-directory: ./app + + - name: Run Detox tests + run: yarn e2e:test ios.sim.release --cleanup + working-directory: ./app From e0d60b5b357ddb73792305f6e0c9481058628026 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 16:50:18 +0100 Subject: [PATCH 05/14] chore: fix line escaping --- .github/workflows/ci-app.yml | 42 ++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index a30fb76e..5ac05aad 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -42,30 +42,30 @@ jobs: run: yarn run test working-directory: ./app -ios-e2e-tests: - needs: build-and-test - timeout-minutes: 60 - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 + ios-e2e-tests: + needs: build-and-test + timeout-minutes: 60 + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 - - name: Install yarn - run: npm install -g yarn + - name: Install yarn + run: npm install -g yarn - - name: Install dependencies - run: yarn install - working-directory: ./app + - name: Install dependencies + run: yarn install + working-directory: ./app - - name: Install CocoaPods - run: sudo gem install cocoapods + - name: Install CocoaPods + run: sudo gem install cocoapods - - name: Install Pods - run: cd app/ios && pod install + - name: Install Pods + run: cd app/ios && pod install - - name: Run Detox build - run: yarn e2e:build ios.sim.release - working-directory: ./app + - name: Run Detox build + run: yarn e2e:build ios.sim.release + working-directory: ./app - - name: Run Detox tests - run: yarn e2e:test ios.sim.release --cleanup - working-directory: ./app + - name: Run Detox tests + run: yarn e2e:test ios.sim.release --cleanup + working-directory: ./app From 7b8a857a6b075207c6d068b82f12b373e5b1826e Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 16:51:54 +0100 Subject: [PATCH 06/14] chore: fix ios-e2e-tests needs --- .github/workflows/ci-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index 5ac05aad..a37eb91c 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -43,7 +43,7 @@ jobs: working-directory: ./app ios-e2e-tests: - needs: build-and-test + needs: build timeout-minutes: 60 runs-on: macos-latest steps: From 57f43b8a8db5f0f8eacbce2d70682eb68da1de67 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 17:20:15 +0100 Subject: [PATCH 07/14] chore: add applesimutils install for CI e2e tests --- .github/workflows/ci-app.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index a37eb91c..bc1ea200 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -62,6 +62,9 @@ jobs: - name: Install Pods run: cd app/ios && pod install + - name: Install applesimutils + run: brew install applesimutils + - name: Run Detox build run: yarn e2e:build ios.sim.release working-directory: ./app From b9dec31d859d27a6382156bd5b3dfa4f05b17380 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 17:33:45 +0100 Subject: [PATCH 08/14] chore: add wix for e2e CI tests --- .github/workflows/ci-app.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index bc1ea200..4a2ea6bc 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -62,8 +62,11 @@ jobs: - name: Install Pods run: cd app/ios && pod install + - name: Tap wix/brew + run: brew tap wix/brew + - name: Install applesimutils - run: brew install applesimutils + run: brew install wix/brew/applesimutils - name: Run Detox build run: yarn e2e:build ios.sim.release From 53c3d8e034ca4c30cb910515295bcc229a9ace63 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 22:25:27 +0100 Subject: [PATCH 09/14] chore: cache e2e installed dependencies --- .github/workflows/ci-app.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index 4a2ea6bc..03d23f84 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -49,6 +49,16 @@ jobs: steps: - uses: actions/checkout@v3 + # Cache Yarn dependencies + - uses: actions/cache@v2 + with: + path: | + .yarn/cache + ./app/node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('./app/**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + - name: Install yarn run: npm install -g yarn @@ -56,18 +66,35 @@ jobs: run: yarn install working-directory: ./app + # Cache CocoaPods + - uses: actions/cache@v2 + with: + path: ./app/ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('./app/ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + - name: Install CocoaPods run: sudo gem install cocoapods - name: Install Pods run: cd app/ios && pod install + # Tap wix/brew for applesimutils - name: Tap wix/brew run: brew tap wix/brew - name: Install applesimutils run: brew install wix/brew/applesimutils + # Cache Detox build artifacts + - uses: actions/cache@v2 + with: + path: ./app/ios/build + key: ${{ runner.os }}-detox-build-${{ hashFiles('./app/**/*.js', './app/**/*.jsx', './app/**/yarn.lock', './app/ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-detox-build- + - name: Run Detox build run: yarn e2e:build ios.sim.release working-directory: ./app From 57b5dd3d85a65df4c6d462b5f7fc9746697a8951 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 22:26:07 +0100 Subject: [PATCH 10/14] test(e2e): add backline to typetext to make in work on github CI --- app/e2e/login.test.js | 5 +++-- app/e2e/navigate.test.js | 1 + app/e2e/utils.js | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/app/e2e/login.test.js b/app/e2e/login.test.js index 8ad10945..43e309ea 100644 --- a/app/e2e/login.test.js +++ b/app/e2e/login.test.js @@ -4,6 +4,7 @@ describe('Login', () => { beforeAll(async () => { await device.launchApp({ permissions: { location: 'always' }, + launchArgs: { detoxPrintBusyIdleResources: 'YES' }, }); }); @@ -12,8 +13,8 @@ describe('Login', () => { }); it('disallow login with bad credentials', async () => { - await element(by.id('username')).typeText('invalid_username'); - await element(by.id('password')).typeText('invalid_password'); + await element(by.id('username')).typeText('invalid_username\n'); + await element(by.id('password')).typeText('invalid_password\n'); await element(by.text('Se connecter')).tap(); await expect(element(by.id('loginError'))).toBeVisible(); }); diff --git a/app/e2e/navigate.test.js b/app/e2e/navigate.test.js index 5c6df8f2..8ec7de6d 100644 --- a/app/e2e/navigate.test.js +++ b/app/e2e/navigate.test.js @@ -4,6 +4,7 @@ describe('Navigation', () => { beforeAll(async () => { await device.launchApp({ permissions: { location: 'always' }, + launchArgs: { detoxPrintBusyIdleResources: 'YES' }, }); await login(); await login(); diff --git a/app/e2e/utils.js b/app/e2e/utils.js index ee8b16ac..4d7f4d17 100644 --- a/app/e2e/utils.js +++ b/app/e2e/utils.js @@ -2,8 +2,8 @@ export const login = async () => { const username = 'admin@linkink.fr'; const password = 'password'; - await element(by.id('username')).typeText(username); - await element(by.id('password')).typeText(password); + await element(by.id('username')).typeText(username + '\n'); + await element(by.id('password')).typeText(password + '\n'); await element(by.text('Se connecter')).tap(); await new Promise((resolve) => setTimeout(resolve, 2000)); }; From 2572e11735c170c6b8dae227421a2d5a5b638984 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Thu, 7 Mar 2024 23:31:32 +0100 Subject: [PATCH 11/14] fix(ui): login and register pages keyboardAvoidingView --- app/src/screens/guest/LoginScreen.tsx | 87 ++++++++------- app/src/screens/guest/RegisterScreen.tsx | 132 ++++++++++++----------- 2 files changed, 116 insertions(+), 103 deletions(-) diff --git a/app/src/screens/guest/LoginScreen.tsx b/app/src/screens/guest/LoginScreen.tsx index e364a112..0d761ab5 100644 --- a/app/src/screens/guest/LoginScreen.tsx +++ b/app/src/screens/guest/LoginScreen.tsx @@ -12,6 +12,7 @@ import { zodResolver } from '@hookform/resolvers/zod'; import { useAuth } from '@/hooks/useAuth'; import { useMutation } from '@apollo/client'; import LOGIN_USER from '@/graphql/mutations/auth/login-mutation'; +import { KeyboardAvoidingView, Platform } from 'react-native'; const loginSchema = z.object({ username: z.string().min(1, { message: 'Champs obligatoire' }), @@ -48,50 +49,56 @@ const LoginScreen: FC = () => { }; return ( - - - - - - {error && error.message && ( - - {error.message} - - )} - - - + + + + + + {error && error.message && ( + + {error.message} + + )} + + + + + + + + Pas encore de compte ?{' '} + Inscrivez-vous + - - - - Pas encore de compte ? Inscrivez-vous - - + ); }; diff --git a/app/src/screens/guest/RegisterScreen.tsx b/app/src/screens/guest/RegisterScreen.tsx index 57ad4513..54a20b12 100644 --- a/app/src/screens/guest/RegisterScreen.tsx +++ b/app/src/screens/guest/RegisterScreen.tsx @@ -13,6 +13,7 @@ import ScrollContainer from '@/components/ui/ScrollContainer'; import { useMutation } from '@apollo/client'; import SIGNUP_USER from '@/graphql/mutations/auth/signup-mutation'; import { useAuth } from '@/hooks/useAuth'; +import { KeyboardAvoidingView, Platform } from 'react-native'; const registerSchema = z .object({ @@ -72,76 +73,81 @@ const RegisterScreen: FC = () => { }; return ( - - - - - - {error && error.message && ( - - {error.message} - - )} - - + + + + + + + {error && error.message && ( + + {error.message} + + )} + + - + - + - + - + - + + + + + + Déjà un compte ? Connectez-vous + - - - Déjà un compte ? Connectez-vous - - - - + + ); }; From af09a9e3f97dd1ba5c7623b9297fb1fc3bf916c4 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Wed, 20 Mar 2024 00:16:25 +0100 Subject: [PATCH 12/14] fix(e2e): clear username login text field --- app/e2e/utils.js | 1 + app/ios/Podfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/e2e/utils.js b/app/e2e/utils.js index 4d7f4d17..41f515b2 100644 --- a/app/e2e/utils.js +++ b/app/e2e/utils.js @@ -2,6 +2,7 @@ export const login = async () => { const username = 'admin@linkink.fr'; const password = 'password'; + await element(by.id('username')).clearText(); await element(by.id('username')).typeText(username + '\n'); await element(by.id('password')).typeText(password + '\n'); await element(by.text('Se connecter')).tap(); diff --git a/app/ios/Podfile.lock b/app/ios/Podfile.lock index 3297f9c6..00fca0a1 100644 --- a/app/ios/Podfile.lock +++ b/app/ios/Podfile.lock @@ -348,7 +348,7 @@ PODS: - React-jsinspector (0.72.6) - React-logger (0.72.6): - glog - - react-native-get-random-values (1.10.0): + - react-native-get-random-values (1.9.0): - React-Core - react-native-safe-area-context (4.6.3): - RCT-Folly @@ -750,7 +750,7 @@ SPEC CHECKSUMS: React-jsiexecutor: 3bf18ff7cb03cd8dfdce08fbbc0d15058c1d71ae React-jsinspector: 194e32c6aab382d88713ad3dd0025c5f5c4ee072 React-logger: cebf22b6cf43434e471dc561e5911b40ac01d289 - react-native-get-random-values: 384787fd76976f5aec9465aff6fa9e9129af1e74 + react-native-get-random-values: dee677497c6a740b71e5612e8dbd83e7539ed5bb react-native-safe-area-context: 36cc67648134e89465663b8172336a19eeda493d react-native-slider: 33b8d190b59d4f67a541061bb91775d53d617d9d React-NativeModulesApple: 02e35e9a51e10c6422f04f5e4076a7c02243fff2 From 5951cdc729c315a5c8bd4d4d899a80efdb9c4138 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Wed, 20 Mar 2024 00:33:44 +0100 Subject: [PATCH 13/14] refactor(e2e): remove from CI --- .github/workflows/ci-app.yml | 61 ------------------------------------ 1 file changed, 61 deletions(-) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index 03d23f84..41eeb922 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -41,64 +41,3 @@ jobs: - name: Run tests run: yarn run test working-directory: ./app - - ios-e2e-tests: - needs: build - timeout-minutes: 60 - runs-on: macos-latest - steps: - - uses: actions/checkout@v3 - - # Cache Yarn dependencies - - uses: actions/cache@v2 - with: - path: | - .yarn/cache - ./app/node_modules - key: ${{ runner.os }}-yarn-${{ hashFiles('./app/**/yarn.lock') }} - restore-keys: | - ${{ runner.os }}-yarn- - - - name: Install yarn - run: npm install -g yarn - - - name: Install dependencies - run: yarn install - working-directory: ./app - - # Cache CocoaPods - - uses: actions/cache@v2 - with: - path: ./app/ios/Pods - key: ${{ runner.os }}-pods-${{ hashFiles('./app/ios/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-pods- - - - name: Install CocoaPods - run: sudo gem install cocoapods - - - name: Install Pods - run: cd app/ios && pod install - - # Tap wix/brew for applesimutils - - name: Tap wix/brew - run: brew tap wix/brew - - - name: Install applesimutils - run: brew install wix/brew/applesimutils - - # Cache Detox build artifacts - - uses: actions/cache@v2 - with: - path: ./app/ios/build - key: ${{ runner.os }}-detox-build-${{ hashFiles('./app/**/*.js', './app/**/*.jsx', './app/**/yarn.lock', './app/ios/Podfile.lock') }} - restore-keys: | - ${{ runner.os }}-detox-build- - - - name: Run Detox build - run: yarn e2e:build ios.sim.release - working-directory: ./app - - - name: Run Detox tests - run: yarn e2e:test ios.sim.release --cleanup - working-directory: ./app From eaaaf3fa3921d454a7b01bdbd9c0164d4f4b7123 Mon Sep 17 00:00:00 2001 From: Gwladys Date: Wed, 20 Mar 2024 00:54:47 +0100 Subject: [PATCH 14/14] Revert "refactor(e2e): remove from CI" This reverts commit 5951cdc729c315a5c8bd4d4d899a80efdb9c4138. --- .github/workflows/ci-app.yml | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/.github/workflows/ci-app.yml b/.github/workflows/ci-app.yml index 41eeb922..03d23f84 100644 --- a/.github/workflows/ci-app.yml +++ b/.github/workflows/ci-app.yml @@ -41,3 +41,64 @@ jobs: - name: Run tests run: yarn run test working-directory: ./app + + ios-e2e-tests: + needs: build + timeout-minutes: 60 + runs-on: macos-latest + steps: + - uses: actions/checkout@v3 + + # Cache Yarn dependencies + - uses: actions/cache@v2 + with: + path: | + .yarn/cache + ./app/node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('./app/**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- + + - name: Install yarn + run: npm install -g yarn + + - name: Install dependencies + run: yarn install + working-directory: ./app + + # Cache CocoaPods + - uses: actions/cache@v2 + with: + path: ./app/ios/Pods + key: ${{ runner.os }}-pods-${{ hashFiles('./app/ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-pods- + + - name: Install CocoaPods + run: sudo gem install cocoapods + + - name: Install Pods + run: cd app/ios && pod install + + # Tap wix/brew for applesimutils + - name: Tap wix/brew + run: brew tap wix/brew + + - name: Install applesimutils + run: brew install wix/brew/applesimutils + + # Cache Detox build artifacts + - uses: actions/cache@v2 + with: + path: ./app/ios/build + key: ${{ runner.os }}-detox-build-${{ hashFiles('./app/**/*.js', './app/**/*.jsx', './app/**/yarn.lock', './app/ios/Podfile.lock') }} + restore-keys: | + ${{ runner.os }}-detox-build- + + - name: Run Detox build + run: yarn e2e:build ios.sim.release + working-directory: ./app + + - name: Run Detox tests + run: yarn e2e:test ios.sim.release --cleanup + working-directory: ./app