Enterprise-Ready | TypeScript | Playwright | Fixtures | Data-Driven | Multi-Environment | Advanced Reporting
A scalable, reusable, and enterprise-focused Playwright Automation Framework built with TypeScript, designed for modern UI and mobile web automation.
This framework focuses on clean architecture, reusable components, environment-aware execution, test-data management, Playwright fixtures, advanced reporting, execution visibility, and automated report distribution.
β If you find this project useful, don't forget to Star the repository!
This framework is designed using modern automation engineering practices with a strong focus on:
- Maintainability
- Scalability
- Reusability
- Test isolation
- Environment management
- Test-data management
- Execution stability
- Failure investigation
- Reporting
- CI/CD readiness
The framework provides a structured foundation for building and maintaining large Playwright automation suites.
The TypeScript release introduces several improvements focused on framework architecture, test data, execution, reporting, and distribution.
Custom Playwright fixtures are integrated into the framework to centralize reusable dependencies and test setup.
Benefits:
- Reusable test dependencies
- Centralized setup
- Cleaner test files
- Better test isolation
- Reduced duplicate code
- Scalable test architecture
Example:
import { test, expect } from '../fixtures/testFixtures';
test('verify application title', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/Playwright/);
});The framework supports executing the same test suite against different environments without modifying test code.
Supported environments can include:
DEV
UAT
PRE-PROD
PROD
Environment configuration is maintained separately from test implementation.
Example structure:
config
β
βββ environment
βββ dev.env
βββ uat.env
βββ preprod.env
βββ prod.env
Run tests using:
npm run uatnpm run preprodnpm run prodThis allows environment switching without changing the test implementation.
A major focus of this release is separating test data from environment configuration and test execution.
The architecture follows:
Environment
β
Configuration
β
Test Data
β
Test Execution
This creates a foundation for maintaining different test-data requirements across environments.
The approach is designed to support:
- Environment-specific test data
- Centralized data management
- Reusable test data
- Dynamic test data
- Data-driven execution
- Future data seeding and cleanup strategies
The framework supports data-driven automation using Excel and reusable data utilities.
Example:
testData
β
βββ loginData.xlsx
βββ userData.xlsx
βββ policyData.xlsx
This allows multiple test scenarios to execute using different datasets without duplicating test logic.
The framework includes Faker-based dynamic test-data generation.
Useful for generating:
- Names
- Email addresses
- Mobile numbers
- Addresses
- Random test values
- Dynamic user information
This helps reduce hard-coded test data and improves test-data flexibility.
Allure Reporting is integrated into the framework for detailed execution analysis.
The framework captures:
- Passed tests
- Failed tests
- Skipped tests
- Screenshots
- Videos
- Playwright traces
- Attachments
- Environment information
- Execution history
- Execution trends
- Duration trends
- Retry trends
Generate the Allure report using:
npm run allure:generateOpen the report:
npm run allure:openOr use:
npm run allureEach execution records environment information such as:
Environment
Browser
Operating System
Platform
Node.js Version
Framework Version
Base URL
Example:
Environment : UAT
Browser : Chromium
Platform : darwin
Node Version : v24.x
Framework Version : v1.2.0
Base URL : https://example.com
This makes it easier to understand exactly where an execution was performed.
The framework maintains Allure history to provide visibility across executions.
Supported trend information includes:
- Execution history
- Duration trends
- Retry trends
- Category trends
This allows teams to identify changes in execution behavior over time.
Soft assertion support allows multiple validations to be performed during a test without immediately stopping execution after the first failure.
This is useful when validating multiple UI elements or business rules within the same scenario.
Example:
await expect.soft(page.getByText('Username')).toBeVisible();
await expect.soft(page.getByText('Password')).toBeVisible();
await expect.soft(page.getByRole('button', { name: 'Login' })).toBeVisible();This allows the test to collect multiple validation failures before completing.
The framework contains reusable execution utilities designed to improve test stability and reduce repetitive code.
await smartClick(page.locator('#login'));Designed to handle:
- Visibility
- Scroll into view
- Interaction readiness
- Retry behavior
- Execution logging
await smartFill(page.locator('#username'), 'Admin');Designed to:
- Wait for the field
- Clear existing values
- Enter data
- Validate the entered value
- Retry when required
await waitForPageReady(page);Provides reusable waiting logic for page readiness and application synchronization.
Reusable retry mechanisms are available for operations that may occasionally fail because of transient application or synchronization issues.
Screenshots can be captured during test execution for:
- Validation points
- Failure investigation
- Debugging
- Execution evidence
Example:
await page.screenshot({
path: 'screenshots/homepage.png',
fullPage: true
});Playwright execution artifacts can be retained for debugging.
Supported artifacts include:
- Screenshots
- Videos
- Playwright traces
- Attachments
These artifacts can also be consumed through the Allure reporting layer.
The framework includes automated execution email reporting.
The email report can contain:
- Execution summary
- Total tests
- Passed tests
- Failed tests
- Skipped tests
- Execution duration
- Environment information
- HTML execution report
Example execution flow:
Test Execution
β
Execution Summary
β
HTML Report
β
Report Packaging
β
Email Distribution
This allows execution results to be distributed automatically to QA teams and stakeholders.
Execution reports can automatically be packaged into ZIP files.
Generated reports can include:
reports
β
βββ playwright-report.zip
βββ allure-report.zip
This makes it easier to share complete execution evidence with stakeholders.
The framework provides execution information at runtime.
Example:
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Playwright Automation Framework
Framework Version : v1.2.0
Environment : UAT
Base URL : https://example.com
Browser : Chromium
Execution Mode : Parallel
Workers : Default
Platform : darwin
Operating System : Darwin
Node Version : v24.x
Started At : Execution Time
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
This provides immediate visibility into the execution context.
The framework supports Playwright browser projects including:
| Browser | Supported |
|---|---|
| Chromium | β |
| Chrome | β |
| Firefox | β |
| WebKit | β |
Browser configuration can be maintained through the Playwright configuration.
The framework supports browser-based mobile automation using Playwright device emulation.
Capabilities include:
- Mobile viewport testing
- Device emulation
- Touch interaction
- Responsive testing
- Mobile browser validation
- Cross-device testing
Example:
import { devices } from '@playwright/test';
projects: [
{
name: 'Mobile Chrome',
use: {
...devices['Galaxy S24']
}
}
]Playwright parallel execution is supported for faster test execution.
Benefits include:
- Multiple workers
- Faster regression execution
- Independent test execution
- Cross-browser execution
- Scalable test suites
Example:
npx playwright test --workers=4The framework follows the Page Object Model architecture.
Example:
pages
β
βββ LoginPage.ts
βββ HomePage.ts
βββ DashboardPage.ts
βββ CheckoutPage.ts
Page objects contain reusable locators and page-level actions while test files focus on business scenarios.
Playwright_Automation
β
βββ config
β βββ environment
β β βββ dev.env
β β βββ uat.env
β β βββ preprod.env
β β βββ prod.env
β β
β βββ executionConfig.ts
β
βββ fixtures
β βββ testFixtures.ts
β
βββ pages
β
βββ tests
β
βββ testData
β
βββ utilities
β βββ assertionUtil.ts
β βββ clickUtil.ts
β βββ dashboardUtil.ts
β βββ downloadUtil.ts
β βββ environmentUtil.ts
β βββ excelUtil.ts
β βββ fakerUtil.ts
β βββ fillUtil.ts
β βββ retryUtil.ts
β βββ screenshotUtil.ts
β βββ waitUtil.ts
β
βββ reporting
β βββ allure
β βββ email
β βββ zip
β
βββ reports
β
βββ screenshots
β
βββ downloads
β
βββ playwright.config.ts
β
βββ package.json
The framework follows a layered reporting approach:
Test Execution
β
βΌ
Playwright Artifacts
β
ββββββββββββββΌβββββββββββββ
βΌ βΌ βΌ
Screenshots Videos Traces
β β β
ββββββββββββββΌβββββββββββββ
βΌ
Allure Results
β
βΌ
Allure Report
β
ββββββββββββ΄βββββββββββ
βΌ βΌ
Stakeholder View Email Report
Execution artifacts are organized into dedicated directories.
Execution
β
βββ allure-results
βββ allure-report
βββ playwright-report
βββ test-results
βββ screenshots
βββ downloads
βββ reports
This prevents different execution artifacts from becoming mixed together.
Playwright configuration is centralized in:
playwright.config.ts
Configuration can control:
- Base URL
- Browser projects
- Workers
- Retries
- Timeouts
- Screenshots
- Videos
- Traces
- Reporter configuration
- Environment configuration
git clone https://github.com/mrpathak20/Playwright-Automation-Framework.gitNavigate into the project:
cd Playwright-Automation-Frameworknpm installnpx playwright installConfigure the required environment files:
config/environment/
Example:
uat.env
preprod.env
prod.env
Run the complete test suite:
npx playwright testRun a specific test:
npx playwright test tests/example.spec.tsRun tests in headed mode:
npx playwright test --headednpm run uatnpm run preprodnpm run prodnpx playwright show-reportnpm run allure:generatenpm run allure:openOr:
npm run allureExample:
npm run uatAfter execution:
npm run allureThe framework supports automated execution email distribution through the reporting layer.
Configuration can be maintained through environment variables rather than hard-coding credentials.
Example:
EMAIL_FROM
EMAIL_PASSWORD
EMAIL_TO
Sensitive credentials should never be committed to Git.
Environment files containing credentials, passwords, API keys, or other secrets should be excluded from version control.
Use:
.env
.env.local
*.env
where appropriate in .gitignore.
Never commit:
- Passwords
- API tokens
- Email credentials
- Access keys
- Production secrets
The framework provides reusable utilities for common automation requirements.
| Utility | Purpose |
|---|---|
| Assertion Utility | Centralized assertions |
| Click Utility | Reliable element interaction |
| Fill Utility | Reliable input handling |
| Wait Utility | Application synchronization |
| Retry Utility | Retry transient failures |
| Screenshot Utility | Screenshot capture |
| Excel Utility | Data-driven testing |
| Faker Utility | Dynamic test data |
| Download Utility | File download handling |
| Environment Utility | Environment management |
| Dashboard Utility | Execution information |
The framework follows these principles:
Common functionality should be implemented once and reused across tests.
Tests should remain simple even as the framework grows.
Test logic, page objects, utilities, configuration, test data, and reporting should remain separated.
The architecture should support increasing test volume and additional environments.
Test failures should provide enough evidence for quick investigation.
Test implementation should not require code changes when switching environments.
The framework is continuously evolving.
Planned areas include:
- π€ AI-enabled test automation
- π§ Intelligent failure analysis
- π©Ή AI-assisted test maintenance
- π MCP integration
- βοΈ Cloud execution
- π CI/CD improvements
- π Slack / Teams notifications
- π Advanced execution analytics
- π§ͺ Advanced test-data lifecycle management
The goal is to gradually evolve the framework toward AI-enabled intelligent QA automation while maintaining a strong and reliable automation foundation.
- Custom Playwright Fixtures
- Improved modular architecture
- Environment-aware execution
- Environment-aware test data
- Soft Assertions
- Smart Click
- Smart Fill
- Smart Wait
- Retry Utility
- Parallel Execution
- Cross-browser execution
- Mobile browser execution
- Allure Reporting
- Environment information
- Allure history
- Execution trends
- Duration trends
- Retry trends
- Screenshots
- Videos
- Playwright traces
- Attachments
- Automated HTML execution summary
- Email reporting
- Report ZIP packaging
- Playwright report packaging
- Allure report packaging
- 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
Contributions and technical feedback are welcome.
If you would like to improve the framework:
- Fork the repository
- Create a feature branch
- Implement your changes
- Add/update tests
- Commit your changes
- Submit a Pull Request
Open to collaboration and freelance opportunities involving:
- Playwright Automation
- TypeScript Automation
- QA Automation
- Automation Framework Development
- Test Architecture
- UI Automation
- API Automation
- Mobile Web Automation
- CI/CD Integration
- Reporting Solutions
- AI-enabled QA Automation
- Automation Framework Modernization
If you are working on a project where Playwright automation or framework modernization can help, feel free to connect.
If this project helped you:
β Star the repository
π΄ Fork it
π‘ Suggest improvements
π Report issues
π€ Contribute
π’ Share with the QA community
This framework is continuously being improved based on practical automation challenges and feedback from the testing community.
If you have ideas, suggestions, or technical feedback, feel free to open an issue or start a discussion.
GitHub:
https://github.com/mrpathak20/Playwright-Automation-Framework-TypeScript.git