Skip to content

mhgolestan/playwright-python-course

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright Pytest Automation Framework

This repository contains a test automation framework built with Playwright and Pytest in Python. It serves as a practical application of the concepts and techniques learned from the "Playwright PYTHON Automation Testing - From Zero to Expert" course on Udemy.

Course Information

This project is based on the teachings from the following Udemy course:

Key Learnings and Skills

This project demonstrates experience and understanding in the following areas:

  • Python Fundamentals: Core concepts of the Python programming language.
  • Playwright for Browser Automation:
    • Interacting with web pages, using selectors, and navigating between pages.
    • Handling network interception and mocking for API and hybrid testing.
    • Performing API testing directly with Playwright's request context.
    • Visual testing, including taking screenshots and performing comparisons.
    • Emulating mobile devices and testing responsive designs.
  • Playwright Tools:
    • Inspector: For debugging and inspecting page elements.
    • Trace Viewer: To get a detailed trace of test execution.
    • CodeGen: For recording user interactions and generating test scripts.
  • Pytest for Test Management:
    • Writing and organizing tests.
    • Using fixtures for setup and teardown.
    • Parameterizing tests to run with different data sets.
  • Test Automation Framework Design:
    • Structuring the framework with a modular approach using Page Object Model (POM).
    • Creating reusable utilities and configuration modules.
  • Behavior-Driven Development (BDD):
    • Incorporating BDD principles with Gherkin (.feature files) and pytest-bdd.
  • CI/CD and Reporting:
    • Running tests in a containerized environment using Docker.
    • Generating comprehensive test reports.
    • Capturing screenshots, videos, and traces on test failure.
  • Best Practices:
    • Writing maintainable, readable, and scalable test code.
    • Applying the principle of separation of concerns in the framework design.

Getting Started

Prerequisites

  • Python 3.10+
  • pip
  • Virtualenv (recommended)

Setup and Installation

  1. Clone the repository:

    git clone <repository-url>
    cd playwright_pytest_course
  2. Create and activate a virtual environment:

    python -m venv venv
    source venv/bin/activate  # On Windows, use `venv\Scripts\activate`
  3. Install the dependencies:

    pip install -r requirements.txt
  4. Create a .env file in the root of the project and add the necessary credentials:

    EMAIL=<your_email>
    PASSWORD=<your_password>
    PST_EMAIL=<your_pst_email>
    PST_PASSWORD=<your_pst_password>
    

Running the Tests

To run the tests, use the following command:

pytest

You can also specify a browser to run the tests against:

pytest --browser_name <browser>

Supported browsers are chrome, firefox, and edge.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published