Cypress - tinasamson/QAautomation GitHub Wiki
1. How to start: Instalation and execution
1.1. Instalation:
Install nodeJS and npm:
sudo apt install nodejs
sudo apt install npm
Then install cypress:
npm install cypress --save-dev
After this last command, it is going to create a node_modules folder (don't forget to add it to .gitignore), package-lock.json and package.json
1.2. Start cypress
You can open cypress from your project root:
npx cypress open
if it is your first time opening cypress, it will open a Launchpad and there you can choose between E2E or component testing. After choosing, it is going to create all the files you need to get started.
Otherwise it will also open the Launchpad, were you can choose between E2E or component testing and then you can choose in which browser you are going to run your tests (chrome, chromium, electron)
1.3. E2E testing structure
If you choose E2E testing, it is going to create this structure of files:
cypress
- fixtures
- example.json
- support
- commands.js
- e2e.js
- cypress.config.js
2. Creating first test
Create a new folder "e2e" were you are going to put your tests. Inside create your first test file with .cy.js extention. test example:
describe('example spec', () => {
it('visit cypress example page', () => {
cy.visit('https://example.cypress.io')
})
})
Were describe is the test suite and it are all the test cases, you can create inside describe as many test cases as you need.