You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat(createTestEnvFile): added styled logger with figures for more clear console messages
* feat(deps): added `firebase-tools` as a `peerDependency` (it is needed in order for `callRtdb` to work)
* feat(deps): added `firebase-tools-extra` as a `dependency` instead of having it part of install instructions
* fix(docs): updated docs to cover simplified install
* feat(deps): dev deps updated including `eslint`
Copy file name to clipboardExpand all lines: README.md
+11-4Lines changed: 11 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,7 +33,8 @@ If you are intereted in what drove the need for this checkout [the why section](
33
33
34
34
### Setup
35
35
36
-
1. Install deps `npm i cypress-firebase firebase-tools-extra --save-dev`
36
+
1. Make sure you have `firebase-tools` installed (globally or within project). It is used to call to database when using `cy.callRtdb` and `cy.callFirestore`.
37
+
1. Install using `npm i cypress-firebase --save-dev`
37
38
1. Add the following to the `scripts` section of your `package.json`:
38
39
39
40
```json
@@ -70,25 +71,31 @@ If you are intereted in what drove the need for this checkout [the why section](
70
71
attachCustomCommands({ Cypress, cy, firebase })
71
72
```
72
73
1. Setup plugin adding following your plugins file (`cypress/plugins/index.js`):
// `on` is used to hook into various events Cypress emits
79
80
// `config` is the resolved Cypress config
80
-
81
+
81
82
// Return extended config (with settings from .firebaserc)
82
83
return cypressFirebasePlugin(config)
83
84
}
84
85
```
85
-
86
+
86
87
The plugin sets `baseUrl` and loads config from `.firebaserc`
87
88
88
89
### Running
90
+
89
91
1. Start your local dev server (usually `npm start`) - for faster alternative checkout the [test built version section](#test-built-version)
90
92
1. Open cypress test running by running `npm run test:open` in another terminal window
91
93
94
+
### CI
95
+
96
+
1. Run `firebase login:ci` to generate a CI token for `firebase-tools` (this will give your `cy.callRtdb` and `cy.callFirestore` commands admin access to the DB)
97
+
1. Set `FIREBASE_TOKEN` within CI environment variables
98
+
92
99
#### Test Built Version
93
100
94
101
Tests will run faster locally if you tests against the build version of your app instead of your dev version (with hot module reloading and other dev tools). You can do that by:
chalk.yellow(`${fig('⚠')} Warning: project_id "${serviceAccount.project_id}" does not match env var: "${envVarBasedOnCIEnv('FIREBASE_PROJECT_ID')}"`)
76
-
);
74
+
logger.warn(`project_id "${chalk.cyan(serviceAccount.project_id)}" does not match env var: "${chalk.cyan(envVarBasedOnCIEnv('FIREBASE_PROJECT_ID'))}"`);
77
75
/* eslint-enable no-console */
78
76
}
79
77
@@ -94,8 +92,8 @@ function createTestEnvFile() {
94
92
.createCustomToken(uid,{isTesting: true})
95
93
.then((customToken)=>{
96
94
/* eslint-disable no-console */
97
-
console.log(
98
-
`${chalk.green(fig('✔'))}Custom token generated successfully, writing to ${chalk.cyan(constants.DEFAULT_TEST_ENV_FILE_NAME)}`
95
+
logger.success(
96
+
`Custom token generated successfully, writing to ${chalk.cyan(constants.DEFAULT_TEST_ENV_FILE_NAME)}`
99
97
);
100
98
/* eslint-enable no-console */
101
99
// Remove firebase app
@@ -119,7 +117,7 @@ function createTestEnvFile() {
0 commit comments