Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Playwright Automation Framework

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]


Features

  • 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.).


Tech stack

  • 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.


Project structure

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.


Getting started

Prerequisites

  • Node.js (LTS recommended).
  • npm (comes with Node) or yarn.
  • Git (to clone the repository).

Installation

# Clone the repository
git clone https://github.com/brkacar/Playwright-Automation.git
cd Playwright-Automation

# Install dependencies
npm install

# Install Playwright browsers
npx playwright install

If you use yarn or pnpm, replace the commands accordingly.


Running tests

Run the full Playwright test suite:

npx playwright test

Run tests in headed mode (visible browser):

npx playwright test --headed

Run a single test file:

npx playwright test tests/example.spec.ts

Run tests in UI mode (Playwright Test Runner UI):

npx playwright test --ui

Filter tests by title:

npx playwright test -g "should log in successfully"

Update paths, titles, and examples to match your real tests.


Test configuration

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.


Reports

HTML report

Playwright can generate an HTML report out of the box.[web:2]

After a test run:

npx playwright show-report

This opens the latest report in your default browser.

Allure (optional)

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:generate

Replace the commands above with the scripts and configuration you actually use.


Writing tests

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.


Environment handling

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 .env files and process.env.

Example:

# Run with a specific config
npx playwright test -c playwright.staging.config.ts

Fill this section according to your real environment strategy.


Continuous Integration

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.

Best practices and conventions

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).

Roadmap / TODO

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.

Contributing

If this repository is open to contributions, describe the process:

  1. Fork the repository.
  2. Create a feature branch.
  3. Add or update tests as needed.
  4. Open a pull request with a clear description.

License

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.

About

End‑to‑end web and API test automation framework built with Playwright for fast, reliable, cross‑browser UI testing.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages