A maintainable end‑to‑end test automation framework built on top of Playwright for fast, reliable, cross‑browser UI testing of modern web applications.[web:2]
- Cross‑browser tests running on Chromium, Firefox, and WebKit.
- Built‑in retries and auto‑waiting for stable, flake‑resistant tests.[web:2]
- Clear separation of test logic and page abstractions (Page Object / Screenplay style).
- Configurable test environments (dev, test, staging) via Playwright config.
- Rich reporting with HTML reports (and optional Allure integration if configured).
Adjust this list to match what you actually implemented (e.g. fixtures, API tests, visual tests, Docker, CI, etc.).
- Playwright (Playwright Test runner)
- Node.js (LTS)
- TypeScript / JavaScript (choose one based on your project)
- Test runner: Playwright Test (built‑in)
- Package manager: npm or yarn
Update this section to reflect your exact versions and tools.
Below is a common Playwright project layout—adapt folder names to your repository if they differ.
.
├─ playwright.config.ts # Global Playwright test configuration
├─ package.json # Dependencies and npm scripts
├─ tests/ # Test specifications
│ ├─ example.spec.ts
│ └─ ...
├─ pages/ # Page Object / UI abstraction layer
│ ├─ login.page.ts
│ └─ ...
├─ fixtures/ # Test fixtures / test data (optional)
├─ helpers/ # Reusable utilities & custom assertions (optional)
├─ reports/ # Test reports output (HTML, Allure, etc.)
└─ README.md
Replace, remove, or add folders according to your actual structure.
- Node.js (LTS recommended).
- npm (comes with Node) or yarn.
- Git (to clone the repository).
# Clone the repository
git clone https://github.com/brkacar/Playwright-Automation.git
cd Playwright-Automation
# Install dependencies
npm install
# Install Playwright browsers
npx playwright installIf you use yarn or pnpm, replace the commands accordingly.
Run the full Playwright test suite:
npx playwright testRun tests in headed mode (visible browser):
npx playwright test --headedRun a single test file:
npx playwright test tests/example.spec.tsRun tests in UI mode (Playwright Test Runner UI):
npx playwright test --uiFilter tests by title:
npx playwright test -g "should log in successfully"Update paths, titles, and examples to match your real tests.
Global configuration lives in playwright.config.ts (or .js):
Typical settings include:
- Default browser(s) to run (Chromium, Firefox, WebKit).
- Base URL for the application under test.
- Timeouts, retries, and parallelism.
- Reporter configuration (HTML, list, Allure, etc.).
Example (simplified):
import { defineConfig } from '@playwright/test';
export default defineConfig({
testDir: './tests',
timeout: 30_000,
retries: 1,
use: {
baseURL: 'https://your-app-under-test.com',
headless: true,
},
reporter: [['html', { open: 'never' }]],
});Adjust this example to match your actual configuration file.
Playwright can generate an HTML report out of the box.[web:2]
After a test run:
npx playwright show-reportThis opens the latest report in your default browser.
If you have Allure integrated, document your exact setup here. For example:
# Example: run tests with Allure reporter enabled
npx playwright test --reporter=line,allure-playwright
# Example: generate Allure report
npm run allure:generateReplace the commands above with the scripts and configuration you actually use.
Tests typically live under the tests/ directory and use the @playwright/test API.
Example test:
import { test, expect } from '@playwright/test';
test('user can log in', async ({ page }) => {
await page.goto('/');
await page.fill('#username', 'test_user');
await page.fill('#password', 'secret');
await page.click('button[type="submit"]');
await expect(page.locator('text=Welcome')).toBeVisible();
});If you use Page Objects, show a short example of how a test uses them and link to your pages/ classes.
If you support multiple environments (dev / test / staging), describe your approach:
- Environment URLs managed in
playwright.config.ts. - Additional config files like
playwright.dev.config.ts,playwright.staging.config.ts. - Environment variables using
.envfiles andprocess.env.
Example:
# Run with a specific config
npx playwright test -c playwright.staging.config.tsFill this section according to your real environment strategy.
Document how the framework runs in CI (GitHub Actions, Azure Pipelines, GitLab CI, Jenkins, etc.):
- CI file path (for example
.github/workflows/playwright.yml). - How to run tests headless in CI.
- Where reports and artifacts are published.
Example topics to highlight:
- Installing dependencies and Playwright browsers in CI.
- Cache strategy (node_modules, Playwright browsers).
- Publishing HTML report or Allure report as CI artifacts.
Add any project‑specific standards you follow, such as:
- Naming conventions for tests and page objects.
- Folder structure rules.
- How to handle test data (static test data vs. dynamic fixtures).
- How to mark tests as smoke, regression, or slow.
- Linting, formatting, and pre‑commit hooks (if applicable).
Use this section to track what you plan to add next, e.g.:
- Add API tests with Playwright’s built‑in API client.
- Dockerize the test runner.
- Integrate with CI (GitHub Actions / Azure Pipelines).
- Add visual regression testing.
- Add parallel cross‑browser execution matrix.
If this repository is open to contributions, describe the process:
- Fork the repository.
- Create a feature branch.
- Add or update tests as needed.
- Open a pull request with a clear description.
Specify the license for this project (for example, MIT):
MIT License
Copyright (c) <year> <your-name>
Replace <year> and <your-name> and/or change the license text to whatever you actually use.