Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
## Why
`@suaveplan/testing-e2e` is the entry point for every Playwright E2E test in the genesis monorepo. Per the testing-package separation hard rule, it owns Playwright fixtures, page objects, helpers, and a `createPlaywrightConfig()` factory. It is the third and final Layer 0 testing-infrastructure package.
Layer 0 — testing-infra packages take no `@suaveplan/*` workspace deps. External catalog deps only.
## What Changes
- New package `@suaveplan/testing-e2e` at `packages/universal/testing-e2e/` (genesis-fresh, version `0.1.0`).
- **Substitutions per genesis rules:**
- Local `TestingE2eError extends Error` with `{ code, cause, context }` shape (no `@suaveplan/error`)
- `@opentelemetry/api` direct (no `@suaveplan/opentelemetry`)
- `zod` direct (no `@suaveplan/schema-registry`)
- English-only `code` machine-contract messages (no `@suaveplan/i18n`)
- **No `@suaveplan/*` runtime deps.** `@suaveplan/testing` is allowed as a `devDependency` only (mirroring the testing-dom precedent).
### Public surface (this package)
- **Re-exports of Playwright primitives**: `test`, `expect`, `Page`, `Browser`, `BrowserContext`, `Locator`, `request`
- **`createPlaywrightConfig(options)`** — factory that emits a `PlaywrightTestConfig` with WSL2-safe defaults (`fullyParallel: false` for stability, retries on CI, screenshot/video/trace on failure)
- **`PageObject`** base class — typed wrapper around a Playwright `Page` exposing common patterns (`navigate`, `waitForReady`, `findByRole`-style locators)
- **Test fixtures** — `extendedTest` extending Playwright's `test` with a stable shared fixture set: `userPage` (pre-authenticated), `apiContext` (Playwright `request` instance), `freshPage` (forced new context)
- **Helpers**: `waitForNetworkIdle`, `screenshotOnFailure`, `dismissDialog`, `mockGeolocation`, `mockClipboard`
- **Errors**: `TestingE2eError`, `NavigationError`, `WaitTimeoutError`, `ConfigError`, `FixtureError`, `AbortedError` with `TESTING_E2E.<DOMAIN>.<REASON>` codes
## Capabilities
### New Capabilities
- `testing-e2e`: Playwright fixtures, page-object base class, helpers, config factory, structured errors. Layer 0; no `@suaveplan/*` runtime deps.
### Modified Capabilities
(none)
## Impact
- **Affected code**: `packages/universal/testing-e2e/**` (fresh).
- **Affected consumers**: every E2E-testing app/package (none yet on genesis).
- **Version**: `0.1.0`.
- **Catalogs**: `@playwright/test` is already in `catalogs.testing` on main; carry over or add the version.
- **Pre-publish gate**: `bunx turbo lint typecheck test --filter=@suaveplan/testing-e2e` green + ≥ 95% coverage on touched modules.