I'm building end-to-end testing with Detox for my React Native App. I use Firebase as infrastructure, so I tried to run end-to-end testing using Firebase Emulator.

To run end-to-end testing, I need to fill data in the database, which is Firestore on Firebase Emulator, to create a specific context for a test.

However, the problem is that it is not possible to use TestEnvironment of @firebase/rules-unit-testing created in Jest context from the React Native App. TestEnvironment seems like works as a sandbox so that the changes are not generally shared through the Firebase emulator.

I searched for ways to pass TestEnvironment object to the Detox device, but couldn't find it. The only way seems to be to use firebase-admin, but I wonder if this is the best option. It would be nice if there is any way to use TestEnvironment because it provides some useful functions for testing, such as withSecurityRulesDisabled and clearFirestore.

I wonder how others are implementing end-to-end tests for Firebase + React Native.

0

There are 0 best solutions below