A community-driven registry for Claude, Cursor, Windsurf, Cline & more. Not affiliated with Anthropic.
Are you the author? Sign in to claim
End-to-end and API automation for OrangeHRM and the Restful Booker API — built as a reference implementation showcasing
End-to-end and API automation for OrangeHRM and the Restful Booker API — built as a reference implementation showcasing real-world Playwright patterns: Page Object Model, session reuse via storageState, Playwright Request API, Winston logging, Allure 3 reporting, and Claude Code AI agents for test generation and QA documentation.
storageState, all UI tests start pre-authenticatedlogs/ for every run.env, never hardcoded| Tool | Version | Purpose |
|---|---|---|
| Playwright | 1.60+ | Browser automation and test runner |
| TypeScript | 5.x | Type-safe test code |
| Winston | 3.x | Structured logging to file and console |
| dotenv | 17.x | Environment variable management |
| Allure Report | 3.x | Visual test reporting (allure-playwright + allure CLI) |
Playwright-Demo/
├── api/ # API testing layer
│ ├── clients/
│ │ └── base.client.ts # Base HTTP client — wraps Playwright APIRequestContext
│ ├── endpoints/
│ │ └── booking.endpoints.ts # Endpoint path constants (no hardcoded URLs in tests)
│ └── services/
│ └── booking/
│ ├── booking.service.ts # Booking API methods — returns APIResponse
│ └── booking.types.ts # TypeScript interfaces for booking data
├── .auth/ # Saved auth state — generated at runtime (gitignored)
├── configs/
│ ├── env.ts # Typed config object — wraps .env values
│ ├── global-setup.ts # Runs once before all tests — logs SUITE START
│ └── global-teardown.ts # Runs once after all tests — logs SUITE END
├── fixtures/
│ ├── index.ts # UI test fixture — injects page objects + afterEach logger
│ └── api.fixtures.ts # API test fixture — injects services via DI
├── pages/
│ ├── login.page.ts # LoginPage — locators + actions
│ └── dashboard.page.ts # DashboardPage — locators + actions + verify
├── tests/
│ ├── ui/
│ │ ├── login.spec.ts # Tests the login UI flow
│ │ └── dashboard.spec.ts # Tests the dashboard using saved auth state
│ ├── api/
│ │ └── booking/
│ │ └── get-bookings.spec.ts # API tests — GET /booking, GET /booking/:id, filter by name
│ └── auth.setup.ts # Logs in once and saves storageState (infrastructure)
├── utils/
│ └── logger.ts # Winston logger (console + file output)
├── logs/ # Runtime logs — gitignored
├── allure-results/ # Raw Allure test data — gitignored
├── allure-report/ # Generated Allure HTML report — gitignored
├── qa-docs/ # Generated QA artifacts (manual test case docs)
├── .claude/ # Claude Code agent definitions and memory
├── .env # Credentials — never committed
└── playwright.config.ts # Playwright configuration (ui + api projects)
1. Install dependencies
npm install
2. Install Playwright browsers
npx playwright install
3. Create your .env file
Copy .env.example and fill in your credentials:
BASE_URL=https://opensource-demo.orangehrmlive.com
LOGIN_USERNAME=<username>
LOGIN_PASSWORD=<password>
API_BASE_URL=https://restful-booker.herokuapp.com
4. Run the tests
npm test
5. View the Allure report
npm run allure:serve
| Command | Description |
|---|---|
npm test | Run the full test suite (UI + API) |
npm run test:api | Run API tests only |
npm run test:ui | Launch Playwright UI mode |
npx playwright test --project=chromium | Run UI (chromium) project only |
npx playwright test --project=api | Run API project only |
npx playwright test tests/ui/login.spec.ts | Run login spec only |
npx playwright test tests/ui/dashboard.spec.ts | Run dashboard spec only |
npx playwright test tests/api/booking/get-bookings.spec.ts | Run booking API spec only |
| Command | Description |
|---|---|
npx playwright show-report | Open the built-in Playwright HTML report |
npm run allure:serve | Generate and open Allure report in browser |
npm run allure:generate | Generate Allure report to allure-report/ |
npm run allure:open | Open a previously generated Allure report |
npm run allure:clean | Wipe allure-results/ and allure-report/ |
| Command | Description |
|---|---|
npm run auth:refresh | Force a fresh login and regenerate .auth/user.json |
npm run logs:clear | Clear all files in logs/ |
| Spec | Suite | Test Case |
|---|---|---|
tests/ui/login.spec.ts | Authentication | [Login] should allow user access with valid credentials |
tests/ui/login.spec.ts | Authentication — Invalid Login | [Login] should display error when wrong password is provided |
tests/ui/login.spec.ts | Authentication — Invalid Login | [Login] should display error when wrong username is provided |
tests/ui/login.spec.ts | Authentication — Invalid Login | [Login] should display required field errors when both fields are empty |
tests/ui/dashboard.spec.ts | Dashboard | [Dashboard] should load for authenticated user |
| Spec | Suite | Test Case |
|---|---|---|
tests/api/booking/get-bookings.spec.ts | Booking API | [GET /booking] should return a list of booking IDs |
tests/api/booking/get-bookings.spec.ts | Booking API | [GET /booking/:id] should return a booking by its ID |
tests/api/booking/get-bookings.spec.ts | Booking API | [GET /booking] should filter bookings by firstname and lastname |
API tests use Playwright's built-in request context — no browser is launched.
Test
└── imports from fixtures/api.fixtures.ts
└── BookingService (injected via fixture)
└── BaseClient (wraps Playwright APIRequestContext)
└── HTTP call using path from booking.endpoints.ts
└── baseURL resolved from playwright.config.ts api project
The playwright.config.ts defines two separate projects:
| Project | testDir | baseURL | Auth dependency |
|---|---|---|---|
chromium | ./tests (excludes api/) | BASE_URL | setup (auth.setup.ts) |
api | ./tests/api | API_BASE_URL | none |
Add a new feature in 5 files — no changes to existing code required:
api/endpoints/<feature>.endpoints.ts ← path constants
api/services/<feature>/<feature>.types.ts ← TypeScript interfaces
api/services/<feature>/<feature>.service.ts ← service methods
fixtures/api.fixtures.ts ← add fixture property
tests/api/<feature>/<test>.spec.ts ← test spec
All tests in the chromium project start pre-authenticated using a saved browser session.
How it works:
setup project runs auth.setup.ts once before any test.auth/user.json.auth/user.json already exists and is valid, login is skippedchromium tests load that saved state automaticallyForce a fresh login:
npm run auth:refresh
Tests that verify the login UI (e.g.
login.spec.ts) explicitly clear the inherited session withtest.use({ storageState: { cookies: [], origins: [] } }).

