Skip to content
Open
2 changes: 1 addition & 1 deletion apps/cli/test/commands/render.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('demoflow render', () => {
expect(d.plans[0]?.options.formats).toEqual(['mp4', 'webm']);
expect(d.plans[0]?.options.output?.fps).toBe(24);
// The default end hold, as `demoflow run` recorded it (spec 365).
expect(d.plans[0]?.options.endHoldMs).toBe(2500);
expect(d.plans[0]?.options.endHoldMs).toBe(3500);
expect(io.err).toContain('Rendering\n');
expect(io.out).toContain(RUN_ID);
const written = await readResultFile();
Expand Down
1 change: 1 addition & 0 deletions apps/fixture/demoflow/customers-repeat.demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
{ "name": "Ken Thompson", "email": "ken@example.com" }
]
},
"pacing": { "stepDwellMs": 250, "typingDelayMs": 20 },
"steps": [
{ "action": "navigate", "path": "/customers" },
{
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/app/docs/config/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Every `render` key is optional. These are the defaults:
| `fps` | 30 | Frames per second. |
| `idle.thresholdMs` | 1000 | A still stretch longer than this is shortened. |
| `idle.compressToMs` | 400 | …to this long. |
| `endHoldMs` | 2500 | How long a successful video stays on screen after the last step, 0 to 10000 ms. The run records it, so a result that shows late is in the video. A failed run ends at the failure. To hold after any step, see [`hold`](/docs/scenarios#hold). |
| `endHoldMs` | 3500 | How long a successful video stays on screen after the last step, 0 to 10000 ms. The run records it, so a result that shows late is in the video. A failed run ends at the failure. To hold after any step, see [`hold`](/docs/scenarios#hold). |
| `frame` | on | See below. |
| `background` | `{ "preset": "ocean" }` | See below. |
| `cards` | see below | Intro, scene and outro cards. |
Expand Down
45 changes: 41 additions & 4 deletions apps/web/src/app/docs/scenarios/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Every step has an `action`. Every step may also carry a `caption`, a
| `navigate` | Opens a page. | exactly one of `path` (starts with a single `/`) or `url` |
| `waitFor` | Waits for an element. | `target`, `state` (`visible` by default, or `hidden`) |
| `click` | Clicks an element. | `target` |
| `fill` | Types into a field. | `target`, exactly one of `value` or `valueFrom` |
| `fill` | Types into a field. | `target`, exactly one of `value` or `valueFrom`; optional `typingDelayMs` |
| `select` | Picks an option of a select. | `target`, `option` |
| `hover` | Moves the pointer over an element. | `target` |
| `press` | Presses a key or a chord, such as `Enter` or `Control+a`. | `key`, optional `target` |
Expand Down Expand Up @@ -129,11 +129,48 @@ steps that have a target, `waitFor` for a hidden element excepted, and on
}
```

### Pacing

A recording plays slowly enough to follow. After each visible step
(`navigate`, `click`, `hover`, `fill`, `select`, `press`, `scroll`,
`assertVisible`, `assertText`) the video stays on the result for a moment
before the next step, and a `fill` types one character at a time.

The top-level `pacing` object sets this for the whole scenario. Every field is
optional and has a default:

| Field | Default | Range | What it does |
|---|---|---|---|
| `stepDwellMs` | 1000 | 0 to 10000 | Pause after each visible step. `0` turns it off. |
| `typingDelayMs` | 80 | 0 to 500 | Pause between two typed characters of a `fill`. |

A step overrides the scenario's pacing for itself: [`hold`](#hold) (0 to 10000)
on any step replaces the dwell, and `typingDelayMs` (0 to 500) on a `fill`. A
`hold` also adds a pause after a step that has none by default, such as a
`marker`. The last step does not dwell unless it sets `hold`; the end hold
follows it. The end hold is [`render.endHoldMs`](/docs/config#render), 3500 ms
by default.

```json
{
"pacing": { "stepDwellMs": 700, "typingDelayMs": 60 },
"steps": [
{ "action": "fill", "target": { "label": "Title" }, "value": "Hello", "typingDelayMs": 120 },
{ "action": "click", "target": { "role": "button", "name": "Publish" }, "hold": 2000 },
{ "action": "assertVisible", "target": { "text": "Hello" } }
]
}
```

A `wait` still pauses on top of the dwell. Pacing never slows down
[setup and off-camera steps](#off-camera-steps), and a check run
(`demoflow run --check`) neither dwells nor holds the end.

### hold

`hold` keeps the page on screen after the step, for 100 to 10000 ms. The run
`hold` keeps the page on screen after the step, for 0 to 10000 ms. The run
waits that long once the step is done, and the video plays the whole hold at
real speed: the [idle trim](/docs/config#render) never shortens it. A step that
real speed: the [idle trim](/docs/config#render) never shortens it. `0` turns the dwell off. A step that
fails does not hold. `hold` is refused on an off-camera step
(`"record": false`).

Expand All @@ -159,7 +196,7 @@ The outline is drawn where the element was when the assertion passed, so hold
an element that has stopped moving.

Every successful video also ends on its last frame for
[`render.endHoldMs`](/docs/config#render) (2500 ms by default), after the last
[`render.endHoldMs`](/docs/config#render) (3500 ms by default), after the last
step's own `hold`.

### Scene markers
Expand Down
62 changes: 34 additions & 28 deletions packages/core/schemas/fragment.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -246,9 +246,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -393,9 +393,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -531,6 +531,12 @@
"required": ["env"],
"additionalProperties": false
},
"typingDelayMs": {
"description": "Milliseconds between two typed characters of this fill; overrides pacing.typingDelayMs.",
"type": "integer",
"minimum": 0,
"maximum": 500
},
"caption": {
"type": "string",
"maxLength": 120
Expand All @@ -546,9 +552,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -696,9 +702,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -835,9 +841,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -985,9 +991,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1212,9 +1218,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1359,9 +1365,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1515,9 +1521,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1569,9 +1575,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1628,9 +1634,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1675,9 +1681,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down Expand Up @@ -1729,9 +1735,9 @@
"type": "boolean"
},
"hold": {
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Not on an off-camera step.",
"description": "Milliseconds to keep the page on screen after the step, recorded and never trimmed as idle. Use it, not wait, to show a result. Overrides pacing.stepDwellMs; 0 turns the dwell off. Not on an off-camera step.",
"type": "integer",
"minimum": 100,
"minimum": 0,
"maximum": 10000
}
},
Expand Down
2 changes: 1 addition & 1 deletion packages/core/schemas/project-config.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"additionalProperties": false
},
"endHoldMs": {
"default": 2500,
"default": 3500,
"description": "How long a successful video keeps the result on screen after the last step: the engine keeps recording and the renderer keeps the frames. 0 ends the video at the last step.",
"type": "integer",
"minimum": 0,
Expand Down
Loading
Loading