|
1 |
| -# Firebase JS SDK E2E Tests |
| 1 | +# E2E Tests |
2 | 2 |
|
3 |
| -This directory contains end-to-end tests for the Firebase JS SDK package as well as minimal quick start sample apps for debugging and development. |
| 3 | +This directory is for Firebase E2E tests that are completely independent of the main SDK workspaces. Packages in here should: |
4 | 4 |
|
5 |
| -## E2E Tests |
| 5 | +* Have a start trigger independent of the main CI PR/push triggers (e.g., manual trigger, repository_dispatch, from an external runner like Kokoro, etc.) |
| 6 | + |
| 7 | + A common use case might be to clone this repo, cd into the chosen directory under e2e, npm install, and run npm scripts. |
6 | 8 |
|
7 |
| -### Setup |
| 9 | +* Have a self-contained set of NPM dependencies. They should not depend on the local version of Firebase in the SDK nor assume inherited availability of any packages in the top level package.json of this repo (typescript, firebase, karma, etc.). |
8 | 10 |
|
9 |
| -Before running the tests, you will need: |
10 |
| - |
11 |
| -- a project config |
12 |
| -- a test user with an email/password login which has read/write privileges for Storage, Realtime Database, and Firestore |
13 |
| -- an App Check debug token |
14 |
| -- to deploy the `callTest` Cloud Function |
15 |
| - |
16 |
| -#### Project Config and Test User |
17 |
| - |
18 |
| -Create a file named `firebase-config.js` in the top level of this `e2e/` directory. The contents of the file should be: |
19 |
| - |
20 |
| -```javascript |
21 |
| -// A config for a project |
22 |
| -export const config = { |
23 |
| - apiKey: ************, |
24 |
| - authDomain: ************, |
25 |
| - databaseURL: ************, |
26 |
| - projectId: ************, |
27 |
| - storageBucket: ************, |
28 |
| - messagingSenderId: ************, |
29 |
| - appId: ************, |
30 |
| - measurementId: ************ |
31 |
| -}; |
32 |
| - * |
33 |
| -// A user account with read/write privileges in that project |
34 |
| -// for storage, database, firestore |
35 |
| -export const testAccount = { |
36 |
| - email: ************, |
37 |
| - password: ************ |
38 |
| -} |
39 |
| -``` |
40 |
| - |
41 |
| -#### App Check Debug Token |
42 |
| - |
43 |
| -Create an App Check debug token in the Firebase Console. Assign it to an environment variable in your shell named `APP_CHECK_DEBUG_TOKEN`. |
44 |
| - |
45 |
| -#### Deploy `callTest` Cloud Function |
46 |
| - |
47 |
| -From the top level of the firebase repo, ensure you have the Firebase CLI (`firebase-tools`) installed (if not, `npm install -g firebase-tools`). |
48 |
| - |
49 |
| -Ensure you are logged in using the CLI (`firebase login`); |
50 |
| - |
51 |
| -Then deploy the function with: |
52 |
| -`firebase deploy --only functions:callTest --project YOUR_PROJECT_ID` |
53 |
| - |
54 |
| -### Running the Tests |
55 |
| - |
56 |
| -To run the tests on the default modular API: |
57 |
| - |
58 |
| -``` |
59 |
| -yarn test:modular |
60 |
| -``` |
61 |
| - |
62 |
| -To run the tests on the compat API: |
63 |
| - |
64 |
| -``` |
65 |
| -yarn test:compat |
66 |
| -``` |
67 |
| - |
68 |
| -## Sample Apps |
69 |
| - |
70 |
| -Two minimal sample apps are provided for quick debugging and development. These apps import and initialize every product in the SDK and call some basic methods. Products can easily be commented out to focus on one or more products you are interested in looking at. |
71 |
| - |
72 |
| -### Setup |
73 |
| - |
74 |
| -The setup is the same as for the E2E tests above. Certain tests can be skipped if you are commenting out that product (e.g, no need to deploy the Cloud Function if you are commenting out the `callFunctions()` line in the sample app, and no need to set the App Check debug token env variable if not using App Check). |
75 |
| - |
76 |
| -### Running Sample Apps |
77 |
| - |
78 |
| -To run the modular sample app (uses current default version of the API): |
79 |
| - |
80 |
| -``` |
81 |
| -yarn start:modular |
82 |
| -``` |
83 |
| - |
84 |
| -Then open `localhost:8080` in a browser. |
85 |
| - |
86 |
| -To run the compat sample app (uses current compat version of the API): |
87 |
| - |
88 |
| -``` |
89 |
| -yarn start:compat |
90 |
| -``` |
91 |
| - |
92 |
| -Then open `localhost:8080` in a browser. |
| 11 | +See the `template/` directory for an example. |
0 commit comments