Allure results are written to allure-results/ automatically on every test run.
Standard workflow:
npm test
npm run allure:serve
Viewing a selective run (IDE extension):
npm run allure:clean # clear stale results first
# run your test via the IDE extension
npm run allure:serve
The VS Code Playwright extension does not trigger
globalSetup, soallure-results/accumulates across IDE runs. Runallure:cleanbefore any selective run to ensure the report reflects only what you just executed.
Logs are written to logs/ during every test run (gitignored).
| File | Content |
|---|---|
logs/info.log | Info-level messages |
logs/error.log | Error-level and above |
logs/test.log | All levels — full execution trace |
npm run logs:clear # wipe all log files
This project ships with two built-in Claude Code agents that understand the framework conventions and can assist directly in your workflow.
qa-sentinelPlaywright automation engineer. Write, review, debug, and refactor automation code — enforces POM conventions, locator strategy, and import rules.
@agent-qa-sentinel review my new page object
@agent-qa-sentinel why is this test flaky?
@agent-qa-sentinel write a test for the profile page
qa-scribeQA documentation engineer. Converts automation tests into a structured Excel manual test case file.
@agent-qa-scribe generate regression
@agent-qa-scribe generate smoke
@agent-qa-scribe generate from tests/login.spec.ts
Output is written to qa-docs/<type>-testcases.xlsx. Versioned automatically (-v2, -v3) if the file already exists.
Agent definitions live in .claude/agents/. Memory is stored in .claude/agent-memory/.

The qa-docs/ folder holds generated manual test case artifacts produced by qa-scribe.
Files are named by suite type — e.g. qa-docs/regression-testcases.xlsx — and versioned automatically (-v2, -v3) if a file already exists.
npx CLI installing 100+ agents, commands, hooks, and integrations in one command
干净、强大、属于你的 AI Agent 平台 --AI agents, without the clutter.
Native macOS app to monitor Claude AI usage limits and watch your coding sessions live
Pocket Flow: Codebase to Tutorial