diff --git a/.github/workflows/scripts/start-firestore-emulator.sh b/.github/workflows/scripts/start-firestore-emulator.sh index bb487fb015..a6b8959e6a 100644 --- a/.github/workflows/scripts/start-firestore-emulator.sh +++ b/.github/workflows/scripts/start-firestore-emulator.sh @@ -4,11 +4,15 @@ if ! [ -x "$(command -v firebase)" ]; then exit 1 fi -firebase emulators:start --only firestore & +EMU_START_COMMAND="firebase emulators:start --only firestore" -until curl --output /dev/null --silent --fail http://localhost:8080; do - echo "Waiting for Firestore emulator to come online..." - sleep 2 -done - -echo "Firestore emulator is online!" \ No newline at end of file +if [ "$1" == "--no-daemon" ]; then + $EMU_START_COMMAND +else + $EMU_START_COMMAND & + until curl --output /dev/null --silent --fail http://localhost:8080; do + echo "Waiting for Firestore emulator to come online..." + sleep 2 + done + echo "Firestore emulator is online!" +fi \ No newline at end of file diff --git a/.github/workflows/tests_e2e.yml b/.github/workflows/tests_e2e.yml index 7042a05965..b0d2c2134f 100644 --- a/.github/workflows/tests_e2e.yml +++ b/.github/workflows/tests_e2e.yml @@ -51,7 +51,7 @@ jobs: command: npm i -g firebase-tools - name: Start Firestore Emulator - run: cd ./.github/workflows/scripts && sh ./start-firestore-emulator.sh + run: yarn tests:emulator:start-ci - name: Get yarn cache directory path id: yarn-cache-dir-path @@ -225,7 +225,7 @@ jobs: command: npm i -g firebase-tools - name: Start Firestore Emulator - run: cd ./.github/workflows/scripts && sh ./start-firestore-emulator.sh + run: yarn tests:emulator:start-ci - name: Get Xcode version id: xcode-version diff --git a/package.json b/package.json index 65ca9f20d8..4d928ed553 100644 --- a/package.json +++ b/package.json @@ -21,7 +21,8 @@ "tests:packager:chrome": "cd tests && node_modules/.bin/react-native start --reset-cache", "tests:packager:jet": "cd tests && cross-env REACT_DEBUGGER=\"echo nope\" node_modules/.bin/react-native start --no-interactive", "tests:packager:jet-reset-cache": "cd tests && cross-env REACT_DEBUGGER=\"echo nope\" node_modules/.bin/react-native start --reset-cache --no-interactive", - "tests:emulator:start": "./tests/node_modules/.bin/firebase emulators:start --only firestore", + "tests:emulator:start": "cd ./.github/workflows/scripts && sh ./start-firestore-emulator.sh --no-daemon", + "tests:emulator:start-ci": "cd ./.github/workflows/scripts && sh ./start-firestore-emulator.sh", "tests:android:build": "cd tests && ./node_modules/.bin/detox build --configuration android.emu.debug", "tests:android:build-release": "cd tests && ./node_modules/.bin/detox build --configuration android.emu.release", "tests:android:test": "cd tests && ./node_modules/.bin/detox test --configuration android.emu.debug", diff --git a/packages/app/e2e/config.e2e.js b/packages/app/e2e/config.e2e.js index 19cf02348b..fd62a9f708 100644 --- a/packages/app/e2e/config.e2e.js +++ b/packages/app/e2e/config.e2e.js @@ -40,12 +40,11 @@ describe('config', () => { }); // NOTE: "preferencesClearAll" clears Firestore settings. Set DB as emulator again. - // FIXME if we use the emulator, then we never throw errors because firestore rules are permissive, that causes test failure - // after(async () => { - // await firebase - // .firestore() - // .settings({ host: 'localhost:8080', ssl: false, persistence: true }); - // }); + after(async () => { + await firebase + .firestore() + .settings({ host: 'localhost:8080', ssl: false, persistence: true }); + }); it('should set bool values', async () => { const prefsBefore = await NativeModules.RNFBAppModule.preferencesGetAll();