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
beforeEach (be
)
beforeEach(() => {
$1
});
$0
context (ctx
)
ctx('$1', () => {
$0
});
it (it
)
it('$1', () => {
$0
});
visit (cyv
)
cy.visit('$1');$0
get (cyget
)
cy.get('$1')${0:;}
find (cyf
)
find('$1')${0:;}
first (cy1
)
first()${0:;}
type (cyt
)
type('$1')${0:;}
contains (cycon
)
contains(${2:'$3', }'$1')${0:;}
clk (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