import 'cypress-file-upload' ; import * as path from 'path' ; Cypress . Commands . add ( 'login' , ( ) => { const fixturesFolder = Cypress . config ( 'fixturesFolder' ) ; const userFilename = 'test-user.json' ; cy . readFile < { username : string ; password : string ; } > ( path . join ( fixturesFolder as string , userFilename ) ) . then ( ( user ) => { cy . visit ( '/login' ) ; cy . get ( 'input[name=email]' ) . type ( user . username ) ; cy . get ( 'input[name=password]' ) . type ( user . password ) ; cy . get ( 'button[type=submit]' ) . click ( ) ; cy . url ( ) . should ( 'include' , '/app' ) ; } ) ; } ) ;