This repository contains the complete automated testing solution for the DemoBlaze e-commerce website as part of the Graduate Assignment: Automated Testing with Selenium.
This project implements comprehensive automated test cases for the DemoBlaze website using Selenium WebDriver, Python, and the Page Object Model design pattern. The solution covers login functionality, shopping cart operations, product details verification, checkout process, and UI element validation.
.
├── selenium/ # Selenium project source code
│ ├── pages/ # Page Object Model classes
│ │ ├── base_page.py
│ │ ├── home_page.py
│ │ ├── login_page.py
│ │ ├── product_page.py
│ │ ├── cart_page.py
│ │ └── checkout_page.py
│ ├── tests/ # Test cases
│ │ ├── test_login.py
│ │ ├── test_cart.py
│ │ ├── test_product_details.py
│ │ ├── test_checkout.py
│ │ └── test_ui_elements.py
│ ├── utils/ # Utilities and helpers
│ │ ├── config.py
│ │ ├── driver_factory.py
│ │ └── helpers.py
│ ├── pytest.ini # Pytest configuration
│ └── run_tests.py # Test runner script
├── docs/ # Documentation
│ ├── README.md # Detailed project documentation
│ └── TEST_CASES.md # Test case documentation
├── reports/ # Test execution reports
│ ├── screenshots/ # Screenshots of test failures
│ ├── logs/ # Test execution logs
│ └── test_report.html # HTML test report
├── venv/ # Python virtual environment
├── requirements.txt # Python dependencies
└── Assignment 2.pdf # Assignment PDF
- Python 3.x
- Chrome and Firefox browsers installed
- Internet connection (for downloading browser drivers)
-
Clone or navigate to the project directory:
cd "Selenium Project"
-
Activate virtual environment:
source venv/bin/activate -
Install dependencies (if not already installed):
pip install -r requirements.txt
-
Run tests:
cd selenium pytest --browser chrome
Important: Always run pytest from the selenium/ directory to ensure configuration files are found.
cd selenium
pytest --browser chromeChrome (headed):
cd selenium
pytest --browser chromeFirefox (headed):
cd selenium
pytest --browser firefoxChrome (headless):
cd selenium
pytest --browser chrome --headlessFirefox (headless):
cd selenium
pytest --browser firefox --headlesscd selenium
python run_tests.py-
Login Functionality (2 test cases)
- Valid credentials login
- Invalid credentials login
-
Shopping Cart (3 test cases)
- Add product to cart
- Remove product from cart
- Cart empty state
-
Product Details (1 test case)
- Verify product name, price, and description
-
Checkout Process (1 test case)
- Complete checkout with form submission
-
UI Elements (2 test cases)
- Homepage UI elements
- Product page UI elements
Total: 9 test cases covering all required functionalities.
This project follows the Page Object Model (POM) design pattern:
- Separation of Concerns: Page objects separate UI elements from test logic
- Maintainability: Easy to update when UI changes
- Reusability: Page objects can be reused across multiple tests
- Readability: Tests are clean and readable
- ✅ Page Object Model implementation
- ✅ Explicit waits for dynamic elements
- ✅ Screenshot capture on failures
- ✅ Multi-browser support (Chrome, Firefox)
- ✅ Headless and headed mode support
- ✅ HTML test reports
- ✅ Comprehensive logging
- ✅ Modular and maintainable code structure
After test execution, reports are generated in the reports/ directory:
- HTML Report:
reports/test_report.html - Screenshots:
reports/screenshots/(captured during test execution) - Logs:
reports/logs/(detailed execution logs)
- Detailed Documentation: See
docs/README.md - Test Cases: See
docs/TEST_CASES.md - Assignment PDF:
Assignment 2.pdf
Test configuration is managed in selenium/utils/config.py:
- Base URL: https://www.demoblaze.com
- Timeouts: Configurable implicit and explicit waits
- Browser options: Chrome and Firefox specific configurations
- DemoBlaze is a demo application. Some features may require account creation.
- Browser drivers are automatically managed by webdriver-manager.
- Screenshots are automatically captured on test failures and key test steps.
✅ Test Scenario Identification (20%): 9+ test cases documented
✅ Test Script Creation (40%): Complete POM implementation with Selenium
✅ Test Execution (20%): Chrome and Firefox in headless/headed modes
✅ Reporting (20%): HTML reports, screenshots, and logs
This project is created for educational purposes as part of a graduate assignment.