Skip to content

Commit d168b6f

Browse files
committed
feat(cypress) first pass as cypress snippets
1 parent 0206fc8 commit d168b6f

File tree

7 files changed

+212
-0
lines changed

7 files changed

+212
-0
lines changed

packages/cypress-snippets/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules
2+
.vsix
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.vscode/**
2+
.vscode-test/**
3+
.gitignore
4+
vsc-extension-quickstart.md
5+
about.md
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Change Log
2+
3+
All notable changes to the "cypress-snippets" extension will be documented in this file.
4+
5+
Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.
6+
7+
## [Unreleased]
8+
9+
* Initial release

packages/cypress-snippets/about.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# VS Code Jest Snippets
2+
3+
This extension contains [Cypress](https://cypress.io/) code snippets used by Andrew Smith. Work in Progress.
4+
5+
## Installation
6+
7+
In order to install an extension you need to launch the Command Palette (Ctrl + Shift + P or Cmd + Shift + P) and type Extensions.
8+
There you have either the option to show the already installed snippets or install new ones.
9+
10+
## Supported Languages (file extensions)
11+
12+
* JavaScript (.js)
13+
* TypeScript (.ts)
14+
* JavaScript React (.jsx)
15+
* TypeScript React (.tsx)
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "cypress-snippets",
3+
"displayName": "Cypress Snippets",
4+
"description": "Cypress snippets",
5+
"version": "1.0.0",
6+
"author": "Andrew Smith <andrew@andrew.codes>",
7+
"publisher": "andrew-codes",
8+
"engines": {
9+
"vscode": "^1.19.0"
10+
},
11+
"categories": [
12+
"Snippets"
13+
],
14+
"contributes": {
15+
"snippets": [
16+
{
17+
"language": "javascriptreact",
18+
"path": "./snippets/snippets.json"
19+
},
20+
{
21+
"language": "javascript",
22+
"path": "./snippets/snippets.json"
23+
},
24+
{
25+
"language": "typescript",
26+
"path": "./snippets/snippets.json"
27+
},
28+
{
29+
"language": "typescriptreact",
30+
"path": "./snippets/snippets.json"
31+
}
32+
]
33+
},
34+
"language": "javascript"
35+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
{
2+
"beforeEach": {
3+
"prefix": "be",
4+
"body": [
5+
"beforeEach(() => {",
6+
"\t$1",
7+
"});",
8+
"",
9+
"$0"
10+
],
11+
"description": "Before each"
12+
},
13+
"context": {
14+
"prefix": "ctx",
15+
"body": [
16+
"ctx('$1', () => {",
17+
"\t$0",
18+
"});"
19+
],
20+
"description": "Context"
21+
},
22+
"it": {
23+
"prefix": "it",
24+
"body": [
25+
"it('$1', () => {",
26+
"\t$0",
27+
"});"
28+
],
29+
"description": "It"
30+
},
31+
"visit": {
32+
"prefix": "cyv",
33+
"body": [
34+
"cy.visit('$1');$0"
35+
],
36+
"description": "Cypress visit"
37+
},
38+
"get": {
39+
"prefix": "cyget",
40+
"body": [
41+
"cy.get('$1')${0:;}"
42+
],
43+
"description": "Cypress get"
44+
},
45+
"find": {
46+
"prefix": "cyf",
47+
"body": [
48+
"find('$1')${0:;}"
49+
],
50+
"description": "Cypress find"
51+
},
52+
"first": {
53+
"prefix": "cy1",
54+
"body": [
55+
"first()${0:;}"
56+
],
57+
"description": "Cypress find"
58+
},
59+
"type": {
60+
"prefix": "cyt",
61+
"body": [
62+
"type('$1')${0:;}"
63+
],
64+
"description": "Cypress type"
65+
},
66+
"contains": {
67+
"prefix": "cycon",
68+
"body": [
69+
"contains(${2:'$3', }'$1')${0:;}"
70+
],
71+
"description": "Cypress contains"
72+
},
73+
"clk": {
74+
"prefix": "cyc",
75+
"body": [
76+
"\nclick()${0:;}"
77+
],
78+
"description": "Cypress click"
79+
},
80+
"server": {
81+
"prefix": "cyserver",
82+
"body": [
83+
"cy.server();$0"
84+
],
85+
"description": "Cypress server"
86+
},
87+
"route": {
88+
"prefix": "cyroute",
89+
"body": [
90+
"cy.route(${2:'$3', }$1).as('${4}');$0"
91+
],
92+
"description": "Cypress route"
93+
},
94+
"wait": {
95+
"prefix": "cyw",
96+
"body": [
97+
"cy.wait(${1:'@${2}'});$0"
98+
],
99+
"description": "Cypress wait"
100+
},
101+
"viewport": {
102+
"prefix": "cyvp",
103+
"body": [
104+
"cy.viewport($1, $2);$0"
105+
],
106+
"description": "Cypress viewport"
107+
},
108+
"request": {
109+
"prefix": "cyreq",
110+
"body": [
111+
"cy.request({",
112+
"\tmethod: '$1',",
113+
"\turl: '$2',",
114+
"\theaders: { 'Accept-Language': 'en-us', },",
115+
"});$0"
116+
],
117+
"description": "Cypress request"
118+
},
119+
"add command": {
120+
"prefix": "cyadd",
121+
"body": [
122+
"Cypress.Commands.add('$1', ${3: { previous: '$4' \\} , }$2);$0"
123+
],
124+
"description": "Cypress add custom command"
125+
}
126+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Welcome to your VS Code Extension
2+
3+
## What's in the folder
4+
* This folder contains all of the files necessary for your extension.
5+
* `package.json` - this is the manifest file that defines the location of the snippet file
6+
and specifies the language of the snippets.
7+
* `snippets/snippets.json` - the file containing all snippets.
8+
9+
## Get up and running straight away
10+
* Press `F5` to open a new window with your extension loaded.
11+
* Create a new file with a file name suffix matching your language.
12+
* Verify that your snippets are proposed on intellisense.
13+
14+
## Make changes
15+
* You can relaunch the extension from the debug toolbar after making changes to the files listed above.
16+
* You can also reload (`Ctrl+R` or `Cmd+R` on Mac) the VS Code window with your extension to load your changes.
17+
18+
## Install your extension
19+
* To start using your extension with Visual Studio Code copy it into the `<user home>/.vscode/extensions` folder and restart Code.
20+
* To share your extension with the world, read on https://code.visualstudio.com/docs about publishing an extension.

0 commit comments

Comments
 (0)