Skip to content

Instantly share code, notes, and snippets.

@prescottprue
Created November 24, 2018 03:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save prescottprue/83406f5bfc3cf873ba5313526e666d47 to your computer and use it in GitHub Desktop.
Save prescottprue/83406f5bfc3cf873ba5313526e666d47 to your computer and use it in GitHub Desktop.
Attaching custom commands from cypress-firebase
import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/database';
import 'firebase/firestore';
import { attachCustomCommands } from 'cypress-firebase';
const projectId = Cypress.env('FIREBASE_PROJECT_ID')
const env = Cypress.env('env') || 'stage'
const apiKey = Cypress.env('FIREBASE_API_KEY')
const fbConfig = {
apiKey,
authDomain: `${projectId}.firebaseapp.com`,
databaseURL: `https://${projectId}.firebaseio.com`,
projectId: `${projectId}`,
storageBucket: `${projectId}.appspot.com`
}
// Attach authed instance to window (so it can be picked up within the React App)
window.fbInstance = firebase.initializeApp(fbConfig);
// add cy.login, cy.logout, cy.callRtdb, and cy.callFirestore custom commands
attachCustomCommands({ Cypress, cy, firebase })
@hoangbits
Copy link

@prescottprue Do you have syntax for integration with typescript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment