Skip to content

md-Arif-QA/adnabu-qa-assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AdNabu QA Assignment

πŸ“‹ Project Overview

This is an end-to-end test automation project for an e-commerce website using Selenium WebDriver and Pytest. The project implements the Page Object Model (POM) design pattern to create maintainable and scalable test automation code.

πŸ› οΈ Tech Stack

  • Python 3.12 - Programming language
  • Selenium WebDriver - Browser automation
  • Pytest - Testing framework
  • WebDriver Manager - Automatic driver management
  • Page Object Model (POM) - Design pattern for maintainable code

✨ Features Covered

🏠 Home Page

  • Application navigation
  • Store password authentication
  • Featured products listing

πŸ” Search Functionality

  • Search icon interaction
  • Product search with predictive results
  • Products section validation
  • Product selection from search results

πŸ“¦ Product Page

  • Product page verification
  • Product variant selection (Sunset variant)
  • Add to cart functionality

πŸ›’ Cart Management

  • Cart drawer verification
  • Checkout button interaction
  • Product presence validation in cart

πŸ’³ Checkout Process

  • Payment page validation
  • Navigation back to store
  • Order summary verification

πŸ“ Project Structure

AdNabu_Assignment/
β”‚
β”œβ”€β”€ pages/                          # Page Object Model classes
β”‚   β”œβ”€β”€ __init__.py
β”‚   β”œβ”€β”€ home_page.py               # Home page interactions
β”‚   β”œβ”€β”€ search_page.py             # Search functionality
β”‚   β”œβ”€β”€ product_page.py            # Product details and cart
β”‚   β”œβ”€β”€ cart_page.py               # Cart management
β”‚   └── checkout_page.py           # Checkout process
β”‚
β”œβ”€β”€ tests/                         # Test files
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── test_complete_purchase_flow.py  # End-to-end test
β”‚
β”œβ”€β”€ utils/                         # Utility modules
β”‚   β”œβ”€β”€ __init__.py
β”‚   └── driver_setup.py            # WebDriver configuration
β”‚
β”œβ”€β”€ conftest.py                    # Pytest fixtures and configuration
β”œβ”€β”€ pytest.ini                     # Pytest configuration
β”œβ”€β”€ requirements.txt               # Python dependencies
β”œβ”€β”€ .gitignore                     # Git ignore rules
└── README.md                      # Project documentation

πŸ”§ Prerequisites

  • Python 3.12 or higher
  • Git for version control
  • Google Chrome browser (latest version recommended)
  • Internet connection for downloading WebDriver

πŸš€ Setup Instructions

1. Clone the Repository

git clone https://github.com/md-Arif-QA/adnabu-qa-assignment.git
cd adnabu-qa-assignment

2. Verify Python Version

Ensure you have Python 3.12 installed:

python --version
# Should show: Python 3.12.x

If you don't have Python 3.12, download it from python.org.

3. Create Virtual Environment

Create a virtual environment to isolate project dependencies:

# Create virtual environment named 'venv'
python -m venv venv

4. Activate Virtual Environment

Activate the virtual environment:

Windows (PowerShell/Command Prompt):

# PowerShell
venv\Scripts\Activate.ps1

# Command Prompt
venv\Scripts\activate.bat

macOS/Linux:

source venv/bin/activate

After activation, your terminal prompt should show (venv) at the beginning.

5. Install Dependencies

Install all required Python packages:

pip install -r requirements.txt

This will install:

  • selenium - Web browser automation
  • pytest - Testing framework
  • webdriver-manager - Automatic ChromeDriver management

6. Verify Installation

Verify that all packages are installed correctly:

pip list

You should see packages like:

  • selenium
  • pytest
  • webdriver-manager

πŸ§ͺ Running Tests

Run All Tests

pytest

Run Tests with Verbose Output

pytest -v

Run Tests with Console Output

pytest -v -s

Run Tests with HTML Report

pytest --html=reports/test_report.html --self-contained-html

This generates a detailed HTML report in the reports/ directory.

Run Tests with JUnit XML Report

pytest --junitxml=reports/test_results.xml

Run Specific Test with Report

pytest tests/test_complete_purchase_flow.py::TestCompletePurchaseFlow::test_search_add_cart_checkout_flow --html=reports/test_report.html --self-contained-html -v -s

πŸ“Š Test Execution Details

The main test test_search_add_cart_checkout_flow performs a complete e-commerce purchase flow:

  1. Setup: Initialize WebDriver and page objects
  2. Home Page: Open application and enter store password
  3. Product Discovery: List all featured products
  4. Search: Search for "The Complete Snowboard"
  5. Product Selection: Select product from search results
  6. Product Details: Verify product page and select variant
  7. Add to Cart: Add product to shopping cart
  8. Cart Verification: Verify cart contents
  9. Checkout: Proceed to checkout and verify payment page
  10. Navigation: Return to store and verify cart persistence
  11. Teardown: Close browser automatically

πŸ” Test Results

Test execution provides detailed console output with:

  • Step-by-step progress indicators
  • Product listing information
  • Verification confirmations
  • Error details (if any)

πŸ“Š Test Reports

The project supports generating comprehensive test reports:

HTML Reports

  • Generated using pytest-html plugin
  • Self-contained HTML files with detailed test results
  • Includes screenshots, logs, and execution times
  • Located in reports/test_report.html

JUnit XML Reports

  • Standard XML format for CI/CD integration
  • Contains test results, durations, and failure details
  • Located in reports/test_results.xml

Viewing Reports

  1. Run tests with report generation: pytest --html=reports/test_report.html --self-contained-html
  2. Open the generated HTML file in any web browser
  3. Review test execution details, timings, and any failures

Note: A sample test report (reports/test_report.html) is included in the repository for reference.

πŸ› οΈ Troubleshooting

Common Issues

  1. ChromeDriver Issues

    • Ensure Google Chrome is installed and updated
    • WebDriver Manager handles driver downloads automatically
  2. Virtual Environment Issues

    • Ensure virtual environment is activated (check (venv) in prompt)
    • Try deactivating and reactivating: deactivate then activate again
  3. Import Errors

    • Verify all dependencies are installed: pip install -r requirements.txt
    • Check Python version compatibility
  4. Test Failures

    • Check internet connection for website access
    • Verify website is accessible and not under maintenance
    • Check console output for specific error messages

Getting Help

If you encounter issues:

  1. Check the console output for error messages
  2. Verify all prerequisites are met
  3. Ensure virtual environment is properly activated
  4. Check that all dependencies are installed

πŸ“ Notes

  • Tests are designed to run in a real browser environment
  • Chrome browser window will open and close automatically during test execution
  • Test execution may take 1-2 minutes depending on network conditions
  • All test data and URLs are configured for the AdNabu test environment

🀝 Contributing

  1. Fork the repository: https://github.com/md-Arif-QA/adnabu-qa-assignment
  2. Create a feature branch (git checkout -b feature/your-feature)
  3. Make your changes and add comments where needed
  4. Run tests to ensure everything works: pytest -v -s
  5. Commit your changes (git commit -m 'Add your feature')
  6. Push to your fork (git push origin feature/your-feature)
  7. Submit a pull request with detailed description

πŸ“§ Contact & Support

For questions or issues, please open an issue on GitHub Issues.


Happy Testing! πŸš€

About

E-commerce test automation using Selenium WebDriver, Pytest, and Page Object Model. Complete purchase flow testing from login to checkout.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors