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, ensuring that the main user journeys work as expected.
This project was created to perform automated tests on an e-commerce, including:
- Authentication (Login and Registration).
- Product Search.
- Product Details Page.
- Playwright - Framework for end-to-end testing.
- TypeScript - JavaScript superset for static typing.
Follow the steps below to install and configure the project:
- Install as dependencies:
Make sure Node.js is installed.
npm install- Install the Playwright browsers:
npx playwright install- Environment Configuration:
-
If necessary, edit the
playwright.config.tsfile to adjust the URLs and other project-specific settings. -
Create an
.envfile for environment variables, such as credentials or endpoint URLs.
- Run the tests:
- To open the Playwright interface:
npx playwright test --ui- To run the tests in headless mode:
npx playwright test├── 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
- Create a new file in the
testfolder with the name of the functionality that will be tested (ex:carrinho.spec.ts). - Use the best practices of Playwright and TypeScript to implement the test.
- Run the tests to validate that the new file is working correctly.
Feel free to contribute to this project! To do so:
- Fork the repository.
- Create a new branch for your feature or fix:
git checkout -b my-feature-
Commit your changes and push them to the repository.
-
Open a Pull Request explaining your changes.
If you have any questions or suggestions, feel free to contact me.
Precondition: The user is on the login page.
Steps:
- Enter a valid email address.
- Enter a valid password.
- Click "Log in".
Expected result: The user is redirected to the home page/successfully logged in.
Precondition: The user is on the login page.
Steps:
- Enter an invalid email address or an incorrect password.
- Click "Log in".
Expected result: An error message such as "Invalid credentials" is displayed.
Precondition: The user is on the registration page.
Steps:
- Fill in the registration fields with valid data (name, email, password).
- Click "Register".
Expected Result: The account is successfully created and the user is redirected to the welcome page.
Precondition: The user is on the home page.
Steps:
- Enter a product keyword in the search field.
- Click the "Search" button.
Expected Result: A list of relevant products is displayed.
Precondition: The user is on the home page.
Steps:
- Enter an invalid or non-existent keyword.
- Click the "Search" button.
Expected Result: A "No results found" message is displayed.
Precondition: The user is on a list of products.
Steps:
- Click on a specific product.
Expected Result: The product details page is loaded with title, price, images, and description.
Precondition: The user is on the product details page.
Steps:
- 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).