This project is a practice exercise for creating End-to-End (E2E) automation tests using Playwright on the Magento Store. It helps in understanding test automation concepts and improving skills in writing Playwright test scripts.
Before running the tests, ensure you have the following installed:
- Python (Recommended version: 3.8+)
- Playwright
- pytest
- Clone the repository:
git clone <repository-url> cd <repository-folder>
- Install dependencies:
pip install playwright pytest
- Install Playwright browsers:
playwright install
The test suite consists of the following modules:
-
Pages: Handles interactions with different sections of the website:
home_page.py: Navigates to login and men’s clothing section.login_page.py: Handles user authentication.men_top_page.py: Selects a product.product_page.py: Chooses size, color, and quantity.shipping_page.py: Fills shipping details.payment_page.py: Validates price and completes checkout.after_checkout_page.py: Confirms purchase and logs out.
-
Configuration:
config.py: Stores test data (user credentials, product quantity, shipping info).
-
Test Execution:
test_user.py: Runs the full E2E test.
To execute the tests, use the following command:
pytest test_user.pyFor headless mode, modify test_user.py:
browser = await p.chromium.launch(headless=True)Playwright provides built-in test reports. You can enable video recording by modifying conftest.py:
context = await browser.new_context(record_video_dir="videos/")This project is designed to practice automation testing using Magento, providing hands-on experience with Playwright. Contributions and improvements are welcome!