Skip to content

arturdmt-alt/QA_Selenium_Grid

Repository files navigation

QA Selenium Grid - Parallel Testing Framework

Tests Python Selenium Pytest Docker Grid

Professional parallel testing framework using Selenium Grid with Docker for cross-browser testing.

Project Overview

Automated testing framework for OrangeHRM Demo application demonstrating parallel test execution across multiple browsers using Selenium Grid.

Website Under Test: https://opensource-demo.orangehrmlive.com/

Features

  • Selenium Grid 4.16 with Docker
  • Parallel test execution (Chrome + Firefox)
  • Page Object Model architecture
  • pytest-xdist for distributed testing
  • HTML test reports
  • Cross-browser compatibility testing

Tech Stack

  • Framework: Selenium 4.16.0
  • Language: Python 3.12
  • Test Runner: pytest 7.4.3
  • Parallel Execution: pytest-xdist 3.5.0
  • Grid: Docker Compose (Hub + 2 Nodes)
  • Browsers: Chrome 120, Firefox 120

Project Structure

QA_Selenium_Grid/
├── pages/
│   ├── base_page.py           # Base page object
│   ├── login_page.py          # Login page
│   └── dashboard_page.py      # Dashboard page
├── tests/
│   ├── test_login.py          # Login tests
│   └── test_dashboard.py      # Dashboard tests
├── docs/
│   └── images/                # Documentation screenshots
├── reports/                   # HTML test reports
├── docker-compose.yml         # Selenium Grid configuration
├── conftest.py                # pytest fixtures
├── pytest.ini                 # pytest configuration
├── requirements.txt           # Python dependencies
└── README.md

Installation

Prerequisites

  • Python 3.12+
  • Docker Desktop
  • pip package manager

Setup

# Clone repository
git clone https://github.com/arturdmt-alt/QA_Selenium_Grid.git

# Navigate to project
cd QA_Selenium_Grid

# Create virtual environment
python -m venv venv

# Activate virtual environment
venv\Scripts\activate  # Windows
source venv/bin/activate  # Linux/Mac

# Install dependencies
pip install -r requirements.txt

Running Tests

Start Selenium Grid

docker-compose up -d

Verify Grid is running: http://localhost:4444

Selenium Grid Console

Grid Console

The Grid runs with 2 nodes:

  • Chrome Node (v120.0)
  • Firefox Node (v120.0)
  • Max concurrent sessions: 2

Run Tests

# Run all tests in parallel
pytest tests/ -n 2 --dist loadgroup

# Run with HTML report
pytest tests/ -n 2 --html=reports/report.html --self-contained-html

# Run specific test file
pytest tests/test_login.py -n 2

# Run specific test
pytest tests/test_login.py::TestLogin::test_successful_login

Stop Selenium Grid

docker-compose down

Test Results

Tests execute in parallel across Chrome and Firefox with approximately 50 seconds duration.

Test Execution

Test Execution

HTML Report

Test Report

Selenium Grid Architecture

  • Hub: localhost:4444
  • Chrome Node: 1 concurrent session
  • Firefox Node: 1 concurrent session
  • Total capacity: 2 concurrent sessions

Test Coverage

Login Tests

  • Successful login with valid credentials
  • Invalid login error handling

Dashboard Tests

  • Logout functionality
  • Dashboard display verification

Key Learning Outcomes

  • Selenium Grid setup with Docker
  • Parallel test execution
  • Cross-browser testing
  • Docker Compose orchestration
  • pytest-xdist distributed testing
  • Remote WebDriver configuration
  • Page Object Model design pattern

Known Issues

None currently. All tests passing consistently.

Author

Artur Dmytriyev