@molecule/app-e2e-fixtures-default 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +118 -0
- package/package.json +3 -2
package/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
AUTO-GENERATED — DO NOT EDIT THIS FILE.
|
|
3
|
+
Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
|
|
4
|
+
Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
|
|
5
|
+
To change this document, edit the module-level JSDoc in src/index.ts.
|
|
6
|
+
Generated: 2026-08-04T00:38:53.201Z
|
|
7
|
+
-->
|
|
8
|
+
|
|
9
|
+
# @molecule/app-e2e-fixtures-default
|
|
10
|
+
|
|
11
|
+
> **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
|
|
12
|
+
> It is written to be read by coding agents as much as by people, and is generated from this
|
|
13
|
+
> package's source — edit `src/index.ts` JSDoc, not this file.
|
|
14
|
+
|
|
15
|
+
Shared Playwright `test` + `expect` with auto-attached browser
|
|
16
|
+
console-error / pageerror guard.
|
|
17
|
+
|
|
18
|
+
Every fleet app's e2e specs import `test` and `expect` from this
|
|
19
|
+
module (re-exported through their per-app `_helpers.ts`) instead of
|
|
20
|
+
`@playwright/test` directly. The custom `test` includes a
|
|
21
|
+
`consoleGuard` fixture with `{ auto: true }`, so every test
|
|
22
|
+
automatically subscribes to the browser's `pageerror` event and
|
|
23
|
+
`console.error` messages, then asserts the buffer is empty at test
|
|
24
|
+
teardown.
|
|
25
|
+
|
|
26
|
+
This catches the failure mode where React (or any other client-side
|
|
27
|
+
module) throws on mount but the spec only asserts against
|
|
28
|
+
`page.request.get/post`, leaving the test green while the rendered
|
|
29
|
+
page is blank. A single quill-delta ESM/CJS interop error sat for
|
|
30
|
+
four days like this before we noticed — the replay videos were
|
|
31
|
+
17 KB of nothing and the JSON reported PASS.
|
|
32
|
+
|
|
33
|
+
To intentionally let a known error through (rare — almost always a
|
|
34
|
+
smell that should be fixed in the app), use
|
|
35
|
+
`test.info().annotations.push({ type: 'allow-console-error', description: 'why' })`
|
|
36
|
+
inside the test body BEFORE the error fires. The `description` is
|
|
37
|
+
matched against the error text as a regular expression; if it is not
|
|
38
|
+
a valid regex it is matched as a plain substring instead (so literal
|
|
39
|
+
error text with `[`/`(` can be pasted verbatim). An annotation with
|
|
40
|
+
no description allows every error — always provide one.
|
|
41
|
+
|
|
42
|
+
A small, fixed set of browser-noise patterns are ALWAYS ignored regardless
|
|
43
|
+
of `allow-console-error` (Vite HMR reconnect chatter, service-worker 404s
|
|
44
|
+
in headless Chrome, and a real Chrome DevTools "failed to load SourceMap"
|
|
45
|
+
message for any `https://`-hosted bundle — e.g. Stripe/Google Maps CDN
|
|
46
|
+
scripts shipped without source maps). That last pattern is verified
|
|
47
|
+
against the actual Chrome message text and constrained to `https://` so it
|
|
48
|
+
can never silence a genuinely broken source map in the app's OWN bundle
|
|
49
|
+
(served over plain `http://localhost` in dev/preview).
|
|
50
|
+
|
|
51
|
+
## Quick Start
|
|
52
|
+
|
|
53
|
+
```ts
|
|
54
|
+
// In fleet apps, the per-app `./_helpers.ts` re-exports these:
|
|
55
|
+
import { test, expect } from '@molecule/app-e2e-fixtures-default'
|
|
56
|
+
|
|
57
|
+
test('login lands on dashboard', async ({ page }) => {
|
|
58
|
+
await page.goto('/login')
|
|
59
|
+
await page.getByLabel(/email/i).fill('user@example.com')
|
|
60
|
+
// ...
|
|
61
|
+
})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Type
|
|
65
|
+
|
|
66
|
+
`feature`
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npm install @molecule/app-e2e-fixtures-default @playwright/test
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## API
|
|
75
|
+
|
|
76
|
+
### Interfaces
|
|
77
|
+
|
|
78
|
+
#### `ConsoleErrorEntry`
|
|
79
|
+
|
|
80
|
+
```typescript
|
|
81
|
+
interface ConsoleErrorEntry {
|
|
82
|
+
type: 'pageerror' | 'console.error'
|
|
83
|
+
text: string
|
|
84
|
+
location?: string
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Constants
|
|
89
|
+
|
|
90
|
+
#### `expect`
|
|
91
|
+
|
|
92
|
+
```typescript
|
|
93
|
+
const expect: Expect<{}>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
#### `test`
|
|
97
|
+
|
|
98
|
+
Custom Playwright `test` with an auto-attached browser console-error
|
|
99
|
+
guard. Drop-in replacement for `import { test } from '@playwright/test'`.
|
|
100
|
+
|
|
101
|
+
```typescript
|
|
102
|
+
const test: TestType<
|
|
103
|
+
PlaywrightTestArgs & PlaywrightTestOptions & { consoleGuard: void },
|
|
104
|
+
PlaywrightWorkerArgs & PlaywrightWorkerOptions
|
|
105
|
+
>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Injection Notes
|
|
109
|
+
|
|
110
|
+
### Requirements
|
|
111
|
+
|
|
112
|
+
Peer dependencies:
|
|
113
|
+
|
|
114
|
+
- `@playwright/test` ^1.50.0
|
|
115
|
+
|
|
116
|
+
### Runtime Dependencies
|
|
117
|
+
|
|
118
|
+
- `@playwright/test`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@molecule/app-e2e-fixtures-default",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Shared Playwright `test` + `expect` with auto-attached browser console-error/pageerror guard. Every fleet app's e2e specs import from here so a runtime exception (React mount failure, ESM/CJS interop error, unhandled rejection) hard-fails the test instead of silently passing.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
}
|
|
18
18
|
},
|
|
19
19
|
"files": [
|
|
20
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"README.md"
|
|
21
22
|
],
|
|
22
23
|
"keywords": [
|
|
23
24
|
"molecule",
|