Skip to content

Commit a6dd876

Browse files
authored
Merge pull request #212 from nirtal85/hotfix-readme2
readme
2 parents 377659f + 166438a commit a6dd876

1 file changed

Lines changed: 85 additions & 82 deletions

File tree

README.md

Lines changed: 85 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,48 @@
1-
# 🎭 Playwright Python Example 🎭
1+
<div align="center">
22

3-
![twitter](https://img.shields.io/twitter/follow/NirTal2)
4-
![YouTube Channel](https://img.shields.io/youtube/channel/subscribers/UCQjS-eoKl0a1nuP_dvpLsjQ?label=YouTube%20Channel)
5-
![dev run](https://github.com/nirtal85/Playwright-Python-Example/actions/workflows/devRun.yml/badge.svg)
6-
![nightly](https://github.com/nirtal85/Playwright-Python-Example/actions/workflows/nightly.yml/badge.svg)
7-
[![uv](https://img.shields.iodpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
8-
[![Ruff](https://img.shields.iodpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
3+
<img height="120" src="https://cdn.simpleicons.org/playwright/2EAD33"/>
4+
5+
# Enterprise-Grade Playwright Python Architecture
6+
### The Ultimate Boilerplate for Scalable, Robust, and Modern UI Automation
7+
8+
[![Twitter Follow](https://img.shields.io/twitter/follow/NirTal2?style=social)](https://twitter.com/NirTal2)
9+
[![YouTube](https://img.shields.io/youtube/channel/subscribers/UCQjS-eoKl0a1nuP_dvpLsjQ?style=social)](https://www.youtube.com/channel/UCQjS-eoKl0a1nuP_dvpLsjQ)
10+
![CI Status](https://github.com/nirtal85/Playwright-Python-Example/actions/workflows/devRun.yml/badge.svg)
11+
![Nightly Build](https://github.com/nirtal85/Playwright-Python-Example/actions/workflows/nightly.yml/badge.svg)
12+
[![uv](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/uv/main/assets/badge/v0.json)](https://github.com/astral-sh/uv)
13+
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
14+
15+
[View Live Report](https://nirtal85.github.io/Playwright-Python-Example/)[Read The Docs](https://www.test-shift.com)[Report Bug](https://github.com/nirtal85/Playwright-Python-Example/issues)
16+
17+
</div>
18+
19+
---
20+
21+
## 🚀 About The Project
22+
23+
This repository is a **Production-Ready Reference Architecture** for building next-generation test automation using **Playwright** and Python.
24+
25+
It goes beyond basic scripts to demonstrate a fully scalable framework with advanced features like Accessibility Testing (A11y), visual tracing, and cloud integration, tailored for modern DevOps pipelines.
926

1027
<p align="center">
1128
<a href="https://automation.co.il/%d7%a7%d7%95%d7%a8%d7%a1-%d7%90%d7%95%d7%98%d7%95%d7%9e%d7%a6%d7%99%d7%94-%d7%a4%d7%99%d7%99%d7%aa%d7%95%d7%9f-python-automation/">
12-
<img src="resources/images/automation_college_playwright_course.jpeg" alt="Automation College - Playwright Python Course" />
29+
<img src="resources/images/automation_college_playwright_course.jpeg" alt="Automation College - Playwright Python Course" width="600" style="border-radius: 10px;" />
1330
</a>
1431
</p>
1532

33+
### ✨ Key Features
34+
* **Modern Tooling:** Powered by `uv` for blazing fast package management and `Ruff` for linting.
35+
* **Accessibility First:** Integrated **Axe** scans to ensure your app is accessible to everyone.
36+
* **Deep Debugging:** Full integration with **Playwright Traces** and Video recording linked directly to Allure Reports.
37+
* **Cloud Scale:** Native integration with **BrowserStack** for cross-browser testing on real devices.
38+
* **CI/CD Optimization:** Parallel execution strategies and dynamic version syncing for GitHub Actions.
39+
40+
---
41+
1642
## 📃 Articles written about this project
1743

44+
This project implements the concepts discussed in the following **TestShift** articles:
45+
1846
* [Test Automation - How To Use Custom User Agent in Selenium Python or Playwright Python to Avoid Security Bots](https://www.test-shift.com/posts/test-automation-how-to-use-custom-user-agent-in-selenium-python-or-playwright-python-to-avoid-security-bots)
1947
* [Test Automation - How to Use Dynamic Base URLs with Selenium And Playwright Python in GitHub Actions](https://www.test-shift.com/posts/test-automation-how-to-use-dynamic-base-urls-with-selenium-and-playwright-python-in-github-actions)
2048
* [Test Automation - Maximizing Browser Window With Playwright Python And Pytest](https://www.test-shift.com/posts/test-automation-maximizing-browser-window-with-playwright-python-and-pytest)
@@ -29,136 +57,111 @@
2957
* [From Open Source to Industry Sponsorship: The TestShift Journey with BrowserStack](https://www.test-shift.com/posts/from-open-source-to-enterprise-sponsorship-the-testshift-journey-with-browserstack)
3058
* [From Selenium to Playwright: A Data-Driven Look at the Shifting Landscape of Test Automation](https://www.test-shift.com/posts/from-selenium-to-playwright-a-data-driven-look-at-the-shifting-landscape-of-test-automation)
3159

60+
---
61+
3262
## 🛠️ Tech Stack
3363

34-
| Tool | Description |
35-
|--------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------|
36-
| [allure-pytest](https://pypi.org/project/allure-pytest/) | Allure reporting with your Pytest tests for better reporting |
37-
| [axe-playwright-python](https://pypi.org/project/axe-playwright-python/) | Python library for running accessibility checks with Playwright |
38-
| [playwright](https://pypi.org/project/playwright/) | Python library to automate the Chromium, WebKit, and Firefox browsers through a single API. |
39-
| [pytest](https://pypi.org/project/pytest/) | Popular testing framework for Python |
40-
| [pytest-base-url](https://pypi.org/project/pytest-base-url/) | Pytest plugin for setting a base URL for your tests |
41-
| [pytest-playwright](https://pypi.org/project/pytest-playwright/) | Pytest plugin for Playwright integration for browser automation testing |
42-
| [pytest-split](https://pypi.org/project/pytest-split/) | Pytest plugin which splits the test suite to equally sized sub suites based on test execution time. |
43-
| [requests](https://pypi.org/project/requests/) | Versatile library for making HTTP requests in Python |
64+
| Tool | Description & Why We Use It |
65+
|-------------------------------------------------------------------|------------------------------------------------------------------|
66+
| [Playwright](https://pypi.org/project/playwright/) | The modern standard for reliable, flaky-free browser automation. |
67+
| [Pytest](https://pypi.org/project/pytest/) | The most powerful testing framework for Python. |
68+
| [Axe Playwright](https://pypi.org/project/axe-playwright-python/) | For automated accessibility (A11y) compliance testing. |
69+
| [Allure](https://pypi.org/project/allure-pytest/) | For beautiful, data-rich test reports including Traces & Video. |
70+
| [Pytest Split](https://pypi.org/project/pytest-split/) | To intelligently split test suites for parallel execution. |
71+
| [Requests](https://pypi.org/project/requests/) | For API interactions and test data setup. |
72+
73+
### 🌐 Cloud Testing Provider
4474

45-
## 🌐 Browser Testing
75+
This project is powered by **[BrowserStack](https://www.browserstack.com)**, enabling high-scale cross-browser and mobile testing on real devices in the cloud.
4676

47-
This project is tested with [BrowserStack](https://www.browserstack.com), enabling cross-browser and mobile testing on real devices in the cloud.
77+
---
4878

49-
## ⚙️ Setup Instructions
79+
## ⚙️ Getting Started
5080

51-
### Clone the project
81+
### 1. Clone
5282

5383
```bash
5484
git clone https://github.com/nirtal85/Playwright-Python-Example
5585
cd playwright-python
5686
```
5787

58-
### Create and activate a virtual environment then Install project dependencies
88+
### 2. Install (The Modern Way)
89+
90+
We use uv for lightning-fast installations.
91+
92+
Windows (PowerShell):
93+
5994

60-
#### PowerShell installation in windows:
6195
```bash
96+
python -m pip install uv
6297
python -m uv venv
6398
.venv\Scripts\Activate.ps1
64-
python -m ensurepip --upgrade
65-
python -m pip install uv
6699
uv sync --all-extras --dev
100+
playwright install
67101
```
68102

69-
#### For Mac:
103+
Mac/Linux:
104+
70105
```bash
71106
python3 -m pip install uv
72107
uv venv
73108
source .venv/bin/activate
74109
uv sync --all-extras --dev
75-
```
76-
77-
### Install playwright
78-
79-
```bash
80110
playwright install
81111
```
82112

83-
## 🏃‍♂️ Running Tests
113+
## 🏃‍♂️ Execution
114+
115+
Run all tests (Chromium by default):
84116

85117
```bash
86118
pytest
87119
```
88120

89-
When no browser was selected then chrome will be used.
90-
91-
* Run according to tags:
121+
Run specific suite (Tags):
92122

93123
```bash
94-
pytest -m <tag_name>
124+
pytest -m sanity
95125
```
96126

97-
## 📊 Viewing Test Results
98-
99-
### Install Allure Commandline To View Test results
127+
## 📊 Results, Traces & Debugging
100128

101-
#### For Windows:
129+
We use Allure for reporting and Playwright Traces for debugging.
102130

103-
Follow the instructions [here](https://scoop.sh/) to install Scoop.<br>
104-
Run the following command to install Allure using Scoop:
131+
Viewing Reports Locally
132+
Windows (via Scoop):
105133

106134
```bash
107135
scoop install allure
136+
allure serve allure-results
108137
```
109138

110-
#### For Mac:
139+
Mac (via Brew):
111140

112141
```bash
113142
brew install allure
114-
```
115-
116-
### View Results Locally:
117-
118-
```bash
119143
allure serve allure-results
120144
```
121145

122-
### View Results Online:
123-
124-
[View allure results via Github pages](https://nirtal85.github.io/Playwright-Python-Example/)
146+
👉 [See a Live Example of the Report Here](https://nirtal85.github.io/Playwright-Python-Example/)
125147

126-
### View trace results:
148+
### 🕵️‍♀️ Using the Trace Viewer
127149

128-
1. Navigate to the [Playwright Trace Viewer](https://trace.playwright.dev/)
129-
2. Locate the trace file stored under the test-results folder. This file is generated after running your tests. Click on the 'Upload' button in the Playwright Trace Viewer and select your trace file.
130-
3. After uploading, the trace viewer will display a detailed timeline of events that occurred during your test. This includes network requests, JavaScript execution, and browser interactions. You can click on individual events for more details.
150+
Navigate to the Playwright Trace Viewer.
131151

132-
## ℹ️ View Help And Other CLI Options
152+
Drag & Drop the trace file (located in test-results/) generated after a failure.
133153

134-
```bash
135-
pytest --help
136-
```
137-
138-
### Pre Commit
154+
Time Travel: Move back and forth in the timeline to see exactly what happened (Network, DOM, Console).
139155

140-
#### Run Pre Commit Checks Automatically
156+
<div align="center">
141157

142-
```bash
143-
pre-commit install
144-
pre-commit install --hook-type commit-msg
145-
```
158+
Found this project useful?
159+
If this architecture helped you solve a problem or save time, consider supporting the work!
146160

147-
#### Bump Pre Commit Hooks Version
161+
<a href="https://www.buymeacoffee.com/nirtal"> <img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="60" alt="Buy Me A Coffee" /> </a>
148162

149-
```bash
150-
pre-commit autoupdate
151-
```
152-
153-
#### Run Pre Commit Checks Manually On The Entire Project
154-
155-
```bash
156-
pre-commit run --all-files
157-
```
158-
## ☕ Support
163+
<br />
159164

160-
If you find this project helpful, you can support my work by buying me a coffee:
165+
Visit TestShift.com for more Architectural Insights
161166

162-
<p><a href="https://www.buymeacoffee.com/nirtal">
163-
<img align="left" src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" height="50" width="210" alt="Buy Me A Coffee" />
164-
</a></p><br><br>
167+
</div>

0 commit comments

Comments
 (0)