@@ -137,28 +137,90 @@ $ dotnet path/to/ReportGenerator.dll -reports:./FirebaseAdmin.Tests/coverage.ope
137137This generates a collection of HTML code coverage reports in a local subdirectory named
138138` reports/ ` .
139139
140- The integration test suite requires a service account JSON key file, and an API key for a Firebase
141- project. Create a new project in the [ Firebase console] ( https://console.firebase.google.com ) if
142- you do not already have one. Use a separate, dedicated project for integration tests since the
143- test suite makes a large number of writes to the Firebase realtime database. Download the service
144- account key file from the "Settings > Service Accounts" page of the project, and copy it to
145- ` FirebaseAdmin/FirebaseAdmin.IntegrationTests/resources/integration_cert.json ` . Also obtain the
146- API key for the same project from "Settings > General", and save it to
147- ` FirebaseAdmin/FirebaseAdmin.IntegrationTests/resources/integration_apikey.txt ` .
148-
149- You'll also need to grant your service account the 'Firebase Authentication Admin' role. This is
150- required to ensure that exported user records contain the password hashes of the user accounts:
151- 1 . Go to [ Google Cloud Platform Console / IAM & admin] ( https://console.cloud.google.com/iam-admin ) .
152- 2 . Find your service account in the list, and click the 'pencil' icon to edit it's permissions.
153- 3 . Click 'ADD ANOTHER ROLE' and choose 'Firebase Authentication Admin'.
154- 4 . Click 'SAVE'.
155-
156- For some of the Firebase Auth integration tests, it is required to enable the Email/Password
157- sign-in method:
158- 1 . Go to the [ Firebase console] ( https://console.firebase.google.com ) .
159- 2 . Click on 'Authentication', and select the 'Sign-in method' tab.
160- 3 . Enable 'Email/Password'.
161- 4 . Enable 'Email link (passwordless sign-in)'.
140+
141+ Integration tests are executed against a real life Firebase project. If you do not already
142+ have one suitable for running the tests against, you can create a new project in the
143+ [ Firebase Console] ( https://console.firebase.google.com ) following the setup guide below.
144+ If you already have a Firebase project, you'll need to obtain credentials to communicate and
145+ authorize access to your Firebase project:
146+
147+
148+ 1 . Service account certificate: This allows access to your Firebase project through a service account
149+ which is required for all integration tests. This can be downloaded as a JSON file from the
150+ ** Settings > Service Accounts** tab of the Firebase console when you click the
151+ ** Generate new private key** button. Copy the file into the repo so it's available at
152+ ` FirebaseAdmin/FirebaseAdmin.IntegrationTests/resources/integration_cert.json ` .
153+ > ** Note:** Service accounts should be carefully managed and their keys should never be stored in publicly accessible source code or repositories.
154+
155+
156+ 2 . Web API key: This allows for Auth sign-in needed for some Authentication and Tenant Management
157+ integration tests. This is displayed in the ** Settings > General** tab of the Firebase console
158+ after enabling Authentication as described in the steps below. Copy it and save to a new text
159+ file at ` FirebaseAdmin/FirebaseAdmin.IntegrationTests/resources/integration_apikey.txt ` .
160+
161+
162+ Set up your Firebase project as follows:
163+
164+
165+ 1 . Enable Authentication:
166+ 1 . Go to the Firebase Console, and select ** Authentication** from the ** Build** menu.
167+ 2 . Click on ** Get Started** .
168+ 3 . Select ** Sign-in method > Add new provider > Email/Password** then enable both the
169+ ** Email/Password** and ** Email link (passwordless sign-in)** options.
170+
171+
172+ 2 . Enable Firestore:
173+ 1 . Go to the Firebase Console, and select ** Firestore Database** from the ** Build** menu.
174+ 2 . Click on the ** Create database** button. You can choose to set up Firestore either in
175+ the production mode or in the test mode.
176+
177+
178+ 3 . Enable Realtime Database:
179+ 1 . Go to the Firebase Console, and select ** Realtime Database** from the ** Build** menu.
180+ 2 . Click on the ** Create Database** button. You can choose to set up the Realtime Database
181+ either in the locked mode or in the test mode.
182+
183+ > ** Note:** Integration tests are not run against the default Realtime Database reference and are
184+ instead run against a database created at ` https://{PROJECT_ID}.firebaseio.com ` .
185+ This second Realtime Database reference is created in the following steps.
186+
187+ 3 . In the ** Data** tab click on the kebab menu (3 dots) and select ** Create Database** .
188+ 4 . Enter your Project ID (Found in the ** General** tab in ** Account Settings** ) as the
189+ ** Realtime Database reference** . Again, you can choose to set up the Realtime Database
190+ either in the locked mode or in the test mode.
191+
192+
193+ 4 . Enable Storage:
194+ 1 . Go to the Firebase Console, and select ** Storage** from the ** Build** menu.
195+ 2 . Click on the ** Get started** button. You can choose to set up Cloud Storage
196+ either in the production mode or in the test mode.
197+
198+
199+ 5 . Enable the IAM API:
200+ 1 . Go to the [ Google Cloud console] ( https://console.cloud.google.com )
201+ and make sure your Firebase project is selected.
202+ 2 . Select ** APIs & Services** from the main menu, and click the
203+ ** ENABLE APIS AND SERVICES** button.
204+ 3 . Search for and enable ** Identity and Access Management (IAM) API** by Google Enterprise API.
205+
206+
207+ 6 . Enable Tenant Management:
208+ 1 . Go to
209+ [ Google Cloud console | Identity Platform] ( https://console.cloud.google.com/customer-identity/ )
210+ and if it is not already enabled, click ** Enable** .
211+ 2 . Then
212+ [ enable multi-tenancy] ( https://cloud.google.com/identity-platform/docs/multi-tenancy-quickstart#enabling_multi-tenancy )
213+ for your project.
214+
215+
216+ 7 . Ensure your service account has the ** Firebase Authentication Admin** role. This is required
217+ to ensure that exported user records contain the password hashes of the user accounts:
218+ 1 . Go to [ Google Cloud console | IAM & admin] ( https://console.cloud.google.com/iam-admin ) .
219+ 2 . Find your service account in the list. If not added click the pencil icon to edit its
220+ permissions.
221+ 3 . Click ** ADD ANOTHER ROLE** and choose ** Firebase Authentication Admin** .
222+ 4 . Click ** SAVE** .
223+
162224
163225Finally, to run the integration test suite:
164226
0 commit comments