Skip to content

Commit f479c7a

Browse files
committed
converting firebase integration test into e2e test
1 parent 1d06cdc commit f479c7a

33 files changed

+1262
-81
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -891,6 +891,7 @@ jobs:
891891
'create-remix-app-express-legacy',
892892
'create-remix-app-express-vite-dev',
893893
'default-browser',
894+
'firebase',
894895
'node-express-esm-loader',
895896
'node-express-esm-preload',
896897
'node-express-esm-without-loader',
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
module.exports = {
2+
root: true,
3+
env: { browser: true, es2020: true },
4+
extends: [
5+
'eslint:recommended',
6+
'plugin:react/recommended',
7+
'plugin:react/jsx-runtime',
8+
'plugin:react-hooks/recommended',
9+
],
10+
ignorePatterns: ['dist', '.eslintrc.cjs'],
11+
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
12+
settings: { react: { version: '18.2' } },
13+
plugins: ['react-refresh'],
14+
rules: {
15+
"react/jsx-first-prop-new-line": [1, "multiline"],
16+
'react/prop-types': 'off',
17+
'react-refresh/only-export-components': [
18+
'warn',
19+
{ allowConstantExport: true },
20+
],
21+
},
22+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# compiled output
2+
/dist
3+
/node_modules
4+
/build
5+
6+
# Logs
7+
logs
8+
*.log
9+
npm-debug.log*
10+
pnpm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
lerna-debug.log*
14+
15+
# OS
16+
.DS_Store
17+
18+
# Tests
19+
/coverage
20+
/.nyc_output
21+
22+
# IDEs and editors
23+
/.idea
24+
.project
25+
.classpath
26+
.c9/
27+
*.launch
28+
.settings/
29+
*.sublime-workspace
30+
31+
# IDE - VSCode
32+
.vscode/*
33+
!.vscode/settings.json
34+
!.vscode/tasks.json
35+
!.vscode/launch.json
36+
!.vscode/extensions.json
37+
38+
# dotenv environment variable files
39+
.env
40+
.env.development.local
41+
.env.test.local
42+
.env.production.local
43+
.env.local
44+
45+
# temp directory
46+
.temp
47+
.tmp
48+
49+
# Runtime data
50+
pids
51+
*.pid
52+
*.seed
53+
*.pid.lock
54+
55+
# Diagnostic reports (https://nodejs.org/api/report.html)
56+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
57+
58+
test-results
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@sentry:registry=http://127.0.0.1:4873
2+
@sentry-internal:registry=http://127.0.0.1:4873
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
## Assuming you already have installed docker desktop or orbstack etc. or any other docker software
2+
3+
### Enabling / authorising firebase emulator through docker
4+
5+
1. Run the docker
6+
7+
```bash
8+
npm run docker
9+
```
10+
11+
2In new tab, enter the docker container by simply running
12+
13+
```bash
14+
docker exec -it sentry-firebase bash
15+
```
16+
17+
3. Now inside docker container run
18+
19+
```bash
20+
firebase login
21+
```
22+
23+
4. You should now see a long link to authenticate with google account, copy the link and open it using your browser
24+
5. Choose the account you want to authenticate with
25+
6. Once you do this you should be able to see something like "Firebase CLI Login Successful"
26+
7. And inside docker container you should see something like "Success! Logged in as <here is the email you have chosen>"
27+
8. Now you can exit docker container
28+
29+
```bash
30+
exit
31+
```
32+
33+
9. Switch back to previous tab, stop the docker container (ctrl+c).
34+
10. You should now be able to run the test, as you have correctly authenticated the firebase emulator
35+
36+
37+
### Preparing data for CLI
38+
39+
1. Please authorize the docker first - see the previous section
40+
2. Once you do that you can generate .env file locally, to do that just run
41+
42+
```bash
43+
npm run createEnvFromConfig
44+
```
45+
46+
3. It will create a new file called ".env" inside folder "docker"
47+
4. View the file. There will be 2 params CONFIG_FIREBASE_TOOLS and CONFIG_UPDATE_NOTIFIER_FIREBASE_TOOLS.
48+
5. Now inside the CLI create a new variable under the name CONFIG_FIREBASE_TOOLS and CONFIG_UPDATE_NOTIFIER_FIREBASE_TOOLS - take values from mentioned .env file
49+
6. File .env is ignored to avoid situation when developer after authorizing firebase with private account will accidently push the tokens to github.
50+
7. But if we want the users to still have some default to be used for authorisation (on their local development) it will be enough to commit this file, we just have to authorize it with some "special" account.
51+
52+
**Some explanation towards environment settings, the environment variable defined directly in "environments" takes precedence over .env file, that means it will be safe to define it in CLI and still keeps the .env file.**
53+
54+
### Scripts - helpers
55+
56+
* createEnvFromConfig - it will use the firebase docker authentication and create .env file which will be used then by docker whenever you run emulator
57+
* createConfigFromEnv - it will use '.env' file in docker folder to create .config for the firebase to be used to authenticate whenever you run docker, Docker by default loads .env file itself
58+
59+
Use these scripts when testing and updating the environment settings on CLI
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const path = require('path');
2+
const dotent = require('dotenv');
3+
dotent.config({ path: path.resolve(__dirname, './docker/.env') });
4+
5+
const createConfigFromEnv = require('./docker/firebase/utils').createConfigFromEnv;
6+
7+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
8+
(async () => {
9+
try {
10+
await createConfigFromEnv();
11+
} catch (e) {
12+
console.error(e);
13+
}
14+
})();
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
const createEnvFromConfig = require('./docker/firebase/utils').createEnvFromConfig;
2+
3+
(async () => {
4+
try {
5+
await createEnvFromConfig();
6+
} catch (e) {
7+
console.error(e);
8+
}
9+
})();
10+

dev-packages/node-integration-tests/suites/tracing/firebase/docker/.gitignore renamed to dev-packages/e2e-tests/test-applications/firebase/docker/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ cache
33
firebase/data
44
firebase/firebase-export-*
55
*-debug.log
6+
.env

dev-packages/node-integration-tests/suites/tracing/firebase/docker/Dockerfile renamed to dev-packages/e2e-tests/test-applications/firebase/docker/Dockerfile

File renamed without changes.

dev-packages/node-integration-tests/suites/tracing/firebase/docker/docker-compose.yml renamed to dev-packages/e2e-tests/test-applications/firebase/docker/docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ services:
1717
FORCE_COLOR: "true"
1818
DATA_DIRECTORY: "data"
1919
CHOKIDAR_USEPOLLING: "true"
20+
CONFIG_FIREBASE_TOOLS: ${CONFIG_FIREBASE_TOOLS}
21+
CONFIG_UPDATE_NOTIFIER_FIREBASE_TOOLS: ${CONFIG_UPDATE_NOTIFIER_FIREBASE_TOOLS}
2022
ports:
2123
- "5500:4001" # ui
2224
- "5501:4401" # hub

0 commit comments

Comments
 (0)