Cypress Folder Structure Explained
Amit K Verma
Helping organizations to streamline the Agile scrum and QA processes | CSM | CSPO | QA | IIT Delhi
This article will help you knowing about the folder structure that comes with cypress e2e installation and setup. We will talk about each in brief.
Here’s the main project folder containing 2 folders and 3 files.
Inside Main project folder:
1. Package.json file: this folder contains the project related information which you setup at the time of installation.
i. Name, version, description,
ii. Git repository information
iii. Scripts commands
iv. License
v. Dev Dependencies: this will hold the modules & its versions installed and saved. Such as cypress, and other plugins
2. Package-lock.json file: This will lock the exact versions of dependencies mentioned in package.json. This file will automatically update on npm install/update any package.
3. Cypress.config.js file:?Used for intelligent code completion. This will hold cypress specific configuration required for running and executing test scripts. Some plugins also require the configurations to be set here. We can add/update the information within this such as env, timeouts, reporter information, folder configurations etc. ?
4. Node_modules folder:?This folder contains all the installed packages using npm install
5. Cypress folder:?Cypress folder is the main folder which further has 4 folders inside created by default by cypress.
领英推荐
Inside Cypress folder:
6. Downloads folder:?This folder is used to store temporary files which got downloaded from web during test script execution
7. E2e folder:?This is the main folder where test files has to be stored. You can create sub-folders as well. Extension of the test files would be *.cy.js (cy.ts for typescript). other types of test file extensions can be set in cypress configuration file.
8. Fixture folder: This folder has json files to save test data. You can create multiple files/fodler inside this.
9. Support folder: Support folder further contains 2 files. Those are commands.js and e2e.js.
Inside Support folder:
10. Commands.js file:?This file is used to create custom commands. Any script which we can frequently use for our tests execution by directly calling using
cy.<custom-command-name>.
11. E2e file:?This file is used for keeping the script which we want to be processed before each test file runs. Global configurations.