🚀 Welcome to my Cypress repository where you can find several test examples that I've implemented, and the automation testing strategy I've used on them.
- Access the following URL: https://github.com/betinac/cypress-automation-samples
- Click on the
Codebutton - Choose one of the options to clone the repository (i.e clone with SSH)
- Click on the
Copy url to clipboardicon - In a terminal, go to the folder where you keep your projects and type:
git clone [URL copied in the previous step]and hitENTER - Go to the cloned repository:
cd cypress-automation-samples
-
Before starting, please make sure you have the following tools installed in your system:
- Node.js. You can download it from this link.
- In the terminal and within the repository folder
cd cypress-automation-samples, run the following commandnpm install. - This command will download all the dependencies listed in the
package.jsonfile and it will create anode_modulesdirectory.
-
Just for running the login tests under the
/e2e/loginfolder, you'll need an account on the sandbox app I'm using for testing: POCO Mega Store. Create your new account first and then save your credentials. -
On the project root path, create a new file called
cypress.env.jsonand replace the variables with the credentials from the step above.
For example:
//cypress.env.json file's content
{
"username": "my-user",
"password": "s3creT-p@ssw0rd"
}
- In the terminal run
npx cypress openornpm exec cypress open. These commands will open the Cypress Test Runner (interactive mode). - Another option is to use the scripts from the
package.jsonfile:npm run cy:open- Opens the Cypress Test Runner appnpm run cy:run- Run the tests in the command line
- To manually run the tests and also generate a Summary Report:
npx cypress open --browser chrome --reporter mochawesome
- Clear the local files that will be generated and then run the following commands*:
npm run delete:reportsnpm run cy:runnpm run report:copyAssetsnpm run report:mergenpm run report:generate- Open the
public/index.htmlfile that is stored under the root folder. Mochawesome report
(*) Check the package.json file for more details on what each script is doing. I've left them separated on purpose.
-
UI Testing: check scenarios that I've automated via the UI.
-
API Testing: check scenarios that I've automated via the API.
-
Filter tests: filter and run tests by a substring or Tags.
-
Pull requests template: check a suggested structure for a Pull Request (PR).
-
Continuous Integration for E2E Cypress tests & GitHub Actions: use the continuous integration and continuous delivery (CI/CD) platform to automate several actions.
-
Prettier & VSCode & Cypress: configure JavaScript code auto-formatting with Prettier to work per project.
