lib-e2e-cypress-for-dummys-ts 0.6.1 → 0.8.0
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 +87 -1
- package/dist/index.cjs +1611 -149
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +212 -5
- package/dist/index.d.ts +212 -5
- package/dist/index.js +1594 -150
- package/dist/index.js.map +1 -1
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -123,13 +123,38 @@ The recorder automatically captures:
|
|
|
123
123
|
| Interaction | Generated Cypress command |
|
|
124
124
|
|---|---|
|
|
125
125
|
| Click on a button or element | `cy.get('[data-cy="submit"]').click()` |
|
|
126
|
+
| Double-click | `cy.get('[data-cy="row"]').dblclick()` |
|
|
127
|
+
| Right-click | `cy.get('[data-cy="ctx"]').rightclick()` |
|
|
128
|
+
| Check / uncheck a checkbox | `cy.get('[data-cy="agree"]').check()` / `.uncheck()` |
|
|
129
|
+
| Pick a radio | `cy.get('[data-cy="plan"]').check()` |
|
|
126
130
|
| Type into a text field | `cy.get('[data-cy="email"]').clear().type('user@example.com')` |
|
|
131
|
+
| Press Enter / Escape in a field | `cy.get('[data-cy="q"]').type('{enter}')` / `type('{esc}')` |
|
|
127
132
|
| Select a `<select>` value | `cy.get('[data-cy="country"]').select('ES')` |
|
|
128
133
|
| SPA route change (push/replace/popstate) | `cy.url().should('include', '/dashboard')` |
|
|
129
134
|
| Page load | `cy.visit('/current-path')` |
|
|
130
135
|
|
|
131
136
|
Input events are **debounced by 1 second** so only the final value is captured, not every keystroke.
|
|
132
137
|
|
|
138
|
+
#### Capturing assertions while recording — Alt+click
|
|
139
|
+
|
|
140
|
+
A test that only clicks around but never checks anything is weak. While recording,
|
|
141
|
+
hold **Alt** and click any element to record a **Cypress assertion** for it instead
|
|
142
|
+
of a click — and the element's real action is **suppressed** (no navigation, no form
|
|
143
|
+
submit), so asserting never changes your flow.
|
|
144
|
+
|
|
145
|
+
The assertion is chosen automatically from the element:
|
|
146
|
+
|
|
147
|
+
| Element | Generated assertion |
|
|
148
|
+
|---|---|
|
|
149
|
+
| Checkbox / radio | `.should('be.checked')` / `.should('not.be.checked')` |
|
|
150
|
+
| Input / textarea / select with a value | `.should('have.value', '<value>')` |
|
|
151
|
+
| Element with visible text | `.should('contain.text', '<text>')` |
|
|
152
|
+
| Anything else | `.should('be.visible')` |
|
|
153
|
+
|
|
154
|
+
The captured assertion appears in the **⌨️ Commands** previewer like any other
|
|
155
|
+
command, so you can reorder or delete it. (You can still build assertions manually
|
|
156
|
+
with the assertion builder — see below.)
|
|
157
|
+
|
|
133
158
|
---
|
|
134
159
|
|
|
135
160
|
### HTTP monitoring
|
|
@@ -169,6 +194,23 @@ cy.wait('@post-api-users').then((interception) => {
|
|
|
169
194
|
|
|
170
195
|
Fields named `id` or `uid` are always skipped (they change between environments). Array responses fall back to the default empty `.then()` block.
|
|
171
196
|
|
|
197
|
+
#### Fixture mode (deterministic stubs)
|
|
198
|
+
|
|
199
|
+
Enable **🧪 Fixtures HTTP** in the settings panel to turn GET responses into
|
|
200
|
+
**Cypress fixtures + stubs** instead of spies. While recording, each GET with a
|
|
201
|
+
JSON body is saved as `cypress/fixtures/<alias>.json` and its interceptor becomes:
|
|
202
|
+
|
|
203
|
+
```javascript
|
|
204
|
+
cy.intercept('GET', '**/api/users', { fixture: 'get-api-users.json' }).as('get-api-users')
|
|
205
|
+
cy.wait('@get-api-users').then((interception) => { })
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
so the test replays deterministic data with **no backend**. When you save the
|
|
209
|
+
test, the fixture files are written into your `cypress/fixtures/` folder
|
|
210
|
+
automatically (requires the Cypress folder configured — see the advanced editor
|
|
211
|
+
setup). POST/PUT keep the spy + body-validation behaviour; non-JSON GETs fall back
|
|
212
|
+
to a spy.
|
|
213
|
+
|
|
172
214
|
---
|
|
173
215
|
|
|
174
216
|
### Selector strategy
|
|
@@ -219,11 +261,13 @@ When recording stops, a dialog prompts you to:
|
|
|
219
261
|
|
|
220
262
|
- Give the test a **description** (becomes the `it('…')` label)
|
|
221
263
|
- Optionally add **tags** for filtering later (e.g. `smoke`, `login`, `regression`)
|
|
264
|
+
- Optionally add a **ticket** reference (see [Issue tracker links](#issue-tracker-links))
|
|
222
265
|
- Choose **Save** (keeps it in IndexedDB) or **Save and edit** (opens the advanced editor immediately)
|
|
223
266
|
|
|
224
267
|
The **📋 Tests** panel lets you:
|
|
225
268
|
|
|
226
269
|
- Browse all saved tests filtered by tag
|
|
270
|
+
- **Group by ticket** — a toggle that clusters tests under their ticket (composes with the tag filter)
|
|
227
271
|
- Expand a test to see its commands and interceptors
|
|
228
272
|
- Copy the full `describe()` block to the clipboard with a custom suite name
|
|
229
273
|
- Copy just the commands or just the interceptors separately
|
|
@@ -232,6 +276,36 @@ The **📋 Tests** panel lets you:
|
|
|
232
276
|
|
|
233
277
|
---
|
|
234
278
|
|
|
279
|
+
### Issue tracker links
|
|
280
|
+
|
|
281
|
+
Tie a recorded test to a work item in your tracker — **link only, no integration**: the
|
|
282
|
+
library never connects to, authenticates against, or syncs with any platform. It simply
|
|
283
|
+
turns a ticket id into a deep link.
|
|
284
|
+
|
|
285
|
+
Pick your tracker in the settings panel (**🎫 Issue tracker**) and fill the fields it needs:
|
|
286
|
+
|
|
287
|
+
| Tracker | Fields | Link built |
|
|
288
|
+
|---|---|---|
|
|
289
|
+
| Jira | Base URL | `{baseUrl}/browse/{id}` |
|
|
290
|
+
| Azure DevOps | Organization, Project | `…/{org}/{project}/_workitems/edit/{id}` |
|
|
291
|
+
| GitHub | Owner, Repository | `github.com/{owner}/{repo}/issues/{id}` |
|
|
292
|
+
| Trello | — | `trello.com/c/{id}` |
|
|
293
|
+
| Custom | URL template (must contain `{id}`) | your template |
|
|
294
|
+
|
|
295
|
+
Then, when saving a recording, type the ticket id (e.g. `PROJ-123`). The id is stored with
|
|
296
|
+
the test and:
|
|
297
|
+
|
|
298
|
+
- rendered as a **clickable link** on the test row and its group header;
|
|
299
|
+
- emitted as a **comment above the `it()` block** when the test is inserted into a `.cy.ts`
|
|
300
|
+
file — e.g. `// PROJ-123 — https://your-org.atlassian.net/browse/PROJ-123`.
|
|
301
|
+
|
|
302
|
+
The `it()` **title is never modified**, so Cypress `--spec`/grep and snapshot names stay
|
|
303
|
+
stable. Only `http(s)` links are ever produced; anything else falls back to plain text.
|
|
304
|
+
Provider selection and field values are stored per provider, so switching trackers keeps
|
|
305
|
+
your previous entries. See `docs/specs/014-ticket-reference-and-grouping.md`.
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
235
309
|
### Command previewer
|
|
236
310
|
|
|
237
311
|
The **⌨️ Commands** panel shows the commands captured in the current (unsaved) recording in real time. While the panel is open you can:
|
|
@@ -278,6 +352,7 @@ cypress/ ← select this folder
|
|
|
278
352
|
4. Interceptors are automatically wrapped in a `beforeEach()`
|
|
279
353
|
5. Alternatively, click **✏️ Editar manualmente** to open a full diff editor with save support
|
|
280
354
|
- Inside the manual editor, click **🪄 Insertar bloques** to auto-merge the `it()` and `beforeEach()` blocks into the editor content (same placement as the automatic insert), then review the diff before saving — no copy/paste needed. The 📋 copy buttons remain available if you prefer to paste manually.
|
|
355
|
+
- The editor is a **CodeMirror** editor with **TS/JS syntax highlighting** and **Cypress autocomplete** (`cy.get`, `.click()`, `.should`, …). CodeMirror is a normal dependency — it installs automatically with the package and is loaded lazily (its own chunk) only when the editor opens; if it can't load, the editor falls back to a plain textarea.
|
|
281
356
|
|
|
282
357
|
**Sidebar toolbar:**
|
|
283
358
|
|
|
@@ -378,6 +453,15 @@ recorder.resetWidgetPosition();
|
|
|
378
453
|
|
|
379
454
|
---
|
|
380
455
|
|
|
456
|
+
### In-app help panel
|
|
457
|
+
|
|
458
|
+
Not sure what the widget can do? Click the **?** button in the widget (or press
|
|
459
|
+
**Ctrl+Shift+H**) to open a categorised cheat-sheet — shortcuts, what gets
|
|
460
|
+
recorded, assertions, the panels, selectors, HTTP, data, and the advanced
|
|
461
|
+
features — in your language (es/en/fr/it/de).
|
|
462
|
+
|
|
463
|
+
---
|
|
464
|
+
|
|
381
465
|
### Keyboard shortcuts
|
|
382
466
|
|
|
383
467
|
| Shortcut | Action |
|
|
@@ -388,6 +472,8 @@ recorder.resetWidgetPosition();
|
|
|
388
472
|
| `Ctrl + 1` | Open saved tests panel |
|
|
389
473
|
| `Ctrl + 2` | Open command previewer |
|
|
390
474
|
| `Ctrl + 3` | Open settings |
|
|
475
|
+
| `Ctrl + Shift + H` | Open the in-app **help panel** |
|
|
476
|
+
| `Alt + click` | Capture an assertion for the clicked element |
|
|
391
477
|
|
|
392
478
|
> `Ctrl + R` / `Ctrl + P` and the panel shortcuts only fire when the widget is **visible**. `Ctrl + Shift + E` always works regardless of visibility state.
|
|
393
479
|
|
|
@@ -603,7 +689,7 @@ class RecordingService {
|
|
|
603
689
|
|
|
604
690
|
```typescript
|
|
605
691
|
class PersistenceService {
|
|
606
|
-
insertTest(name: string, commands?: string[], interceptors?: string[], tags?: string[]): Promise<number>;
|
|
692
|
+
insertTest(name: string, commands?: string[], interceptors?: string[], tags?: string[], notes?: string, ticketId?: string): Promise<number>;
|
|
607
693
|
getAllTests(): Promise<TestWithDetails[]>;
|
|
608
694
|
getTestById(testId: number): Promise<TestDetail | null>;
|
|
609
695
|
deleteTest(id: number): Promise<void>;
|