Skip to content

Commit 0e6ba37

Browse files
committed
Readme updates
1 parent cc09147 commit 0e6ba37

File tree

2 files changed

+26
-180
lines changed

2 files changed

+26
-180
lines changed

README.md

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
> Utilities and cli to help testing Firebase projects with Cypress
99
1010
## What?
11-
* simple test environment config generation (including custom auth token) - `cypress-firebase createTestEnvFile`
11+
* Test environment config generation (including custom auth token) with [`createTestEnvFile`](#createTestEnvFile):
12+
13+
`cypress-firebase createTestEnvFile`
1214
* [Custom cypress commands](https://docs.cypress.io/api/cypress-api/custom-commands.html#Syntax) for auth and database interactions:
1315
* [`cy.login`][1]
1416
* [cy.logout][4]
@@ -100,15 +102,24 @@ Tests will run faster locally if you tests against the build version of your app
100102
1. In another terminal window, run a test command such as `npm run test:open`
101103

102104
## Docs
105+
103106
### CLI Commands
104107

108+
#### createTestEnvFile {#createTestEnvFile}
109+
Create test environment file (`cypress.env.json`) which contains custom auth token generated using `firebase-admin` SDK and `serviceAccount.json`.
110+
111+
##### Examples
112+
113+
```bash
114+
cypress-firebase createTestEnvFile
115+
```
116+
105117
### Custom Cypress Commands
106118

107119
#### Table of Contents
108120

109121
- [cy.login][1]
110122
- [Examples][2]
111-
- [currentUser][3]
112123
- [cy.logout][4]
113124
- [Examples][5]
114125
- [cy.callRtdb][6]
@@ -118,39 +129,41 @@ Tests will run faster locally if you tests against the build version of your app
118129
- [Parameters][10]
119130
- [Examples][11]
120131

121-
### cy.login
132+
#### cy.login
122133

123134
Login to Firebase auth using `FIREBASE_AUTH_JWT` environment variable
124135
which is generated using `firebase-admin` authenticated with serviceAccount
125136
during `build:testConfig` phase.
126137

127-
#### Examples
138+
##### Examples
128139

129140
```javascript
130141
cy.login()
131142
```
132143

133-
### cy.logout
144+
#### cy.logout
134145

135146
Log out of Firebase instance
136147

137-
#### Examples
148+
##### Examples
138149

139150
```javascript
140151
cy.logout()
141152
```
142-
### cy.callRtdb
153+
154+
#### cy.callRtdb
143155

144156
Call Real Time Database path with some specified action. Authentication is through `FIREBASE_TOKEN` since firebase-tools is used (instead of firebaseExtra).
145157

146-
### Parameters
158+
##### Parameters
147159

148160
- `action` **[String][11]** The action type to call with (set, push, update, remove)
149161
- `actionPath` **[String][11]** Path within RTDB that action should be applied
150162
- `opts` **[Object][12]** Options
151163
- `opts.args` **[Array][13]** Command line args to be passed
152164

153-
### Examples
165+
##### Examples
166+
154167
*Set data*
155168

156169
```javascript
@@ -177,6 +190,7 @@ cy.callRtdb('get', 'projects/ABC123')
177190
.should('equal', Cypress.env('TEST_UID'))
178191
})
179192
```
193+
180194
*Other Args*
181195

182196
```javascript
@@ -185,21 +199,19 @@ const fakeProject = { some: 'data' }
185199
cy.callRtdb('update', 'project/test-project', fakeProject, opts)
186200
```
187201

188-
### cy.callFirestore
202+
#### cy.callFirestore
189203

190204
Call Firestore instance with some specified action. Authentication is through serviceAccount.json since it is at the base
191205
level. If using delete, auth is through FIREBASE_TOKEN since firebase-tools is used (instead of firebaseExtra).
192206

193-
Type: Cypress.Command
194-
195-
#### Parameters
207+
##### Parameters
196208

197209
- `action` **[String][11]** The action type to call with (set, push, update, remove)
198210
- `actionPath` **[String][11]** Path within RTDB that action should be applied
199211
- `opts` **[Object][12]** Options
200212
- `opts.args` **[Array][13]** Command line args to be passed
201213

202-
#### Examples
214+
##### Examples
203215

204216
*Basic*
205217

docs.md

Lines changed: 0 additions & 166 deletions
This file was deleted.

0 commit comments

Comments
 (0)