How nirtal85/selenium-python-example works
Project type and purpose
• This is a test-automation framework (not an end-user app).
• Purpose: drive browser-based UI tests (login, project management, templates, etc.), parse data, validate visuals, send emails, report results.
File structure
• Top-level:
• src/pages → Page-Object classes (POM).
• src/utilities → Helpers (excel parsing, VRT, mailinator, listener).
• src/enums → Shared enums (test status).
• resources → Static test data (Excel, JSON).
• tests → Pytest test modules and fixtures.
• pyproject.toml & .env → Config/dependencies.
• .github/workflows → CI/CD pipelines (devRun, nightly).
README insights
• Tech stack includes Selenium, Pytest (+plugins), Allure, VRT, Mailinator, MySQL connector, tenacity, etc.
• CI via GitHub Actions triggers tests and publishes Allure reports.
Main components & relationships
a. Test Runner Layer
• Pytest CLI (with plugins) reads config, discovers tests under tests/.
• .env loader (python-dotenv) provides secrets/config.
b. Test Scripts
• tests/*.py import Page Objects and utilities.
• conftest.py defines fixtures (WebDriver instantiation, base URLs).
c. Page-Object Layer
• src/pages/**/*.py encapsulate UI interactions (login_page, projects_page, top_menu_bar, etc.).
• BasePage provides common methods (click, find, wait).
d. Utilities
• excel_parser reads resources/data.xls.
• data.py loads JSON or Excel into models.
• mailinator_helper interacts with Mailinator API.
• vrt_helper interacts with Visual-Regression-Tracker service.
• web_driver_listener hooks into WebDriver events for logging/screenshots.
e. External Services
• Browser Driver (Chrome/Firefox) controlled by selenium.
• MySQL DB (via mysql-connector) for any data validations (db_test).
• Mailinator service for email‐based tests.
• Visual Regression Tracker for visual diffs.
• Allure report server (local or GitHub Pages).
f. CI/CD
• GitHub Actions workflows (devRun, nightly) execute tests, collect results, publish to Allure.
Architectural patterns & design principles
• Page Object Model (POM) separates test logic from page interactions.
• Layered architecture: Tests → POM → Utilities → External services.
• Dependency injection via fixtures for WebDriver, base-URL, credentials.
• Config management (.env, python-dotenv).
• Observer pattern: WebDriverListener captures events.
• Retry logic: tenacity for resilient steps.
• Soft assertions and test ordering via pytest plugins.