File tree 1 file changed +26
-1
lines changed
1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change 25
25
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
26
26
27
27
import { addMatchImageSnapshotPlugin } from 'cypress-image-snapshot/command'
28
+ import { size } from 'cypress/types/lodash'
28
29
29
- addMatchImageSnapshotPlugin ( )
30
+ addMatchImageSnapshotPlugin ( )
31
+
32
+ Cypress . Commands . add ( 'isVisible' , selector => {
33
+ cy . get ( selector ) . should ( 'be.visible' )
34
+ } )
35
+
36
+ Cypress . Commands . add ( 'isHidden' , selector => {
37
+ cy . get ( selector ) . should ( 'not.exist' )
38
+ } )
39
+
40
+ Cypress . Commands . add ( 'setResolution' , size => {
41
+ if ( Cypress . _ . isArray ( size ) ) {
42
+ cy . viewport ( size [ 0 ] , size [ 1 ] )
43
+ } else {
44
+ cy . viewport ( size )
45
+ }
46
+ } )
47
+
48
+ Cypress . Commands . add ( 'login' , ( username , password ) => {
49
+ cy . get ( '#login_form' ) . should ( 'be.visible' )
50
+ cy . get ( '#user_login' ) . type ( username )
51
+ cy . get ( '#user_password' ) . type ( password )
52
+ cy . get ( '#user_remember_me' ) . click ( )
53
+ cy . contains ( 'Sign in' ) . click ( )
54
+ } )
You can’t perform that action at this time.
0 commit comments