Enterprise-grade Playwright TypeScript automation framework targeting the QA Automation Practice Playground (30 sections, 600+ test cases).
- Framework Structure
- Prerequisites
- Quick Start
- Configuration
- Running Tests
- Test Organisation
- Page Objects
- Fixtures & Components
- CI/CD Integration
- Docker
- Reporting
- Execution Flow
- Key Highlights
playwright-framework/
β
βββ tests/ # Test specs (30 sections Γ 20 cases each)
β βββ s01/ basic-form.spec.ts # Section 1 β Basic Form Elements
β βββ s02/ buttons.spec.ts # Section 2 β Button Interactions
β βββ s03/ checkboxes.spec.ts # Section 3 β Checkboxes & Radio
β βββ s04/ dropdowns.spec.ts # Section 4 β Dropdowns
β βββ s07/ waits.spec.ts # Section 7 β Waits & Sync
β βββ s08/ table.spec.ts # Section 8 β Table Automation
β βββ s09/ alerts.spec.ts # Section 9 β Alerts
β βββ s10/ modals.spec.ts # Section 10 β Modals
β βββ s11/ iframe.spec.ts # Section 11 β iFrame
β βββ s12/ shadow-dom.spec.ts # Section 12 β Shadow DOM
β βββ s13/ drag-drop.spec.ts # Section 13 β Drag & Drop
β βββ s14/ hover.spec.ts # Section 14 β Hover Menus
β βββ s15/ tooltip.spec.ts # Section 15 β Tooltips
β βββ s16/ file-upload.spec.ts # Section 16 β File Upload / Download
β βββ s21/ auth.spec.ts # Section 21 β Authentication
β βββ s22/ stale-element.spec.ts # Section 22 β Stale Element
β βββ s23/ dynamic-list.spec.ts # Section 23 β Dynamic List
β βββ s26/ keyboard.spec.ts # Section 26 β Keyboard Actions
β βββ s27/ slider.spec.ts # Section 27 β Range Slider
β βββ s28/ datepicker.spec.ts # Section 28 β Date Picker
β βββ s30/ complex-dom.spec.ts # Section 30 β Complex DOM
β
βββ pages/ # Page Object Models
β βββ BasePage.ts # Shared utilities (nav, wait, scroll)
β βββ BasicFormPage.ts # Section 1
β βββ ButtonsPage.ts # Section 2
β βββ CheckboxesPage.ts # Section 3
β βββ DropdownsPage.ts # Section 4
β βββ DynamicContentPage.ts # Sections 6, 7, 22, 23, 24, 25
β βββ TablePage.ts # Section 8
β βββ AlertsModalPage.ts # Sections 9, 10
β βββ AdvancedPage.ts # Sections 11-15, 16-20, 26-30
β βββ AuthPage.ts # Section 21
β
βββ components/ # Reusable UI components
β βββ TableComponent.ts # Generic table helper
β βββ FormComponent.ts # Generic form helper
β
βββ fixtures/
β βββ custom-fixtures.ts # Extended test fixtures (all POM injection)
β
βββ utils/
β βββ helpers.ts # TestHelpers, A11yHelpers
β βββ constants.ts # TIMEOUTS, CREDENTIALS, TABLE_DATA, etc.
β βββ fileReader.ts # JSON/CSV/TXT reader utilities
β
βββ config/
β βββ environment.ts # Per-environment config (local|ci|staging)
β βββ global-setup.ts # Runs once before all tests
β βββ global-teardown.ts # Runs once after all tests
β βββ auth.setup.ts # Auth state setup project
β βββ .env # Environment variables template
β
βββ test-data/
β βββ users.json # Valid/invalid login credentials
β βββ products.json # Form data, dropdown options, dates
β
βββ reports/ # Generated (gitignored) test outputs
β
βββ docker/
β βββ Dockerfile # Playwright Docker image
β βββ docker-compose.yml # Multi-service compose file
β
βββ .github/workflows/
β βββ playwright-ci.yml # GitHub Actions pipeline
β
βββ .azure/
β βββ azure-pipelines.yml # Azure DevOps pipeline
β
βββ .jenkins/
β βββ Jenkinsfile # Jenkins declarative pipeline
β
βββ scripts/
β βββ run-tests.sh # CLI convenience wrapper
β
βββ playwright.config.ts # Main Playwright configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json # Dependencies & npm scripts
βββ .eslintrc.json # ESLint rules
βββ .prettierrc # Prettier formatting
βββ .gitignore # Git ignore rules
| Tool | Minimum Version |
|---|---|
| Node.js | 18.0.0 |
| npm | 9.0.0 |
| Playwright | 1.44.0 |
| TypeScript | 5.4.5 |
# 1. Clone / enter the framework directory
cd playwright-framework
# 2. Install all dependencies
npm ci
# 3. Install Playwright browsers
npm run setup
# 4. Place the playground HTML at the project root
cp /path/to/automation-practice-playground.html ./
# 5. Run smoke tests
npm run test:smoke
# 6. View the report
npm run test:report| Variable | Default | Description |
|---|---|---|
TEST_ENV |
local |
local / ci / staging |
BASE_URL |
file://./automation-practice-playground.html |
Path or URL to the playground |
VALID_USERNAME |
admin |
Login username for auth tests |
VALID_PASSWORD |
password123 |
Login password for auth tests |
CI |
false |
Enables CI-specific settings |
HEADLESS |
false |
Force headless mode |
Copy .env to .env.local and override values locally. Never commit real credentials.
# All tests (default browser)
npm test
# Headed mode
npm run test:headed
# Interactive UI mode
npm run test:ui
# Debug mode (step-through)
npm run test:debug
# Specific browser
npm run test:chromium
npm run test:firefox
npm run test:webkit
npm run test:all-browsers
# Tag-based
npm run test:smoke # @smoke tag
npm run test:regression # @regression tag
# Parallel / serial
npm run test:parallel # 4 workers
npm run test:serial # 1 worker
# Open last HTML report
npm run test:report
# Generate Allure report
npm run report:allurechmod +x scripts/run-tests.sh
# Smoke tests in headed mode
./scripts/run-tests.sh --smoke --headed
# Section 21 on Firefox
./scripts/run-tests.sh -s 21 -b firefox
# Full regression with report
./scripts/run-tests.sh --regression --report
# Run inside Docker
./scripts/run-tests.sh --dockernpx playwright test --grep @s21 # Auth section
npx playwright test --grep "@s11|@s12" # iframe + Shadow DOM
npx playwright test tests/s08/ # Table folder directlyEvery spec file follows this naming and tagging convention:
TC_S{section}_{P|N}{number} β Description @tagA @tagB
P = Positive test case
N = Negative test case
| Tag | Meaning |
|---|---|
@smoke |
Critical path β run on every commit |
@regression |
Full coverage β nightly / PRs |
@s1β@s30 |
Section-specific filter |
@form |
Form-related tests |
@auth |
Authentication tests |
@advanced |
Shadow DOM, iFrame, Stale Element |
All Page Objects extend BasePage which provides:
navigateTo(url?)β navigate to playgroundscrollToSection(id)β smooth scroll to section anchorwaitForElement(selector)β explicit waitwaitForElementHidden(selector)β wait for hidden statewaitForText(selector, text)β wait for text conditiontakeScreenshot(name)β manual screenshotgetText / getValue / getAttributeβ element data extraction
BasePage
βββ BasicFormPage (s1)
βββ ButtonsPage (s2)
βββ CheckboxesPage (s3)
βββ DropdownsPage (s4)
βββ DynamicContentPage (s6, s7, s22, s23, s24, s25)
βββ TablePage (s8)
βββ AlertsModalPage (s9, s10)
βββ AuthPage (s21)
βββ AdvancedPage (s11-s20, s26-s30)
All Page Objects are injected automatically β no manual instantiation needed:
import { test, expect } from '../fixtures/custom-fixtures';
test('my test', async ({ authPage, tablePage }) => {
await authPage.loginAndWaitForDashboard('admin', 'password123');
await tablePage.goto();
// ...
});import { TableComponent } from '../components/TableComponent';
import { FormComponent } from '../components/FormComponent';
// Generic table helper
const table = new TableComponent(page, '#my-table');
const rows = await table.getRowCount();
const sorted = await table.isSortedAscending(1);
// Generic form helper
const form = new FormComponent(page);
await form.fillByTestId('input-email', 'test@example.com');
await form.submitByTestId('btn-submit');- Triggers: push, PR, nightly schedule, manual dispatch
- Sharded parallel runs (3 shards Γ chromium)
- Cross-browser on schedule (Firefox + WebKit)
- Merged HTML report published to GitHub Pages
- Artifacts retained for 7β14 days
- Parallel matrix strategy
- JUnit results published to Azure Test Plans
- HTML + Allure artifacts uploaded per shard
- Parameterised environment and browser selection
- Declarative pipeline with Docker agent
- Parallel lint + type-check stage
- Allure report via allure-jenkins-plugin
- Slack notifications on pass/fail
- Cross-browser stage gated to nightly triggers
# Build image
docker build -f docker/Dockerfile -t qa-playground-pw .
# Run smoke tests
docker compose -f docker/docker-compose.yml up playwright-smoke
# Run full regression
docker compose -f docker/docker-compose.yml up playwright-regression
# View Allure report at http://localhost:5050
docker compose -f docker/docker-compose.yml up allure| Reporter | Output | Command |
|---|---|---|
| HTML | playwright-report/index.html |
npm run test:report |
| JSON | test-results/results.json |
Auto-generated |
| JUnit | test-results/results.xml |
Auto-generated (CI use) |
| Allure | allure-report/ |
npm run report:allure |
| List | Terminal stdout | Default |
Screenshots, videos, and traces are captured on failure and stored in test-results/artifacts/.
npx playwright test
β
βΌ
Read playwright.config.ts
(browsers, workers, retries, reporters)
β
βΌ
global-setup.ts
(create dirs, copy HTML, log env)
β
βΌ
config/auth.setup.ts βββββββββββββββββββ
(login once, save auth-state.json) β
β β
βΌ β
Execute tests/ **/*.spec.ts β
(with injected fixtures from (storageState
custom-fixtures.ts) reused by
β test projects)
β Page Objects (pages/) ββ
β Components (components/)
β Helpers (utils/)
β Test Data (test-data/)
β
βΌ
Reports: HTML + JSON + JUnit + Allure
β
βΌ
global-teardown.ts
(log summary, cleanup)
- β Page Object Model (POM) β clean separation between locators and test logic
- β TypeScript β strict typing throughout for better IDE support and safety
- β
Reusable components β
TableComponent,FormComponentusable across tests - β Custom fixtures β all POMs auto-injected, zero boilerplate per test
- β
Data-driven β test data externalised to
test-data/users.jsonandproducts.json - β
Environment-aware β
local/ci/stagingconfigs with.envoverride - β Parallelisation β sharded runs, configurable workers
- β Multi-browser β Chromium, Firefox, WebKit, Mobile Chrome, Mobile Safari
- β CI/CD ready β GitHub Actions, Azure DevOps, Jenkins pipelines included
- β Docker β fully containerised run with Allure server sidecar
- β Rich reporting β HTML, JSON, JUnit, Allure with screenshots, videos, traces on failure
- β 600+ test cases β 20 per section (10 positive + 10 negative) across all 30 sections
π‘ Pro Tip: A well-structured framework improves reusability, maintainability and helps the team deliver stable and reliable automation at scale.