Playwright + TypeScript template that showcases a senior-level automation approach for both UI and API testing.
Click to expand (7 outdated, 14 vulnerabilities: 3 high, 11 medium)
| Dependency | Type | Requested Version | Security Status | Latest npm Version |
|---|---|---|---|---|
| @dotenvx/dotenvx | devDependencies | ^2.38.2 |
π’ No findings in supplied report | 2.38.2 |
| @eslint/js | devDependencies | ^10.0.1 |
π’ No findings in supplied report | 10.0.1 |
| @playwright/test | devDependencies | 1.64.1 |
π’ No findings in supplied report | 1.65.1 |
| @types/node | devDependencies | ^26.6.6 |
π’ No findings in supplied report | 26.6.11 |
| allure | devDependencies | ^3.33.0 |
π‘ 3 medium | 3.33.0 |
| allure-playwright | devDependencies | ^3.15.0 |
π’ No findings in supplied report | 3.15.0 |
| eslint | devDependencies | ^10.15.0 |
π΄ 1 high, π‘ 2 medium | 10.16.0 |
| eslint-plugin-playwright | devDependencies | ^2.12.2 |
π΄ 1 high, π‘ 2 medium | 2.12.2 |
| lint-staged | devDependencies | ^17.6.1 |
π’ No findings in supplied report | 17.6.2 |
| pino | dependencies | ^10.4.0 |
π’ No findings in supplied report | 10.4.0 |
| pino-pretty | dependencies | ^13.2.0 |
π’ No findings in supplied report | 13.2.0 |
| playwright-ctrf-json-reporter | devDependencies | ^0.2.0 |
π‘ 2 medium | 0.3.0 |
| prettier | devDependencies | ^3.10.1 |
π’ No findings in supplied report | 3.10.1 |
| simple-git-hooks | devDependencies | ^2.14.0 |
π’ No findings in supplied report | 2.14.0 |
| typescript | devDependencies | ^6.0.3 |
π’ No findings in supplied report | 7.0.2 |
| typescript-eslint | devDependencies | 8.73.0 |
π΄ 1 high, π‘ 2 medium | 8.74.0 |
| zod | devDependencies | ^4.6.7 |
π’ No findings in supplied report | 4.6.7 |
Table generated by dependency-security-matrix-action.
- UI automation against
https://www.saucedemo.com - API automation against Supabase PostgREST
- Deep module structure: CRUD separated from assertions, thin page objects, resource lifecycle fixtures
- Separate Playwright projects for UI and API execution
- CI-ready reporting, retries, traces, linting, type checking, and local Git hooks
The automated test cases are tracked in the Awesome PW Template: Test Catalog.
- Architecture overview β system boundaries, dependency direction, runtime flows, and key decisions
- Testing architecture β UI/API modules, journeys, page objects, fixtures, and test isolation
- Reporting architecture β CTRF, Allure 3, GitHub Pages, history caching, retention, and recovery behavior
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β TESTS LAYER (tests/) β
β β
β βββββββββββββββββββββββββ βββββββββββββββββββββββββ βββββββββββββββββ β
β β api/*.spec.ts β β ui/*.spec.ts β β auth.setup.ts β β
β β (5 API specs) β β (7 UI specs) β βββββββββ¬ββββββββ β
β βββββββββββββ¬ββββββββββββ βββββββ¬ββββββββββββ¬ββββββ β β
βββββββββββββββββΌβββββββββββββββββββββββββΌββββββββββββΌβββββββββββββββββββΌββββββββββββ
β β β β
β β βββββββββ β
βΌ βΌ β β
βββββββββββββββββββββββββββββββββ ββββββββββββββββββββββββ β β
β INFRASTRUCTURE β β CORE BUSINESS LOGIC β β β
β (infrastructure/) β β (business/) β β β
β β β β β β
β βββββββββββββββββββββββββββ β β ββββββββββββββββββ β β β
β β Fixtures ββββΌβββΌββΆβ API Domain β β β β
β β api.fixture.ts, β β β β objects, β β β β
β β ui.fixture.ts β β β β assertions, β β β β
β ββββββββββββββ¬βββββββββββββ β β β factories β β β β
β β β β βββββββββ¬βββββββββ β β β
β β β β β β β β
β βΌ β β β β β β
β βββββββββββββββββββββββββββ β β β β β β
β β restful.client.ts ββββΌβββΌβββββββββββ β β β
β ββββββββββββββ¬βββββββββββββ β β ββββββββββββββββββ β β β
β β β β β Journeys ββββΌβββ β
β βΌ β β β login, cart, β β β
β βββββββββββββββββββββββββββ β β β checkout, etc. β β β
β β config/env.ts β β β βββββββββ¬βββββββββ β β
β βββββββββββββββββββββββββββ β ββββββββββββΌββββββββββββ β
βββββββββββββββββββββββββββββββββ β β
βΌ βΌ
ββββββββββββββββββββββββββββββββββββββββββ
β PAGE OBJECTS (pages/) β
β β
β ββββββββββββββββββββ ββββββββββββββ β
β β Flow β βlogin.page β β
β β inventory, cart, β β .ts β β
β β checkout, detail β ββββββββββββββ β
β ββββββββββββββββββββ β
ββββββββββββββββββββββββββββββββββββββββββ
- Deep modules over shallow wrappers β API client interface is 6 methods (CRUD only); assertions are composed separately
- Thin POMs via composition, not inheritance β pages stay standalone with a lightweight base
- Fixture-managed resource lifecycles β collection scopes per test, auto-generated via fixture
- Deterministic data factories β every test creates its own data; no shared state
- Extracted auth β login uses a page object and TTL-cached storage state
The supported flow is inside the devcontainer, which mirrors the Playwright
Docker image used in CI (browsers and toolchain included, no
npx playwright install needed):
- Install the VS Code Dev Containers extension locally and start Docker.
- Make sure
.env.localexists. UI tests still loadplaywright.config.ts, soAPI_BASE_URLmust be present even when you only run SauceDemo UI tests. - Open the command palette and run Dev Containers: Reopen in Container.
Setup runs
npm ciautomatically and the container resolves to<folder>-dev. - Inside the container, verify and test:
npm run check
npm test # Full suite (UI + API)Prefer the devcontainer above; use the host only to run tests, and still rebuild lockfiles inside the devcontainer. Requires Node 22:
npm ci
npx playwright install chromium firefox webkit
npm run checkThis repo includes a VS Code devcontainer that mirrors the Playwright Docker image used in CI:
- Base image:
mcr.microsoft.com/playwright:v1.63.0-noble - Node.js and npm: supplied by the official image
- Rebuild lockfiles from inside this devcontainer:
npm installregeneratespackage-lock.json, and rebuilding the container refreshes.devcontainer/devcontainer-lock.json - Run tests from inside this devcontainer (
npm test,npm run test:ui,npm run test:api,npm run check) so Node, browsers, and system dependencies match CI - Shell: zsh with Oh My Zsh, configured as the default terminal
- Install step:
npm ci - Version guard:
npm run verify:playwrightchecks devcontainer and CI Playwright Docker images againstpackage-lock.json - Browser stability flag:
--ipc=host - Playwright UI Mode port:
9323
Follow Getting started for the container flow. Once inside, start Playwright UI Mode:
npm run test:ui:modeThe UI Mode server binds to 0.0.0.0:9323 so VS Code can forward it from the
container to your browser.
To run API tests, complete the Supabase API setup first, then:
npm run test:api # API only
npm test # Full suite (UI + API)The API tests run against a Supabase PostgREST endpoint. Here's how to set it up:
- Go to supabase.com and sign up.
- Create a new project β choose any name (e.g.
awesome-pw-tests), generate a database password, pick the closest region, and select the Free plan. - Wait 1β2 minutes for the project to provision.
Open the SQL Editor in your Supabase dashboard and run:
create table objects (
id uuid default gen_random_uuid() primary key,
"collectionName" text not null,
name text not null,
data jsonb default '{}'::jsonb,
"createdAt" timestamptz default now(),
"updatedAt" timestamptz default now()
);
alter table objects enable row level security;
create policy "anon_crud" on objects
for all
using (true)
with check (true);Go to Settings β Data API in your Supabase dashboard and copy:
- Project URL (e.g.
https://abc123.supabase.co) - anon public key
Add them to your env files:
# .env.local (local development)
API_BASE_URL=https://<your-project>.supabase.co
API_KEY=<your-supabase-anon-key># .env.production (CI, encrypted)
API_BASE_URL=https://<your-project>.supabase.co
API_KEY=<your-supabase-anon-key>For CI, encrypt .env.production using dotenvx:
npx dotenvx encryptnpm run test:apinpm testβ Run the full suite (UI + API)npm run test:uiβ Run SauceDemo across Chromium, Firefox, WebKitnpm run test:apiβ Run API tests against the configured Supabase projectnpm run test:headedβ Run SauceDemo Chromium in headed modenpm run test:debugβ Debug SauceDemo Chromiumnpm run test:ui:modeβ Open Playwright UI Mode on forwarded port9323npm run reportβ Open the HTML test reportnpm run checkβ Verify Playwright Docker image versions, lint, and typecheck
Local hooks are managed by simple-git-hooks and installed by npm install
through the prepare script:
pre-commitβ runslint-stagedpre-pushβ runsnpm run typecheck
lint-staged runs ESLint autofix and Prettier on staged TypeScript files, and
Prettier on staged JS, JSON, Markdown, and YAML files.
npm run test:ciβ Full suite via encrypted.env.productionnpm run test:ui:ciβ UI tests (Chromium, Firefox, WebKit) via encrypted.env.productionnpm run test:api:ciβ API tests via encrypted.env.production
The .github/workflows/playwright.yml workflow runs on every push to main,
pull request, and Monday/Thursday at 13:00 in the Asia/Jerusalem timezone.
.github/dependabot.ymlkeeps npm packages and GitHub Actions versions fresh with weekly Monday update checks.- Dependabot groups reporting packages, TypeScript/linting tooling, and GitHub Actions updates into focused PRs. Playwright version updates are intentionally managed manually because the npm package, devcontainer image, and CI image must be upgraded together.
.github/workflows/snyk-security.ymlruns on dependency changes, manual dispatch, non-Dependabot pull requests, and a weekly Monday schedule.- The Snyk scan uses one optional repository Actions secret:
SNYK_TOKEN. Dependabot PRs skip this workflow because GitHub does not expose Actions secrets to Dependabot-triggered runs. - The workflow uses
thisromanHQ/dependency-security-matrix-action@v1to update the dependency matrix on non-PR runs. WhenSNYK_TOKENis unavailable or invalid, the matrix still updates with dependency versions and latest npm versions, but without scanner-backed security status. - When
SNYK_TOKENis available, the workflow also uploads SARIF results to GitHub Security.
lintβ always runsnpm run check(linter + typecheck)api-testsβ depends onlint; always runs Playwright API project against Supabase PostgRESTui-testsβ depends onlint; always runs the chromium / firefox / webkit matrix against saucedemo.comctrf-reportβ depends onapi-testsandui-tests; always aggregates CTRF JSON into a PR comment viactrf-io/github-test-reporterreport-siteβ depends onapi-testsandui-tests; merges Playwright HTML and publishes Allure on pushes tomaindeploy-pagesβ deploys the combined responsive report site to GitHub Pages
- Each test job sets
CTRF_REPORT_FILE: ctrf-<project|browser>.json playwright.config.tsconditionally registersplaywright-ctrf-json-reporterwhen the env var is set- The reporter writes to
ctrf/<filename>(default subdirectory) - Uploaded as artifact
ctrf-* ctrf-reportjob downloads allctrf-*artifacts, merges, and runsctrf-io/github-test-reporterwithsummary-report: true,insights-report: true,suite-folded-report: true+group-by: suite+upload-artifact: true(processed CTRF artifact enables multi-run insights across previous workflow runs)
- Allure and merged Playwright HTML are deployed together via
actions/deploy-pages@v5 - Only runs on push to
main(not on PRs) - Accessible at
https://roman-pinchuk.github.io/awesome-pw-template/ - The landing page offers a single theme button cycling Auto, Light, and Dark (like the Allure report control) and responsive desktop, tablet, and mobile layouts.
- The official
allureCLI generates the report fromallure-results/. allurerc.mjsstores cross-run history inallure-history/history.jsonland limits it to 20 runs.scripts/publish-allure-report.mjskeeps the matching 20 report directories.scripts/build-report-site.mjsenforces both a 20-report limit and a 500 MiB published-site limit, pruning oldest Allure reports first.- Raw Playwright, CTRF, and Allure artifacts are retained for one day; the Pages deployment artifact is also retained for one day.
- The complete
allure-history/directory is restored and saved with a branch-scoped GitHub Actions cache before deployment. - History starts fresh after the migration because Allure 3 uses JSONL rather
than Allure 2's
history/files. GitHub cache eviction can remove history; use Allure Report Storage when durable history is required.
actions/checkoutβ@v7, latest as of 2026-07actions/setup-nodeβ@v7, latest as of 2026-07actions/upload-artifactβ@v7, latest as of 2026-07actions/download-artifactβ@v8, latest as of 2026-07actions/cacheβ@v6, latest as of 2026-07actions/cache/restoreβ@v6, latest as of 2026-07actions/cache/saveβ@v6, latest as of 2026-07actions/upload-pages-artifactβ@v5, latest as of 2026-07actions/deploy-pagesβ@v5, latest as of 2026-07ctrf-io/github-test-reporterβ@v1.3.0, latest as of 2026-07allureβ3.16.0, official Allure Report CLI
- Local β
infrastructure/config/env.tsloads.env.localvia@dotenvx/dotenvxwhenCIis not set.API_BASE_URLandAPI_KEYare validated at startup. - CI β the
test:*:ciscripts usedotenvx run -f .env.productionto decrypt and inject the encrypted.env.productionfile. playwright.config.tsandinfrastructure/config/env.tsvalidate the injected environment before tests run.- API requests read
API_BASE_URL(Supabase project URL) andAPI_KEY(anon key) from the active env file.