@@ -248,47 +248,90 @@ to ensure that exported user records contain the password hashes of the user acc
2482489 . Setup your project for Firebase Data Connect integration tests:
249249 1 . Set up Data Connect in the Firebase Console:
250250 1 . Go to the Firebase Console, and select ** Data Connect** from the ** Build** menu.
251- 2 . Click on ** Get Started** . You can skip any Gemini generation of your schema
252- or operations - you must create these manually.
251+ 2 . Click on ** Get Started** . Skip any steps related to Gemini generation.
253252 3 . Select ** Create a new Cloud SQL instance** .
254- 4 . Set your ** Location** to ` us-west2 `
255- 5 . Set your ** Cloud SQL instance ID** to ` my-instance `
256- 6 . Set your ** Database name** to ` my-database `
257- 7 . Set your ** Service ID** to ` my-service `
258- 8 . Click ** Submit** . This operation may take up to 10 minutes to complete - you may
259- continue setting up while this completes.
260- 2 . Set up your Data Connect schema locally:
261- 1 . Run the following commands from the command line to setup your data connect app:
253+ 4 . When prompted, you must use the following specific configuration values, as the integration tests are hard-coded to expect them:
254+ * Set your ** Location** to ` us-west2 `
255+ * Set your ** Cloud SQL instance ID** to ` my-instance `
256+ * Set your ** Database name** to ` my-database `
257+ * Set your ** Service ID** to ` my-service `
258+ 5 . Click ** Submit** .
259+ > ** Note:** This operation may take up to 10 minutes to complete - you may
260+ continue with Step 2 of setup while this completes.
261+ 2 . Set up your Data Connect schema and operations locally:
262+ 1 . First, create a separate directory for the test configuration and initialize Data Connect.
263+ (Make sure to replace ` <PROJECT_ID> ` with your actual Firebase Project ID).
262264 ``` bash
263265 $ mkdir fdc-integration-test
264266 $ cd fdc-integration-test
265267 $ firebase init dataconnect --project < PROJECT_ID>
266268 ```
267- 2. The setup script should say ** " Your project already has existing services." **
268- Select the service you just created, ` us-west2/my-service` .
269- 3. When asked to use an app template, select `no`.
270- 4. The set up should complete, and should have created a file ` fdc-integration-test/dataconnect/schema/schema.gql` .
271- 5. Paste the following lines into ` schema.gql` :
272- ` ` ` gql
273- type User @table(key: [" id" ]) {
274- id: String!
275- name: String!
276- address: String!
277- }
278-
279- type Email @table {
280- id: String!
281- subject: String!
282- date: Date!
283- text: String!
284- from: User!
285- }
269+ 2. During the interactive init process, follow these prompts:
270+ * When it says " Your project already has existing services," select the service you just created: ` us-west2/my-service` .
271+ * When asked to use an app template, select `no`.
272+ 3. The set up should be complete.
273+ 4. Create your schema and operations:
274+ ` ` ` bash
275+ $ touch fdc-integration-test/dataconnect/example/operations.gql
286276 ` ` `
287- 6. Run the following commands from ` fdc-integration-test/` to deploy your schema:
277+ * Paste the following lines into ` fdc-integration-test/dataconnect/example/operations.gql` :
278+ ` ` ` gql
279+ query ListUsers @auth(level: PUBLIC, insecureReason: " test" ) { users { id, name, address } }
280+
281+ query ListEmails @auth(level: NO_ACCESS) { emails { id subject text date from { name } } }
282+
283+ query GetUser($id : User_Key! ) @auth(level: NO_ACCESS) { user(key: $id ) { id name } }
284+
285+ query ListUsersImpersonation @auth(level: USER) {
286+ users(where: { id: { eq_expr: " auth.uid" } }) { id, name, address }
287+ }
288+
289+ mutation upsertFredUser @auth(level: NO_ACCESS) {
290+ user_upsert(data: { id: " fred_id" , address: " 32 Elm St." , name: " Fred" })
291+ }
292+
293+ mutation updateFredrickUserImpersonation @auth(level: USER) {
294+ user_update(
295+ key: { id_expr: " auth.uid" },
296+ data: { address: " 64 Elm St. North" , name: " Fredrick" }
297+ )
298+ }
299+
300+ mutation upsertJeffUser @auth(level: NO_ACCESS) {
301+ user_upsert(data: { id: " jeff_id" , address: " 99 Oak St." , name: " Jeff" })
302+ }
303+
304+ mutation upsertFredEmail @auth(level: NO_ACCESS) {
305+ email_upsert(data: {
306+ id: " email_id" ,
307+ subject: " free bitcoin inside" ,
308+ date: " 1999-12-31" ,
309+ text: " get pranked! LOL!" ,
310+ fromId: " fred_id" ,
311+ })
312+ }
313+ ` ` `
314+ * Paste the following lines into ` fdc-integration-test/dataconnect/schema/schema.gql` :
315+ ` ` ` gql
316+ type User @table(key: [" id" ]) {
317+ id: String!
318+ name: String!
319+ address: String!
320+ }
321+
322+ type Email @table {
323+ id: String!
324+ subject: String!
325+ date: Date!
326+ text: String!
327+ from: User!
328+ }
329+ ` ` `
330+ 5. Finally, deploy your new schema and operations from within the ` fdc-integration-test` directory:
288331 ` ` ` bash
289- $ firebase deploy --only dataconnect
332+ $ firebase deploy --only dataconnect --project < PROJECT_ID >
290333 ` ` `
291- 7 . When asked if you' d like to execute changes, select `Execute all`.
334+ 6 . When asked if you' d like to execute changes, select `Execute all`.
292335
293336Finally, to run the integration test suite:
294337
0 commit comments