Skip to content

Commit af9f8b5

Browse files
authored
Build out e2e subdirectories (#9065)
1 parent 1933324 commit af9f8b5

File tree

19 files changed

+322
-288
lines changed

19 files changed

+322
-288
lines changed

.github/workflows/e2e-test.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ jobs:
3030

3131
defaults:
3232
run:
33-
# Run any command steps in the /e2e subdir
34-
working-directory: './e2e'
33+
# Run any command steps in the /e2e/smoke-tests subdir
34+
working-directory: './e2e/smoke-tests'
3535

3636
steps:
3737
- name: Checkout Repo
@@ -53,7 +53,9 @@ jobs:
5353
- name: Poll npm until version to test is available for install
5454
run: |
5555
echo "Polling npm for firebase@${{ github.event.client_payload.versionOrTag }}"
56-
node ../scripts/release/poll-npm-publish.js
56+
node ./scripts/release/poll-npm-publish.js
57+
# run in root
58+
working-directory: '.'
5759
env:
5860
VERSION: ${{ github.event.client_payload.versionOrTag }}
5961
- name: Yarn install

e2e/README.md

Lines changed: 7 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,11 @@
1-
# Firebase JS SDK E2E Tests
1+
# E2E Tests
22

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:
44

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.
68

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.).
810

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.
File renamed without changes.

e2e/smoke-tests/README.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
# Firebase JS SDK E2E Tests
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.
4+
5+
## E2E Tests
6+
7+
### Setup
8+
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/smoke-tests` 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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

e2e/sample-apps/compat.js renamed to e2e/smoke-tests/sample-apps/compat.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ async function authLogout() {
8282
*
8383
* Call a deployed function.
8484
* This cloud function must be deployed in this project first. See
85-
* e2e/README.md for more info.
85+
* e2e/smoke-test/README.md for more info.
8686
*/
8787
async function callFunctions() {
8888
console.log('[FUNCTIONS] start');

e2e/sample-apps/modular.js renamed to e2e/smoke-tests/sample-apps/modular.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ async function authLogout(app) {
121121
*
122122
* Call a deployed function.
123123
* This cloud function must be deployed in this project first. See
124-
* e2e/README.md for more info.
124+
* e2e/smoke-tests/README.md for more info.
125125
*/
126126
async function callFunctions(app) {
127127
console.log('[FUNCTIONS] start');
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)