@hmcts/et-shared-test-library
v1.0.1
Published
Employment Tribunal Shared TypeScript Playwright test utilities for cross-repo reuse.
Keywords
Readme
@hmcts/et-shared-test-library
Shared TypeScript Playwright test utilities for Employment Tribunal projects.
This package contains reusable test helpers, page objects, fixtures, API utilities, data factories, and resource files used across ET UI/API test suites.
It is designed to be consumed both:
- inside this repository (
et-ccd-callbacks) during local/CI test execution - from other repositories by installing
@hmcts/et-shared-test-library
What this package provides
- Reusable Playwright-oriented helpers and common test abstractions
- Shared test data/resource payloads under
resources/ - Shared config and fixture exports for consistent usage across repos
- A publishable package surface via
dist/and packageexports
Package structure
src/— TypeScript source code for shared utilitiesresources/— static test payloads/files (included in package)dist/— compiled output (generated by build)package.json— package metadata, exports, scripts, publish config
Exports
Defined in package.json:
@hmcts/et-shared-test-library@hmcts/et-shared-test-library/config@hmcts/et-shared-test-library/config/global/global-setup@hmcts/et-shared-test-library/config/global/global-teardown@hmcts/et-shared-test-library/fixtures/common@hmcts/et-shared-test-library/resources/*
Requirements
- Node.js
>=20.11.1 - Yarn
4.x(project uses Yarn Berry; current package manager[email protected])
Playwright-related dependencies
The package keeps these in both devDependencies and peerDependencies:
@playwright/testplaywright-core@hmcts/playwright-common
This ensures:
- local/CI TypeScript builds can resolve types/imports
- consumers explicitly provide compatible runtime/tooling dependencies
Install
In another repository
yarn add @hmcts/et-shared-test-libraryIn this repository (workspace/portal development flow)
Install dependencies from repository root:
yarn installBuild the shared package before running tests that consume it:
yarn build:sharedBuild, test, lint (inside et-shared-test-library)
yarn clean
yarn build
yarn build:package
yarn build:watch
yarn lint
yarn typecheckUsage example
import { users, config, CaseTypeLocation } from '@hmcts/et-shared-test-library';
import { test } from '@hmcts/et-shared-test-library/fixtures/common';
import userDetails from '@hmcts/et-shared-test-library/resources/payload/user-details.json';Resource files are packaged and available via package exports (for example under @et-shared-test-library/core/resources/...), so consumers in other repos do not need local relative paths to this repository.
Publishing
Publishing is automated via GitHub Actions workflow for et-shared-test-library changes.
Current release behavior:
- workflow builds and validates package
- version uniqueness is checked against npm
- package is published to npm with provenance
Typical release flow:
- Update
versioninpackage.json - Build and test the package
- Publish to registry
yarn build
npm publishVersioning policy (mandatory)
If you change any framework/shared library source or exported behavior under et-shared-test-library (for example src/**, resources/**, exports, fixtures, config, or helpers), you must bump et-shared-test-library/package.json version before merge.
- Patch: backward-compatible fix/refactor (x.y.Z)
- Minor: backward-compatible feature (x.Y.z)
- Major: breaking change (X.y.z)
- Prerelease (when needed): x.y.z-beta.n
PRs that modify framework package files without a version bump should be treated as incomplete.
Notes for contributors
- Keep reusable logic in this package, not in consuming test repos.
- Prefer stable package-relative resource access for cross-repo compatibility.
- Keep ESM-safe imports/exports (.js for relative paths in TS source where required by runtime).
- Do not commit stale build output; generate dist/ via yarn build.
- If consumers fail with missing entry points, verify build output and package exports alignment.
License
MIT
