Skip to content

About

Production-grade Test Automation Framework | Playwright + Python + BDD (Pytest-BDD) + Page Object Model + CI/CD + Allure Reports

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

Repository files navigation

playwright-python-bdd-framework

Python Playwright BDD CI License

A production-grade Test Automation Framework built with Playwright (Python), Pytest-BDD, Page Object Model, and integrated CI/CD pipeline. Designed to mirror enterprise-level automation used in real banking/fintech projects.


Framework Architecture

playwright-python-bdd-framework/
├── .github/
│   └── workflows/
│       └── ci.yml              # GitHub Actions CI/CD pipeline
├── features/
│   └── login.feature           # BDD feature files (Gherkin)
├── pages/
│   ├── base_page.py            # Base Page Object (reusable actions)
│   └── login_page.py           # Login Page Object
├── steps/
│   └── test_login_steps.py     # BDD step definitions
├── conftest.py                 # Pytest fixtures & browser setup
├── requirements.txt            # Python dependencies
└── README.md

Key Features

  • BDD with Gherkin — Human-readable test scenarios using pytest-bdd
  • Page Object Model — Reusable, maintainable page components
  • Playwright — Fast, reliable cross-browser automation (Chromium/Firefox/WebKit)
  • CI/CD Pipeline — Automated test runs on every push via GitHub Actions
  • Allure Reports — Rich test reporting with screenshots on failure
  • Tagged Scenarios — Run targeted suites: @smoke, @regression, @login

Tech Stack

Tool Version Purpose
Python 3.11+ Core language
Playwright 1.42+ Browser automation
pytest-bdd 7.x BDD test framework
pytest 8.x Test runner
Allure 2.x Test reporting
GitHub Actions — CI/CD pipeline

Quick Start

Prerequisites

python --version   # Python 3.11+

Installation

# Clone the repository
git clone https://github.com/rajTestAutomationNL/playwright-python-bdd-framework.git
cd playwright-python-bdd-framework

# Create virtual environment
python -m venv venv
source venv/bin/activate   # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Install Playwright browsers
playwright install chromium

Run Tests

# Run all BDD tests
pytest steps/ -v

# Run only smoke tests
pytest steps/ -v -m smoke

# Run with Allure reporting
pytest steps/ -v --alluredir=allure-results
allure serve allure-results

# Run headless (CI mode)
pytest steps/ -v --headed=false

BDD Feature Example

@login @smoke
Feature: Login Functionality
  As a registered user of OrangeHRM
  I want to log into the application
  So that I can access the HR dashboard

  Scenario: Successful login with valid credentials
    Given I am on the OrangeHRM login page
    When I enter username "Admin" and password "admin123"
    And I click the login button
    Then I should be redirected to the dashboard

CI/CD Pipeline

The GitHub Actions workflow (.github/workflows/ci.yml) automatically:

  1. Sets up Python 3.11 on Ubuntu
  2. Installs all dependencies
  3. Installs Playwright Chromium browser
  4. Runs the full BDD test suite
  5. Uploads Allure test results as artifacts
  6. Uploads screenshots on test failure

Triggers on: push to main/develop and pull requests.


Author

Raj | Senior Test Automation Engineer

  • 14+ years in software testing & QA
  • Expertise: Playwright, Selenium, Java, Python, CI/CD, BDD
  • Based in the Netherlands

License

MIT License — free to use and adapt.

About

Production-grade Test Automation Framework | Playwright + Python + BDD (Pytest-BDD) + Page Object Model + CI/CD + Allure Reports

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages