An open API service indexing awesome lists of open source software.

https://github.com/brunobzs/cypress-test-automation

Test automation project developed with Cypress and TypeScript
https://github.com/brunobzs/cypress-test-automation

ci-cd cypress cypress-io page-object-model test-automation testing-framework typescript

Last synced: 3 months ago
JSON representation

Test automation project developed with Cypress and TypeScript

Awesome Lists containing this project

README

        

# Test Automation with Cypress and TypeScript

This repository contains a test automation project developed with **Cypress** and **TypeScript**. The goal of this project is to validate the functionalities of an [e-commerce](https://magento.softwaretestingboard.com/), ensuring that the main user journeys work as expected.

## ๐Ÿ› ๏ธ About the Project

This project was created to perform automated tests on an e-commerce, including:

- Authentication (Login and Registration)
- Product Search
- Shopping Cart

## ๐Ÿš€ Technologies Used

- [Cypress](https://www.cypress.io/) - Framework for end-to-end testing.
- [TypeScript](https://www.typescriptlang.org/) - JavaScript superset for static typing.

## ๐Ÿ“ฆ Installation and Configuration

Follow the steps below to install and configure the project:

1. **Installation of `devDependencies`**:

Make sure [Node.js](https://nodejs.org/) is installed.

To install the `devDependencies`, run:

```bash
npm install

```

2. **Running the Tests**:

- To open the Cypress App, run:

```bash
npm run cy:open

```

- To run the tests in headless model run:

```bash
npm test

```

## ๐Ÿ“ Project Structure

```
โ”œโ”€โ”€ cypress
โ”‚ โ”œโ”€โ”€ e2e # Test files
โ”‚ โ”œโ”€โ”€ support # Cypress support files
โ”œโ”€โ”€ cypress.config.ts # Cypress configuration
โ”œโ”€โ”€ package.json # Project dependencies, npm scripts, etc.
โ”œโ”€โ”€ tsconfig.json # TypeScript configuration
โ””โ”€โ”€ README.md # Project documentation
```

## Available Tese Cases

The below test cases are currently implemented.

```sh
cypress/e2e/auth.cy.ts (3 tests)
โ””โ”€ Authentication
โ”œโ”€ successfully logs in
โ”œโ”€ shows an error message when trying to login with invalid credentials
โ””โ”€ successfully registers a new user

cypress/e2e/search.cy.ts (2 tests)
โ””โ”€ Search
โ”œโ”€ searches for an existing product
โ””โ”€ searches for an non-existing product

cypress/e2e/shoppingCart.cy.ts (1 test)
โ””โ”€ Shopping Cart
โ””โ”€ successfully adds a product to the cart

```

## ๐Ÿงช How to Add New Tests

1. Create a new file in the `cypress/e2e` folder with the name of the functionality that will be tested (e.g., `productDetails.cy.ts`).
2. Use the best practices of Cypress and TypeScript to implement the test.
3. Run the tests to validate that they're working as expected.

## ๐Ÿค Contribution

Feel free to contribute to this project! To do so:

1. Fork the repository
2. Create a new branch:

```bash
git checkout -b branch-name-here

```

3. Commit your changes and push them to your fork

4. Open a Pull Request explaining your changes

---

If you have any questions or suggestions, feel free to contact me.