Skip to content

Lightweight POM framework (Selenium Python) running on GitHub Actions with Allure reporting for consistent and efficient execution.

Notifications You must be signed in to change notification settings

SaiVamsiKolla-QA/selenium-pom-ui-tests-python

Repository files navigation

πŸš€ Selenium POM UI Automation Framework

Selenium Grid CI Python Version Selenium Pytest Allure License: MIT

πŸ“Š Latest Allure Report | πŸ”— Swag Labs Demo

A robust, production-ready Selenium automation framework built with Python and pytest, implementing the Page Object Model (POM) design pattern. Features comprehensive CI/CD integration, Selenium Grid support, and detailed Allure reporting with historical trends.

✨ Key Features

Core Capabilities

  • πŸ—οΈ Page Object Model (POM) - Clean, maintainable test architecture
  • 🌐 Cross-Browser Support - Chrome, Firefox, Edge, Safari
  • ⚑ Parallel Execution - Multi-threaded test execution with configurable workers
  • πŸ”„ Cross-Browser Parallel - Run tests simultaneously across multiple browsers
  • 🎯 Flexible Parallelization - Browser-level and test-level parallel execution
  • πŸ–₯️ Cross-Platform - Windows, macOS, Linux compatibility
  • πŸ“Έ Visual Documentation - Automatic screenshot capture at every step

Advanced Features

  • πŸ“Š Allure Reporting - Rich reports with history trends and analytics
  • πŸ”„ CI/CD Integration - GitHub Actions with automated deployments
  • πŸ“ˆ Performance Metrics - Execution statistics and trend analysis
  • πŸ“§ Email Notifications - Automated test result summaries
  • 🎯 Flexible Execution - Multiple test execution strategies
  • 🧹 Auto-Cleanup - Browser process management

πŸ“‹ Prerequisites

Before running the tests, ensure you have the following installed:

Software Version Purpose Installation Guide
Python 3.10+ Core runtime python.org
Docker Desktop Latest Selenium Grid & containers docker.com
Java 8+ Allure reporting oracle.com/java

πŸ“ Project Structure

selenium-pom-ui-tests-python/
β”œβ”€β”€ πŸ“‚ .github/
β”‚   └── workflows/
β”‚       └── selenium-grid-ci.yml    # GitHub Actions CI/CD workflow
β”œβ”€β”€ πŸ“‚ Pages/                       # Page Object Model classes
β”‚   β”œβ”€β”€ login_page.py              # Login page objects
β”‚   β”œβ”€β”€ inventory_page.py          # Product listing page
β”‚   └── checkout_page.py           # Checkout flow pages
β”œβ”€β”€ πŸ“‚ Tests/                       # Test scripts
β”‚   β”œβ”€β”€ conftest.py                # Pytest fixtures & configuration
β”‚   β”œβ”€β”€ test_swag_login.py         # Login functionality tests
β”‚   └── assets/                    # Test-specific assets
β”œβ”€β”€ πŸ“‚ Utility/                     # Helper functions
β”‚   └── utility.py                 # Common utilities
β”œβ”€β”€ πŸ“‚ allure-results/             # Test results directory
β”‚   β”œβ”€β”€ environment.properties     # Environment configuration
β”‚   └── categories.json           # Test categorization rules
β”œβ”€β”€ πŸ“‚ allure-report/              # Generated HTML reports
β”œβ”€β”€ πŸ“‚ reports/                    # Archived test reports
β”œβ”€β”€ πŸ“‚ .pytest_cache/              # Pytest cache directory
β”œβ”€β”€ πŸ“„ pytest.ini                  # Pytest configuration
β”œβ”€β”€ πŸ“„ Dockerfile                  # Container configuration
β”œβ”€β”€ πŸ“„ docker-compose.yml          # Selenium Grid orchestration
β”œβ”€β”€ πŸ“„ requirements.txt            # Python dependencies
β”œβ”€β”€ πŸ“„ setup_check.py             # Environment verification
β”œβ”€β”€ πŸ“„ cleanup.py                 # Browser process cleanup
└── πŸ“„ README.md                   # Project documentation

Browser Support

  • Chrome (default)
  • Firefox
  • Edge
  • Safari (local only)

πŸš€ Quick Start

  1. Clone Repository

    git clone https://github.com/SaiVamsiKolla-QA/selenium-pom-ui-tests-python.git
    cd selenium-pom-ui-tests-python
  2. Set Up Environment

    python -m venv .venv
    source .venv/bin/activate  # Linux/macOS
    .venv\Scripts\activate     # Windows
    pip install -r requirements.txt
  3. Run Tests

    # Run all tests
    pytest
    
    # Run specific test category
    pytest -m smoke
    pytest -m "smoke and not login"
    
    # Run with specific browser
    pytest --browser chrome
    pytest --browser firefox
  4. Run with Selenium Grid

    # Start Selenium Grid
    docker-compose up -d
    
    # Run tests against Grid
    pytest --remote-url http://localhost:4444/wd/hub
  5. Parallel Cross-Browser Testing

    # Run the parallel cross-browser test script
    ./run_parallel_cross_browser.sh
    
    # Available options:
    #  -w, --workers N        Number of parallel workers (default: 4)
    #  -b, --browsers LIST    Comma-separated list of browsers (default: chrome,firefox)
    #  -u, --url URL         Remote Selenium Grid URL (default: http://localhost:4444/wd/hub)
    #  -t, --tests PATH      Test path (default: Tests/)
    
    # Examples:
    # Run with 6 workers on all browsers
    ./run_parallel_cross_browser.sh -w 6 -b chrome,firefox,edge
    
    # Run specific tests with 4 workers
    ./run_parallel_cross_browser.sh -t Tests/test_swag_login.py
    
    # Run on custom Selenium Grid
    ./run_parallel_cross_browser.sh -u http://custom-grid:4444/wd/hub
    
    # Combined options
    ./run_parallel_cross_browser.sh -w 6 -b chrome,firefox -t Tests/test_swag_login.py -u http://localhost:4444/wd/hub

πŸ“Š Test Reports

Local Execution

# Generate Allure report
allure generate allure-results -o allure-report --clean

# Open report
allure open allure-report

CI/CD Pipeline

  • Automated report generation
  • GitHub Pages deployment
  • Email notifications with test results
  • Historical trend analysis

πŸ”§ Environment Configuration

Supported Browsers

  • Chrome (default)
  • Firefox
  • Edge
  • Safari (local only)

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

About

Lightweight POM framework (Selenium Python) running on GitHub Actions with Allure reporting for consistent and efficient execution.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •