This project is an automated testing suite for the OpenCart e-commerce demo website. It is built using Playwright with TypeScript and follows the Page Object Model (POM) design pattern to ensure clean, readable, and maintainable test code.
Website under test: https://naveenautomationlabs.com/opencart
The goal of this project is to verify the core functionality of an e-commerce platform through automated testing. The test suite covers:
- User registration and authentication
- Product search
- Shopping cart and wishlist actions
- Contact form submission
- Basic smoke tests for critical features
Both positive and negative test scenarios are included to ensure reliability and correctness of the system.
├── pages/ Page Object Model classes
├── tests/ Test specifications
├── playwright.config.ts
├── package.json
└── README.md
Each page of the application has its own Page Object class, and each test case is written as a separate Playwright test file.
- User registration with valid data
- Login with valid and invalid credentials
- Registration with an existing email
- Search for existing and non-existing products
- Add and remove products from the cart
- Add products to the wishlist
- Submit the contact form
- Homepage loads successfully
- User can log in
- Search functionality works
- Products can be added to the cart
- User can log out
- Playwright (end-to-end testing framework)
- TypeScript
- Node.js
- Page Object Model (POM)
- Node.js (version 16 or higher)
- npm
- Git
- Clone the repository
bash git clone https://github.com/Ajdin111/Software-Testing-Project.git cd Software-Testing-Project
- Install dependencies
bash npm install
- Install Playwright browsers
bash npx playwright install
Run all tests:
bash npx playwright test
Run a specific test:
bash npx playwright test tests/tc_01_registration_valid.spec.ts
Run tests with browser visible:
bash npx playwright test --headed
Run tests in UI mode:
bash npx playwright test --ui
View test report:
bash npx playwright show-report
This project follows the Page Object Model pattern:
- Page classes contain locators and page-specific actions
- Tests focus only on test steps and assertions
- Common logic is reused across tests
This approach improves readability, reduces duplication, and makes tests easier to maintain.
- Registration tests generate unique email addresses automatically
- For login-related tests, a test user must exist
- Credentials can be hardcoded for simplicity or managed via environment variables
- Clear separation between tests and page logic
- Stable and specific selectors
- Independent test cases
- Meaningful assertions
- Reusable and maintainable code
- If a locator matches multiple elements, make it more specific
- If tests time out, increase the timeout or wait for elements properly
- If login tests fail, ensure the test user exists
- Registration tests should always use unique emails