1+ // ***********************************************
2+ // This example commands.js shows you how to
3+ // create various custom commands and overwrite
4+ // existing commands.
5+ //
6+ // For more comprehensive examples of custom
7+ // commands please read more here:
8+ // https://on.cypress.io/custom-commands
9+ // ***********************************************
10+ //
11+ //
12+ // -- This is a parent command --
13+ // Cypress.Commands.add("login", (email, password) => { ... })
14+ //
15+ //
16+ // -- This is a child command --
17+ // Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
18+ //
19+ //
20+ // -- This is a dual command --
21+ // Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
22+ //
23+ //
24+ // -- This is will overwrite an existing command --
25+ // Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
26+ import firebase from 'firebase/app'
27+ import 'firebase/auth'
28+ import 'firebase/database'
29+ import 'firebase/firestore'
30+ import { attachCustomCommands } from 'cypress-firebase'
31+
32+ const fbConfig = {
33+ apiKey : "AIzaSyD5l09unKGP3D3cFY_mr_BQPgcTjhkU2jc" ,
34+ authDomain : "ecatch-kyst.firebaseapp.com" ,
35+ databaseURL : "https://ecatch-kyst.firebaseio.com" ,
36+ projectId : "ecatch-kyst" ,
37+ storageBucket : "ecatch-kyst.appspot.com"
38+ }
39+
40+ window . fbInstance = firebase . initializeApp ( fbConfig )
41+
42+ attachCustomCommands ( { Cypress, cy, firebase} )
43+ Cypress . Commands . add ( 'login' , ( ) => {
44+ return firebase
45+ . auth ( )
46+ . signInWithEmailAndPassword ( 'p@p.io' , '123456' )
47+ } )
48+
49+ Cypress . Commands . add ( 'logout' , ( ) => {
50+ return firebase
51+ . auth ( )
52+ . signOut ( )
53+ } )
0 commit comments