Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

4 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐ŸฆŠ Firefox UI Automation Testing Suite

CI Python Selenium License: MIT

A professional, beginner-friendly Selenium automation testing framework built with Python, PyTest and the Page Object Model (POM) design pattern. Designed to be portfolio-ready and suitable for internship interviews.


๐ŸŽฏ What This Project Tests

Module Target Site Tests
Login the-internet.herokuapp.com Valid/invalid login, logout, empty fields
Signup demoqa.com Form submission, required fields, dynamic data
Search automationexercise.com Search query, results count, Enter key
Navigation the-internet.herokuapp.com Link routing, back button, page titles
Form Validation demoqa.com Empty submit, invalid email, digits-only phone

๐Ÿ“ Project Structure

firefox_ui_automation/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ .github/
โ”‚   โ””โ”€โ”€ ๐Ÿ“‚ workflows/
โ”‚       โ””โ”€โ”€ ci.yml              # GitHub Actions CI/CD pipeline
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ config/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ config.py               # Centralized config (URLs, timeouts, credentials)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ pages/                   # Page Object Model classes
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ base_page.py            # Base class - common Selenium methods
โ”‚   โ”œโ”€โ”€ login_page.py           # Login page elements + actions
โ”‚   โ”œโ”€โ”€ signup_page.py          # Signup/registration form
โ”‚   โ”œโ”€โ”€ search_page.py          # Search functionality
โ”‚   โ”œโ”€โ”€ navigation_page.py      # Site navigation + links
โ”‚   โ””โ”€โ”€ form_validation_page.py # Form validation behavior
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ tests/                   # PyTest test files
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ test_login.py           # 8 login test cases
โ”‚   โ”œโ”€โ”€ test_signup.py          # 6 signup test cases
โ”‚   โ”œโ”€โ”€ test_search.py          # 7 search test cases
โ”‚   โ”œโ”€โ”€ test_navigation.py      # 8 navigation test cases
โ”‚   โ””โ”€โ”€ test_form_validation.py # 7 form validation test cases
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ utils/                   # Reusable helper utilities
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ logger.py               # Colored console + file logging
โ”‚   โ”œโ”€โ”€ screenshot.py           # Screenshot capture utility
โ”‚   โ”œโ”€โ”€ wait_helper.py          # Explicit wait wrappers
โ”‚   โ””โ”€โ”€ test_data_generator.py  # Faker-based dynamic test data
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ test_data/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ””โ”€โ”€ test_data.json          # Static test data (credentials, expected values)
โ”‚
โ”œโ”€โ”€ ๐Ÿ“‚ reports/                 # HTML test reports (auto-generated, git-ignored)
โ”œโ”€โ”€ ๐Ÿ“‚ screenshots/             # Test screenshots (auto-generated, git-ignored)
โ”œโ”€โ”€ ๐Ÿ“‚ logs/                    # Log files (auto-generated, git-ignored)
โ”‚
โ”œโ”€โ”€ conftest.py                 # PyTest fixtures (driver setup/teardown)
โ”œโ”€โ”€ pytest.ini                  # PyTest configuration
โ”œโ”€โ”€ requirements.txt            # Python dependencies
โ”œโ”€โ”€ .env.example                # Environment variable template
โ”œโ”€โ”€ .gitignore                  # Git exclusions
โ””โ”€โ”€ README.md                   # This file

๐Ÿš€ Quick Start (Local Setup)

Prerequisites

Before you begin, make sure you have installed:

Note: You do NOT need to manually download GeckoDriver! The webdriver-manager library handles this automatically.


Step-by-Step Setup

Step 1 - Clone the repository

git clone https://github.com/YOUR_USERNAME/firefox-ui-automation.git
cd firefox-ui-automation

Step 2 - Create a virtual environment

A virtual environment keeps this project's dependencies isolated from other Python projects.

# Create virtual environment
python -m venv venv

# Activate it:
# On macOS/Linux:
source venv/bin/activate

# On Windows (Command Prompt):
venv\Scripts\activate.bat

# On Windows (PowerShell):
venv\Scripts\Activate.ps1

You should see (venv) at the start of your terminal prompt.

Step 3 - Install dependencies

pip install -r requirements.txt

Step 4 - Configure environment

cp .env.example .env
# The default settings work out of the box!
# Edit .env if you want to change the BASE_URL or credentials.

Step 5 - Run the tests!

# Run all tests
pytest

# Run with visible browser (watch it work!)
pytest --headless=false

# Run only smoke tests (quick check)
pytest -m smoke

# Run only login tests
pytest -m login

# Run a specific test file
pytest tests/test_login.py

# Run a specific test function
pytest tests/test_login.py::TestLogin::test_valid_login

Step 6 - View the HTML report

After the run, open the generated report in your browser:

# macOS
open reports/test_report.html

# Linux
xdg-open reports/test_report.html

# Windows
start reports/test_report.html

๐Ÿงช Test Commands Reference

# Run all tests (verbose output)
pytest -v

# Run in headless mode (no browser window)
pytest --headless=true

