Start Cypress Sample Project Step By Step
- Create an empty folder (Ex: Cypress-automation-framework)
- Open the terminal and add the below command
- npm init
Give the necessary information. It will create the package.json file
- Install the latest version of cypress. Here is the command for version is 8.4.1
- npm install --save-dev cypress@8.4.1
Under node_modules there are libraries and packages downloaded which is needed for cypress
If you want to send the cypress folder to someone then delete the node_modules folder and send the remaining stuff. After that only need to add the following command to install the packages again. npm install
- To open the cypress use the below command
- ./node_modules/.bin/cypress open or npx cypress open
- To open the cypress use the below command
- ./node_modules/.bin/cypress open or npx cypress open
Cypress Project Structure
- cypress.config.js : It enables us to change the default settings
- e2e.js : Plugin details
- command.js : Custom commands are added here
- fixtures : This folder used to store data files
Update Cypress New Version
- open cypress and click on Update Version <number>
- Copy and paste the given command into the terminal -> Run
Add the below line into the test script in order to have cypress commands
/// <reference types= "Cypress" />
Execute Only one Individual Test
Use it.only("Test name"), () => {
}
Add the below line to the e2e.js to ignore the xhr request in the results
Cypress.Server.defaults( {
ignore: xhr => bool {
return true}
}
)
Selectors identifying tools: chrome extensions
- Renorex selocity
Cypress folder Structure
- e2e - Scripts are located here
- reports - Test execution results files
- video - Test execution videos
- fixture - Data files like json
- support - command.js and e2e.js
No comments:
Post a Comment