Skip to content

Latest commit

 

History

History

cypress-snippets

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

VS Code Cypress Snippets

This extension contains Cypress code snippets used by Andrew Smith. Work in Progress.

Installation

In order to install an extension you need to launch the Command Palette (Ctrl + Shift + P or Cmd + Shift + P) and type Extensions. There you have either the option to show the already installed snippets or install new ones.

Supported Languages (file extensions)

  • JavaScript (.js)
  • TypeScript (.ts)
  • JavaScript React (.jsx)
  • TypeScript React (.tsx)

Snippets

visit (cyv)

cy.visit('$1');$0

get element(s) (cyge)

cy.get('$1')${0:;}

get elements (alternative) (cyget)

cy.get('$1')${0:;}

get alias (cyga)

cy.get('@$1')${0:;}

get and alias element(s) (cygaa)

cy.get('$1').as('$2')${0:;}

find (cyf)

find('$1')${0:;}

first (cy1)

first()${0:;}

last (cyl)

last()${0:;}

at index (cyeq)

eq($1)${0:;}

type (cyt)

type('$1')${0:;}

contains (cycon)

contains(${2:'$3', }'$1')${0:;}

click (cyc)

click()${0:;}

server (cyserver)

cy.server();$0

route (cyroute)

cy.route(${2:'$3', }$1).as('${4}');$0

wait (cyw)

cy.wait(${1:'@${2}'});$0

viewport (cyvp)

cy.viewport($1, $2);$0

request (cyreq)

cy.request({
	method: '$1',
	url: '$2',
	headers: { 'Accept-Language': 'en-us', },
});$0

add command (cyadd)

Cypress.Commands.add('$1', ${3: { previous: '$4' \} , }$2);$0