Skip to content

Commit 3fbfe4a

Browse files
committed
Update cy.sh with what I usually use on my computer
1 parent 0a7a3ff commit 3fbfe4a

File tree

2 files changed

+19
-21
lines changed

2 files changed

+19
-21
lines changed

README.md

+7-12
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,20 @@
22

33
This project offers a single shell script that quickly initializes a [Cypress](https://cypress.io) testing automation project from scratch.
44

5-
> **Note:** This script only works on Unix-based operating systems, such as Linux and macOS.
5+
> **Note:** This script only works on Unix-based operating systems, such as Linux and OSX.
66
77
## Usage
88

99
1. Download the [`cy.sh`](./cy.sh) file and move it to your root directory
10-
2. In the root directory, run `./cy.sh name-of-the-project-you-want-to-create-here` to create a Cypress project from scratch (you might have to first give execution permission to the `cy.sh` file)
11-
- 2.1. Alternatively, you can run `./cy.sh name-of-your-project-here x.x.x` if you want to install a specific version of Cypress, other than its latest version.
12-
3. Close Cypress and access the newly created project (e.g., `cd name-of-your-project-here/`)
13-
4. Open it on your favorite IDE and start writing your Cypress tests! 🙌
10+
11+
2. In the root directory, run `./cy.sh name-of-the-project-you-want-to-create` to create a Cypress project from scratch (you might have first to give execution permission to the `cy.sh` file)
12+
2.1. Alternatively, you can run `./cy.sh name-of-your-project-here x.x.x` (where `x.x.x` is the specific Cypress version you want to install). Otherwise, the latest version is installed.
13+
14+
3. After the script is run, access the newly created directory and run `npx cypress open` to start Cypress for the first time so it will bootstrap itself.
1415

1516
## What does `cy.sh` do?
1617

17-
1. It creates a project directory and accesses it
18-
2. Then, it initialize git and .gitignore
19-
3. After that, it creates a readme file to be defined
20-
4. It then initializes NPM
21-
5. It installs Cypress (if a version is provided, it will install it; otherwise, the latest version is installed)
22-
6. It creates cypress.env and cypress.env.example files defaulting them to empty objects
23-
7. Finally, it opens Cypress for the first time so that it creates its default structure.
18+
To understand exactly what it does, read the comments in the [cy.sh](./cy.sh) file.
2419

2520
## Support this project
2621

cy.sh

+12-9
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,28 @@
1-
# Create project directory and access it
2-
mkdir $1
3-
cd $1
1+
# Create the project directory and access it
2+
mkdir workspaces/$1
3+
cd workspaces/$1
44
# Initialize git and .gitignore
55
git init
66
touch .gitignore
77
echo ".DS_Store\ncypress.env.json\ncypress/downloads/\ncypress/screenshots/\ncypress/videos/\nnode_modules/" > .gitignore
8-
# Create readme file to be defined
8+
# Create a readme file to be defined
99
touch README.md
1010
echo "# $1\n\nTBD." > README.md
11-
# Initialize NPM
11+
# Initialize npm
1212
npm init -y
13-
# Install Cypress (if version is provided, it will install it, otherwise, the latestet version is installed)
13+
# Install Cypress (if the version is provided, it will install it, otherwise, the latestet version is installed)
1414
if [ "$2" ]; then
1515
npm i cypress@"$2" -D
1616
else
1717
npm i cypress -D
1818
fi
19-
# Create cypress.env and cypress.env.example files defaulting them to empty objects
19+
# Create the cypress.env.json and cypress.env.example.json files defaulting them to empty objects
2020
touch cypress.env.json
2121
echo "{}" > cypress.env.json
2222
touch cypress.env.example.json
2323
echo "{}" > cypress.env.example.json
24-
# Open Cypress for the first time so that it creates its default structure
25-
npx cypress open
24+
# Version and commit all the files and directories
25+
git add .
26+
git commit -m "Create cypress project"
27+
# Open the project on VSCode
28+
code .

0 commit comments

Comments
 (0)