Cypress.io - Automation tool
------------------------------------
How to install cypress: https://docs.cypress.io/guides/getting-started/installing-cypress.html
---------------------------------------------------------------------------------------------------------------
1. install Homebrew (if not already installed)
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. install node:
- brew install node
- brew upgrade node
- check node -v
2. install npm:
- npm is the world's largest Software Library (Registry)
- npm is also a software Package Manager and Installer)
- check if npm is already installed by checking npm -v
- if not, type install npm
- check npm -v
3. install cypress:
- npm install cypress --save-dev
4. install supporting libraries:
- npm install --save-dev @testing-library/dom
- npm install --save-dev @testing-library/react
- npm install --save-dev @testing-library/jest-dom
- npm install --save-dev cypress @testing-library/cypress
- npm install -g eslint
- npm install -g node-modules
More info here:
1. https://github.com/cypress-io/cypress
2. https://docs.cypress.io/guides/getting-started/installing-cypress.html
Cypress FAQ:
-----------------
1. how to open cypress(once installed)
./node_modules/.bin/cypress open
or, npx cypress open (prefer)
or, yarn run cypress open
2. how to create a file
- open terminal and create a file e.g. test1.js inside folder: /Users/rakesh/cypress/integration
3. how to run the above file using cypress - test runner
- in the testrunner, under integration , look for above file(test1.js) and click on it
- it will launch in chrome (url: http://localhost:51636/__/#/tests/integration/test1.js) and
shows the result
4. how to run cypress in headless mode:
https://snipcart.com/blog/frontend-testing-cypress
$ cypress run
5. how to run a js code locally in the terminal:
node file.js
Cypress Pros and Cons:
-----------------------------
Pros:
1. its built for front end/automation developers
2. it uses JS language, which front end webpages are also written in
3. it uses Mocha testing framework
Cons:
1. Cypress does not support cross browser testing:
- latest update: https://github.com/cypress-io/cypress/issues/310
2. Cypress supports only JS
Cypress Best practises:
-----------------------------
1. how to select elements properly:
https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements
2. assertions:
https://docs.cypress.io/guides/references/assertions.html#Chai
------------------------------------
How to install cypress: https://docs.cypress.io/guides/getting-started/installing-cypress.html
---------------------------------------------------------------------------------------------------------------
1. install Homebrew (if not already installed)
- ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. install node:
- brew install node
- brew upgrade node
- check node -v
2. install npm:
- npm is the world's largest Software Library (Registry)
- npm is also a software Package Manager and Installer)
- check if npm is already installed by checking npm -v
- if not, type install npm
- check npm -v
3. install cypress:
- npm install cypress --save-dev
4. install supporting libraries:
- npm install --save-dev @testing-library/dom
- npm install --save-dev @testing-library/react
- npm install --save-dev @testing-library/jest-dom
- npm install --save-dev cypress @testing-library/cypress
- npm install -g eslint
- npm install -g node-modules
More info here:
1. https://github.com/cypress-io/cypress
2. https://docs.cypress.io/guides/getting-started/installing-cypress.html
Cypress FAQ:
-----------------
1. how to open cypress(once installed)
./node_modules/.bin/cypress open
or, npx cypress open (prefer)
or, yarn run cypress open
2. how to create a file
- open terminal and create a file e.g. test1.js inside folder: /Users/rakesh/cypress/integration
3. how to run the above file using cypress - test runner
- in the testrunner, under integration , look for above file(test1.js) and click on it
- it will launch in chrome (url: http://localhost:51636/__/#/tests/integration/test1.js) and
shows the result
4. how to run cypress in headless mode:
https://snipcart.com/blog/frontend-testing-cypress
$ cypress run
5. how to run a js code locally in the terminal:
node file.js
Cypress Pros and Cons:
-----------------------------
Pros:
1. its built for front end/automation developers
2. it uses JS language, which front end webpages are also written in
3. it uses Mocha testing framework
Cons:
1. Cypress does not support cross browser testing:
- latest update: https://github.com/cypress-io/cypress/issues/310
2. Cypress supports only JS
Cypress Best practises:
-----------------------------
1. how to select elements properly:
https://docs.cypress.io/guides/references/best-practices.html#Selecting-Elements
2. assertions:
https://docs.cypress.io/guides/references/assertions.html#Chai