# Run specific marker groups
pytest -m smoke              # Quick sanity checks
pytest -m login              # Login tests only
pytest -m signup             # Signup tests only
pytest -m search             # Search tests only
pytest -m navigation         # Navigation tests only
pytest -m validation         # Form validation tests only

# Combine markers
pytest -m "smoke and login"  # Smoke + login
pytest -m "not signup"       # Everything except signup

# Run against a different site
pytest --base-url=https://demoqa.com

# Stop after first failure
pytest -x

# Stop after N failures
pytest --maxfail=3

# Run with full tracebacks on failure
pytest --tb=long

# Show test durations (slowest tests first)
pytest --durations=10

๐ŸŒ Recommended Demo Websites

Site URL Best For
The Internet the-internet.herokuapp.com Login, navigation, alerts, dropdowns
DemoQA demoqa.com Rich forms, date pickers, modals
Automation Exercise automationexercise.com E-commerce, search, cart
OrangeHRM opensource-demo.orangehrmlive.com HR system, login, dashboards
ParaBank parabank.parasoft.com Banking app, transfers

๐Ÿ—๏ธ Architecture: Page Object Model (POM)

This project uses the Page Object Model design pattern. Here's why:

โŒ Without POM (bad):              โœ… With POM (good):
โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€              โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
test_login.py                      test_login.py
  driver.find_element(             login_page.login(
    By.ID, "username"             โ†’   "tomsmith",
  ).send_keys("user")                 "password"
  driver.find_element(             )
    By.ID, "password"
  ).send_keys("pass")
  driver.find_element(
    By.CSS_SELECTOR, "button"
  ).click()

If the button's CSS changes:        If the button's CSS changes:
โ†’ Update in EVERY test file         โ†’ Update ONCE in login_page.py

Key concepts:

  • Each webpage โ†’ one Page class (e.g., LoginPage, SearchPage)
  • Locators (CSS/ID selectors) live inside the Page class
  • Tests call readable methods: login_page.login(user, password)
  • BasePage provides shared browser interaction methods

๐Ÿ“Š Test Reports

After each run, an HTML report is generated at reports/test_report.html:

  • โœ… Green = Passed
  • โŒ Red = Failed
  • โš ๏ธ Yellow = Skipped/Xfail
  • Screenshot thumbnails for failed tests
  • Test duration for each case
  • Environment metadata (Python version, browser, timestamp)

๐Ÿ”„ CI/CD with GitHub Actions

The .github/workflows/ci.yml pipeline automatically:

  1. Installs Firefox on Ubuntu
  2. Sets up Python 3.11
  3. Installs all dependencies
  4. Runs the full test suite in headless mode
  5. Uploads the HTML report as a downloadable artifact
  6. Posts a summary to the GitHub Actions dashboard

Triggers:

  • Every push to main or develop
  • Every Pull Request to main
  • Daily at 6:00 AM UTC (scheduled regression)
  • Manual trigger from the Actions tab

๐ŸŒฑ Suggested Git Commit History

Here are 8-10 meaningful commits for a professional GitHub history:

1. feat: initialize project with POM folder structure and requirements.txt
2. feat: add conftest.py with Firefox WebDriver fixture and pytest configuration
3. feat: implement BasePage class with reusable Selenium interaction methods
4. feat: add LoginPage POM and test_login.py with 8 test cases
5. feat: add SignupPage POM and test_signup.py with Faker data generator
6. feat: add SearchPage POM and test_search.py with parametrized queries
7. feat: add NavigationPage POM and test_navigation.py with link validation
8. feat: add FormValidationPage and test_form_validation.py with edge cases
9. feat: add GitHub Actions CI/CD workflow for automated test execution
10. docs: add comprehensive README with setup guide and architecture docs

๐Ÿ”ฎ Future Improvements

Once you're comfortable with the basics, here are ways to scale this framework:

Immediate Next Steps

  • Allure Reports - richer test reports with graphs and trends
  • pytest-xdist - run tests in parallel (faster execution: pytest -n 4)
  • Cross-browser - add Chrome support alongside Firefox
  • Data-driven tests - load test cases from CSV/Excel files

Intermediate

  • API testing layer - add requests library to test REST APIs
  • Database verification - connect to test DB to verify data persistence
  • Visual regression - screenshot diffing with pytest-image-snapshot
  • Docker - containerize the test environment for portability

Advanced / Enterprise

  • Selenium Grid - distribute tests across multiple machines
  • BrowserStack/Sauce Labs - run on real devices in the cloud
  • Page Factory - lazy element initialization for performance
  • Custom pytest plugins - reusable test infrastructure across projects
  • Reporting dashboard - Grafana + InfluxDB for long-term test trends

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feat/add-cart-tests
  3. Commit your changes: git commit -m 'feat: add shopping cart test cases'
  4. Push to your branch: git push origin feat/add-cart-tests
  5. Open a Pull Request

๐Ÿ“„ License

MIT License - free to use for personal and commercial projects.


๐Ÿ‘ค Author

Built as a learning project for internship preparation.

"The best way to learn test automation is to automate something real."

About

Python-based browser automation framework for Firefox regression and smoke testing

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages