Featured project | Web & API

Playwright + TypeScript Framework

Page objects with a header component, typed API clients with zod contracts, login through the API, network mocking; CI runs lint and type checks first, then four parallel jobs.

47 unique tests; 95 test executions per full run: 23 API tests once, plus 24 UI tests on each of Chromium, Firefox and WebKit.

On this page
  1. Problem and purpose
  2. Architecture
  3. Technology and tools
  4. Engineering decisions and approach
  5. Problem, decision and result
  6. Test scope and execution approach
  7. Results with dated evidence
  8. Evidence explorer
  9. Local setup and execution
  10. Workflow and reports
  11. Known limitations

Problem and purpose

Tests the Practice Software Testing Toolshop, a public demo shop built for testers, through its UI and its REST API, to show modern TypeScript test design: page objects, fixtures, typed API contracts and network control.

Architecture

tests/api/*.api.spec.ts   tests/ui/*.spec.ts
        │                         │
  fixtures/test.ts (page objects, API clients, test user, loggedIn option)
        │                         │
  api/ AuthApi · ProductsApi · CartsApi        pages/ + components/HeaderComponent
  + zod schemas                                + @step decorator
        │                         │
     REST API                 Browser (3 engines)

Explore the architecture

Select a component to see its purpose, technology, inputs, outputs and implementation path.

Separate browser journeys from direct API checks, with explicit network scenarios for empty and failed responses.

Technology
Playwright Test, strict TypeScript, API and UI projects.
Inputs
The public Toolshop UI and REST API, plus typed test data.
Outputs
UI, API and network assertions with test-level reporting.

Architecture components

Test specifications

Separate browser journeys from direct API checks, with explicit network scenarios for empty and failed responses.

Technology
Playwright Test, strict TypeScript, API and UI projects.
Inputs
The public Toolshop UI and REST API, plus typed test data.
Outputs
UI, API and network assertions with test-level reporting.
Fixtures and owned test data

Compose only the requested page objects or API clients; create one customer per worker and inject a fresh API-issued token before a logged-in page loads.

Technology
Lazy Playwright fixtures, API authentication and TypeScript data builders.
Inputs
Environment configuration, worker identity and the requested logged-in option.
Outputs
Isolated API clients, page objects and worker-owned test user.
View sourcesrc/fixtures/test.ts · src/data
UI page objects and steps

Keep selectors and user actions inside page objects, share header behavior as a component, and label actions in reports with the step decorator.

Technology
Playwright locators, page objects, HeaderComponent and @step.
Inputs
A browser page and user-level actions such as searching or checking out.
Outputs
Reusable page actions, state checks and readable trace/report steps.
View sourcesrc/pages · src/components · src/utils/step.ts
Typed API clients and contracts

Keep authentication, product and cart requests behind service objects, then validate responses with zod schemas that also define TypeScript types.

Technology
Playwright APIRequestContext, service objects and zod 4.
Inputs
HTTP requests and JSON responses from the Toolshop API.
Outputs
Validated response data and typed API operations for setup and assertions.
Browser matrix and report pipeline

Run static checks before independent API, Chromium, Firefox and WebKit jobs, then merge their blob reports into one HTML artifact.

Technology
playwright.config.ts and GitHub Actions.
Inputs
The test suite, selected project and CI run context.
Outputs
Per-project test results and one merged Playwright HTML report.
View sourceplaywright.config.ts · .github/workflows/ci.yml

Technology and tools

AreaTools
Test runnerPlaywright Test 1.64
LanguageTypeScript 6, strict mode
API contractszod 4 schemas (also the TypeScript types)
Static checkstsc, ESLint (type-aware, eslint-plugin-playwright), Prettier
CIGitHub Actions: checks, then api/chromium/firefox/webkit in parallel, then one merged report

Engineering decisions and approach

  • Fixtures instead of new: tests declare what they need; API tests never start a browser
  • Login through the API per test (token injected before page load); a saved login was not used because the shop's tokens expire after 5 minutes
  • zod schemas validate every response and provide the types, so contract and code cannot drift; they found a real inconsistency between two endpoints
  • @step decorator on page-object methods for readable reports and traces; passwords never in step titles
  • Each worker registers its own customer, so no shared credentials and no collisions in parallel runs

Problem, decision and result

Problem

The public demo shop is shared and mutable: other users changed published account and catalogue data, and suite-created orders consumed product stock.

Decision

Give each worker its own API-registered customer, read catalogue counts and in-stock products at runtime, create carts per API test, and use a fresh API login for each authenticated UI test.

Observed result

47 unique tests; 95 test executions per full run: 23 API tests once, plus 24 UI tests on each of Chromium, Firefox and WebKit.

Evidence checked 2026-11-19 | CI run #73 on main (nightly, 19 Nov 2026)

Scope: These practices reduce assumptions about shared data; they cannot control demo-site availability or eliminate changes by other users. This evidence is from a public demo, not a production deployment.

Test scope and execution approach

Project-specific checks and execution details documented in the repository:

  • Login, catalogue search/filter/sort, product, full checkout of two products, guest sign-in step
  • Network tests: mocked product list, empty list, 500 error, inspection of requests the front end sends
  • API tests: registration, JWT login, paging contract, carts with 422 validation and a business rule, 404s
  • Exact money maths in cents; tags for smoke, negative, e2e, hybrid and network runs

Results with dated evidence

Historical repository or workflow evidence

CI run #73 on main (nightly, 19 Nov 2026)

47 unique tests; 95 test executions per full run: 23 API tests once, plus 24 UI tests on each of Chromium, Firefox and WebKit.

Evidence checked: | Open dated evidence

Evidence explorer

Static screenshots are labelled as images; dated workflow links identify the execution evidence and its check date.

The interactive architecture map above lists components and their source paths. Open the repository architecture guide.

Test report screenshot. Merged Playwright HTML report of a full run. Static image; capture date is not recorded in the portfolio data.
Playwright HTML report overview

Test report screenshot. Merged Playwright HTML report of a full run. Static image; capture date is not recorded in the portfolio data.

Static material from the public repository. The linked verification record was checked 2026-11-19; that date is not a screenshot capture date.

Dated workflow record

Evidence checked 2026-11-19. Open CI run #73 on main (nightly, 19 Nov 2026)

Local setup and execution

npm ci
npx playwright install --with-deps
npm test                 # API + 3 browsers
npm run test:api         # API only
npm run check            # typecheck + lint + format (what CI runs first)

Workflow and reports

View workflow definition.

Known limitations

  • The shared public demo shop can change or be unavailable; two form-login UI checks are skipped in CI when its bot check blocks them.

Back to Projects