Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/brunobzs/playwright-test-automation
Test automation project developed with Playwright and TypeScript
https://github.com/brunobzs/playwright-test-automation
ci-cd playwright playwright-typescript qa qa-automation test-automation testing-tools typescript
Last synced: 4 days ago
JSON representation
Test automation project developed with Playwright and TypeScript
- Host: GitHub
- URL: https://github.com/brunobzs/playwright-test-automation
- Owner: brunobzs
- Created: 2024-12-10T00:11:53.000Z (about 1 month ago)
- Default Branch: master
- Last Pushed: 2025-01-17T19:08:37.000Z (6 days ago)
- Last Synced: 2025-01-17T20:22:48.421Z (6 days ago)
- Topics: ci-cd, playwright, playwright-typescript, qa, qa-automation, test-automation, testing-tools, typescript
- Language: TypeScript
- Homepage:
- Size: 42 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Test Automation with Playwright and TypeScript
This repository contains a test automation project developed with **Playwright** 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.
- Product Details Page.## ๐ Technologies Used
- [Playwright](https://playwright.dev/) - 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. **Install as dependencies**:
Make sure [Node.js](https://nodejs.org/) is installed.
```bash
npm install
```2. **Install the Playwright browsers**:
```bash
npx playwright install
```3. **Environment Configuration**:
- If necessary, edit the `playwright.config.ts` file to adjust the URLs and other project-specific settings.
- Create an `.env` file for environment variables, such as credentials or endpoint URLs.
4. **Run the tests**:
- To open the Playwright interface:
```bash
npx playwright test --ui
```- To run the tests in headless mode:
```bash
npx playwright test
```## ๐ Project Structure
```
โโโ tests # Test files
โโโ page-objects # Interface elements using page objects (POM)
โโโ playwright.config.ts # PLaywright configuration
โโโ package.json # Dependencies of the project
โโโ tsconfig.json # TypeScript Configuration
โโโ README.md # Project Documentation
```## ๐งช How to Add New Tests
1. Create a new file in the `test` folder with the name of the functionality that will be tested (ex: `carrinho.spec.ts`).
2. Use the best practices of Playwright and TypeScript to implement the test.
3. Run the tests to validate that the new file is working correctly.## ๐ค Contribution
Feel free to contribute to this project! To do so:
1. Fork the repository.
2. Create a new branch for your feature or fix:```bash
git checkout -b my-feature
```3. Commit your changes and push them to the repository.
4. Open a Pull Request explaining your changes.
---
If you have any questions or suggestions, feel free to contact me.
# Case Tests
## 1. Authentication (Login and Registration)
### 1.1 Login with valid credentials
**Precondition:** The user is on the login page.
**Steps:**
1. Enter a valid email address.
2. Enter a valid password.
3. Click "Log in".**Expected result:** The user is redirected to the home page/successfully logged in.
### 1.2 Login with invalid credentials
**Precondition:** The user is on the login page.
**Steps:**
1. Enter an invalid email address or an incorrect password.
2. Click "Log in".**Expected result:** An error message such as "Invalid credentials" is displayed.
### 1.3 Registering a new user
**Precondition:** The user is on the registration page.
**Steps:**
1. Fill in the registration fields with valid data (name, email, password).
2. Click "Register".
**Expected Result:** The account is successfully created and the user is redirected to the welcome page.## 2. Product Search
### 2.1 Search by valid keyword
**Precondition:** The user is on the home page.
**Steps:**
1. Enter a product keyword in the search field.
2. Click the "Search" button.
**Expected Result:** A list of relevant products is displayed.
### 2.2 Search with no results
**Precondition:** The user is on the home page.
**Steps:**
1. Enter an invalid or non-existent keyword.
2. Click the "Search" button.**Expected Result:** A "No results found" message is displayed.
## 3. Product Details Page
### 3.1 View product details
**Precondition:** The user is on a list of products.
**Steps:**
1. Click on a specific product.
**Expected Result:** The product details page is loaded with title, price, images, and description.
### 3.2 Add a product to the cart
**Precondition:** The user is on the product details page.
**Steps:**
1. Click "Add to Cart".**Expected result:** The product is successfully added to the cart and a visual feedback is shown (e.g. "Product added" notification).