A scalable, reusable, and enterprise-ready Playwright Automation Framework designed for modern web and mobile browser automation.
Built with clean architecture, reusable utilities, smart execution features, environment management, cross-browser testing, and browser-based mobile automation.
β If you like this project, don't forget to Star this repository!
This framework is built following enterprise automation best practices with a focus on:
- Maintainability
- Scalability
- Execution stability
- Test data management
- Reusable components
- Detailed reporting
- Environment management
- Cross-browser execution
- Mobile web automation
- CI/CD readiness
It helps teams build reliable Playwright automation by providing reusable utilities, environment management, environment-aware test data, custom fixtures, smart execution helpers, centralized assertions, organized artifacts, Allure reporting, email reporting, and modular project architecture.
The framework is designed to support both day-to-day automation execution and long-term framework scalability.
- β Custom Playwright Fixtures
- β Environment-Aware Test Data Management
- β Allure Reporting
- β Allure Environment Information
- β Allure History & Trends
- β Soft Assertion Support
- β Email Execution Reporting
- β Automatic Report ZIP Generation
- β Allure Report Packaging
- β Playwright HTML Report Packaging
- β Screenshots, Videos & Trace Attachments
- β Global Setup & Teardown Reporting Integration
- β Improved Reporting Architecture
- β Page Object Model (POM)
- β Modular Architecture
- β Custom Playwright Fixtures
- β Cross Browser Testing
- β Browser-Based Mobile Testing
- β Parallel Execution
- β Excel Data-Driven Framework
- β Environment-Aware Test Data
- β Multi-Environment Support
- β Reusable Utilities
- β Centralized Configuration
- β Smart Click Utility
- β Smart Fill Utility
- β Smart Wait Utility
- β Generic Retry Utility
- β Assertion Utility
- β Soft Assertion Support
- β Execution Dashboard
- β Environment Management
- β Test Data Management
- β Excel Utility
- β Screenshot Utility
- β Download Utility
- β Faker Utility
- β Date & Time Utility
- β Common Utility
- β Assertion Utility
- β Environment Utility
- β Retry Utility
- β Wait Utility
- β HTML Report
- β Allure Report
- β Allure Environment
- β Allure History
- β Allure Trends
- β Execution Summary
- β Email Reporting
- β Automatic Report Packaging
- β Screenshots
- β Videos
- β Playwright Traces
- β Test Attachments
- β Smart Artifact Management
Execute the same test suite across multiple environments without changing test code.
config
β
βββ environment
βββ dev.env
βββ uat.env
βββ pre-prod.env
βββ prod.env
npm run uatnpm run preprodnpm run prodSimply switch the command.
No test code changes are required.
The framework loads the corresponding environment configuration and uses the environment-specific Base URL and configuration during execution.
The framework includes an environment-aware test data management layer.
Environment switching is not limited to changing the application URL.
The framework also provides a structured approach for handling test data according to the selected environment.
Environment
β
βββ DEV
β βββ DEV Test Data
β
βββ UAT
β βββ UAT Test Data
β
βββ PRE-PROD
β βββ PRE-PROD Test Data
β
βββ PROD
βββ PROD Test Data
This approach helps maintain separation between:
- Application Configuration
- Environment Configuration
- Test Data
- Test Implementation
The same automation test can therefore be executed across different environments without modifying the actual test implementation.
Custom Playwright Fixtures have been integrated into the framework to centralize reusable test dependencies and setup logic.
Fixtures help reduce repeated setup code and provide a cleaner way to manage framework-level dependencies.
- Reusable test context
- Reduced duplicate setup
- Cleaner test cases
- Centralized dependencies
- Better maintainability
- Easier framework extension
- Consistent test initialization
test('Login Test', async ({ page }) => {
// Test implementation
});Framework-level setup and reusable dependencies can be handled through fixtures instead of repeating setup logic across individual tests.
Every execution automatically displays:
- Framework Version
- Environment
- Base URL
- Browser
- Execution Mode
- Workers
- Platform
- Operating System
- Node Version
- Execution Start Time
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Playwright Automation Framework
Framework Version : v1.2.0
Environment : UAT
Base URL : Environment Base URL
Browser : Chromium
Execution Mode : Parallel
Workers : 4
Platform : Windows
Operating System : Windows
Node Version : v22.x
Started At : 30-Jul-2026
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
The dashboard provides immediate visibility into the execution context before the test suite starts.
The framework includes reusable smart utilities designed to improve execution stability and reduce repetitive automation code.
await smartClick(page.locator("#login"));Automatically:
- Waits for visibility
- Scrolls into view
- Performs the click
- Retries on failure
- Provides execution logs
await smartFill(username, "Admin");Automatically:
- Waits until editable
- Clears existing value
- Enters data
- Verifies entered value
- Retries if required
- Provides execution logs
await waitForPageReady(page);Handles common page readiness conditions such as:
- DOM Loaded
- Network Idle
- Loader Disappearance
- Spinner Completion
Instead of:
await expect(locator).toBeVisible();Use:
await Assertion.assertVisible(locator);Supports:
- Element Assertions
- Page Assertions
- URL Assertions
- Text Assertions
- Count Assertions
- API Assertions
- Generic Assertions
- Soft Assertions
The centralized assertion layer keeps validation logic consistent across the framework.
| Browser | Supported |
|---|---|
| Chromium | β |
| Chrome | β |
| Firefox | β |
| WebKit | β |
| Mobile Chrome | β |
| Mobile Safari | β |
Playwright_Automation
β
βββ config
β β
β βββ environment
β β βββ dev.env
β β βββ uat.env
β β βββ pre-prod.env
β β βββ prod.env
β β
β βββ executionConfig.js
β
βββ pages
β
βββ tests
β
βββ testData
β
βββ fixtures
β
βββ utilities
β βββ assertionUtil.js
β βββ clickUtil.js
β βββ dashboardUtil.js
β βββ downloadUtil.js
β βββ environmentUtil.js
β βββ excelUtil.js
β βββ fakerUtil.js
β βββ fillUtil.js
β βββ retryUtil.js
β βββ screenshotUtil.js
β βββ waitUtil.js
β
βββ reporting
β β
β βββ allure
β β βββ environmentWriter.js
β β
β βββ email
β β βββ executionSummary.js
β β βββ emailUtil.js
β β
β βββ zip
β βββ zipReport.js
β
βββ reports
βββ screenshots
βββ downloads
βββ allure-results
βββ allure-report
βββ playwright-report
βββ test-results
βββ global-setup.js
βββ global-teardown.js
βββ playwright.config.js
βββ package.json
The framework provides multiple reporting layers for better execution visibility.
Automatically generates:
- HTML Report
- Allure Report
- Execution Summary
- Passed Test Cases
- Failed Test Cases
- Skipped Test Cases
- Execution Duration
- Screenshots
- Videos
- Playwright Traces
- Test Attachments
- Allure Environment Information
- Allure History
- Allure Trends
- Organized Artifacts
- Email Execution Report
The framework integrates Allure Reporting for detailed execution analysis.
Allure provides:
- Test Execution Summary
- Passed Tests
- Failed Tests
- Skipped Tests
- Test Duration
- Test Details
- Test Steps
- Screenshots
- Videos
- Trace Information
- Attachments
- Environment Information
- Categories
- History
- Trends
allure generate allure-results --clean -o allure-reportallure open allure-reportnpx allure --versionThe framework automatically provides execution environment information to the Allure report.
Environment information includes:
- Framework Version
- Test Environment
- Browser
- Operating System
- Platform
- Node Version
- Base URL
This provides better visibility into where and how the test execution was performed.
Allure history and trend information is maintained across executions.
The report provides trend information such as:
- Test Execution History
- Duration Trends
- Retry Trends
- Category Trends
This allows teams to analyze execution stability and test behavior across multiple runs.
The framework includes automated email execution reporting.
The email report generates a professional HTML execution summary.
The report can include:
- Execution Environment
- Total Tests
- Passed Tests
- Failed Tests
- Skipped Tests
- Execution Duration
- Execution Status
- Test Summary
- Report Attachments
ββββββββββββββββββββββββββββββββββββββββββββ
π Playwright Automation Execution Summary
Environment : UAT
Total Tests : 10
Passed : 8
Failed : 1
Skipped : 1
Execution Status : COMPLETED
ββββββββββββββββββββββββββββββββββββββββββββ
The framework automatically packages execution reports into ZIP files.
reports
β
βββ allure-report.zip
β
βββ playwright-report.zip
The generated ZIP files can be attached to the execution email.
This makes it easier to share complete execution results with:
- QA Teams
- Developers
- Managers
- Clients
- CI/CD Stakeholders
Each execution automatically manages:
Execution
β
βββ Reports
βββ Screenshots
βββ Downloads
βββ Artifacts
- No overwritten reports
- No mixed screenshots
- Organized execution artifacts
- Easier failure investigation
- Easier report sharing
Test Execution
β
βΌ
Execution Dashboard
β
βΌ
Playwright Tests
β
ββββββββββββββββββΌββββββββββββββββββ
β β β
βΌ βΌ βΌ
Screenshots Videos Traces
β β β
ββββββββββββββββββΌββββββββββββββββββ
βΌ
Test Results
β
βΌ
Allure Results
β
βΌ
Allure Report
β
βΌ
Report Packaging
β
βΌ
Email Reporting
Supports browser-based mobile automation using Playwright Device Emulation.
- Responsive Testing
- Mobile Scroll Utility
- Touch Gestures
- Mobile Viewports
- Cross Device Validation
- Mobile Browser Testing
Supports:
- Multiple Workers
- Stable Parallel Execution
- Independent Test Execution
- Faster Test Execution
- Cross Browser Execution
- Organized Test Artifacts
The framework supports Excel-based data-driven testing.
Excel utilities can be used for:
- Test Data Management
- Multiple Test Combinations
- Parameterized Execution
- Data-Driven Test Cases
- Environment-Specific Test Data
Excel Test Data
β
βΌ
Test Data Utility
β
βΌ
Test Case
β
βΌ
Playwright Execution
The framework includes Faker-based dynamic test data generation.
It can be used for generating dynamic values such as:
- Names
- Mobile Numbers
- Email Addresses
- Random Values
- Test Data
This reduces dependency on hardcoded test values.
The framework contains reusable utilities for common automation requirements.
- Assertion Utility
- Click Utility
- Fill Utility
- Wait Utility
- Retry Utility
- Screenshot Utility
- Download Utility
- Excel Utility
- Faker Utility
- Environment Utility
- Dashboard Utility
- Common Utility
The utility layer helps reduce duplicate automation code and improves maintainability.
images/framework-structure.png
images/dashboard.png
images/html-report.png
images/allure-report.png
images/email-report.png
images/artifacts.png
Make sure the following are installed:
- Node.js
- npm
- Git
- Playwright
- Allure CLI
git clone https://github.com/mrpathak20/Playwright-Automation-Framework.gitcd Playwright-Automation-Frameworknpm installnpx playwright installnpx playwright testnpx playwright test --headednpx playwright test tests/example.spec.jsnpm run uatnpm run preprodnpm run prodnpx allure --versionallure generate allure-results --clean -o allure-reportallure open allure-reportOpen the Playwright HTML report:
npx playwright show-reportThe Playwright report provides:
- Test Execution Summary
- Passed Tests
- Failed Tests
- Test Duration
- Screenshots
- Videos
- Trace Viewer
- Test Details
Email credentials should be managed through environment variables.
EMAIL_FROM=your-email@example.com
EMAIL_PASSWORD=your-email-password
EMAIL_TO=recipient@example.comDo not commit actual credentials to GitHub.
Recommended approaches include:
- Environment Variables
- GitHub Actions Secrets
- Jenkins Credentials
- Azure DevOps Variables
- CI/CD Secret Management
Environment files containing credentials or sensitive information should not be committed to GitHub.
Sensitive information such as:
- Usernames
- Passwords
- Email Credentials
- API Credentials
- Access Tokens
should be managed using environment variables or CI/CD secret management.
The framework uses global setup and teardown processes for framework-level execution tasks.
Global setup can be used for:
- Framework initialization
- Reporting folder preparation
- Environment initialization
- Execution preparation
Global teardown can be used for:
- Allure report generation
- Report processing
- Execution cleanup
- Final reporting operations
This provides a centralized lifecycle for framework execution.
The framework is structured for integration with:
- GitHub Actions
- Jenkins
- Azure DevOps
- GitLab CI
Execution reports and artifacts can be published as part of CI/CD execution.
The reporting architecture also allows execution summaries and reports to be distributed through email.
The framework follows a modular architecture:
βββββββββββββββββββββββ
β Test Cases β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Custom Fixtures β
ββββββββββββ¬βββββββββββ
β
βββββββββββββββββΌββββββββββββββββ
βΌ βΌ βΌ
ββββββββββββββββ ββββββββββββββ ββββββββββββββββ
β Page Objects β β Test Data β β Utilities β
ββββββββ¬ββββββββ βββββββ¬βββββββ ββββββββ¬ββββββββ
β β β
βββββββββββββββββΌββββββββββββββββ
βΌ
βββββββββββββββββββββββ
β Playwright Engine β
ββββββββββββ¬βββββββββββ
β
βΌ
βββββββββββββββββββββββ
β Test Execution β
ββββββββββββ¬βββββββββββ
β
βββββββββββββββββΌββββββββββββββββββ
βΌ βΌ βΌ
βββββββββββββββ βββββββββββββββ βββββββββββββββ
β HTML Report β βAllure Reportβ β Artifacts β
βββββββββββββββ ββββββββ¬βββββββ βββββββββββββββ
β
βΌ
βββββββββββββββ
βEmail Report β
βββββββββββββββ
| Capability | Status |
|---|---|
| Page Object Model | β |
| Playwright Test | β |
| Custom Fixtures | β |
| Environment Management | β |
| Environment-Aware Test Data | β |
| Excel Data-Driven Testing | β |
| Faker Test Data | β |
| Smart Click | β |
| Smart Fill | β |
| Smart Wait | β |
| Retry Utility | β |
| Assertion Utility | β |
| Soft Assertions | β |
| Execution Dashboard | β |
| Cross Browser Testing | β |
| Mobile Web Testing | β |
| HTML Reporting | β |
| Allure Reporting | β |
| Allure Environment | β |
| Allure History | β |
| Allure Trends | β |
| Screenshots | β |
| Videos | β |
| Playwright Traces | β |
| Email Reporting | β |
| Report ZIP Packaging | β |
| CI/CD Ready | β |
- Custom Playwright Fixtures
- Environment-Aware Test Data Management
- Improved Framework Architecture
- Allure Reporting
- Allure Environment Information
- Allure History
- Allure Trends
- Email Execution Reporting
- Execution Summary
- Automatic Report Packaging
- Soft Assertion Support
- Screenshots
- Videos
- Playwright Traces
- Global Setup & Teardown Reporting Integration
- Allure Report ZIP
- Playwright HTML Report ZIP
- Email Attachments
- Environment Management
- Execution Dashboard
- Smart Retry Utility
- Smart Click Utility
- Smart Fill Utility
- Smart Wait Utility
- Assertion Utility
- Page Object Model
- Excel Data Driven Framework
- Cross Browser Testing
- Mobile Browser Automation
- API Utility
- Database Utility
- HTML Reporting
- Organized Artifacts
Future versions may include:
- π€ AI-Assisted Test Generation
- π Playwright MCP Integration
- π€ AI Agent Support
- π§ Intelligent Failure Analysis
- π©Ή AI-Assisted Automation Recovery
- π Slack / Teams Notifications
- π³ Docker Integration
- βοΈ Cloud Browser Execution
- π Advanced Execution Analytics
AI and self-healing capabilities are intentionally planned for a future AI-enabled evolution of the framework.
Contributions are always welcome.
If you'd like to improve this framework:
- Fork the repository
- Create a feature branch
- Implement your changes
- Commit your changes
- Push the branch
- Submit a Pull Request
Available for:
- Playwright Framework Development
- QA Automation
- UI Automation
- API Automation
- Mobile Web Automation
- Test Framework Design
- Test Data Management
- Reporting Framework Development
- CI/CD Integration
- Automation Consulting
Open to collaboration, knowledge sharing, and freelance opportunities around:
- Playwright Automation
- Test Automation Frameworks
- QA Automation
- JavaScript / Playwright
- Test Data Management
- Reporting Automation
- CI/CD Automation
Feel free to connect and discuss automation requirements or framework development opportunities.
If this project helped you:
β Star this repository
π΄ Fork it
π‘ Suggest Improvements
π€ Contribute
π’ Share it with other automation engineers
This project is intended for:
- Learning
- Experimentation
- Framework Development
- Professional Automation Use