Skip to navigation

Annotation options, written as tests

Each example on this page varies one setting in a short procedure, shown as prose, detected tests, inline tests, and a standalone spec. For what each tab holds, see Navigation and interaction.

The examples write their images and videos to a .dd-output folder next to the example files. For full procedures, see Screenshots and recordings.

Annotation permutations

Each example draws one annotation on a screenshot of the sample form.

outline on a selector string

Varies: screenshot.annotations[] · Value: { "outline": "#username-input" } · Effect: draws a box around the username field.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

outline on an element object

Varies: screenshot.annotations[] · Value: { "outline": { "elementTestId": "username-field" } } · Effect: finds the field by its test ID, then draws a box around it.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

arrow on a selector string

Varies: screenshot.annotations[] · Value: { "arrow": "#username-input" } · Effect: points an arrow at the username field.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

arrow at a point

Varies: screenshot.annotations[] · Value: { "arrow": { "position": { "x": 200, "y": 150 } } } · Effect: points an arrow at a spot in the image, with no element.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

badge on a selector string

Varies: screenshot.annotations[] · Value: { "badge": "#username-input", "label": "1" } · Effect: marks the field with the number 1.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

badge on an element object with timeout

Varies: screenshot.annotations[] · Value: { "badge": { "elementTestId": "password-field", "timeout": 10000 }, "label": "2" } · Effect: waits up to 10 seconds for the field, then marks it with 2.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

callout with a named position

Varies: screenshot.annotations[] · Value: { "callout": "#username-input", "position": "right" } · Effect: labels the field with a text box to its right.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

callout with a position offset

Varies: screenshot.annotations[] · Value: { "position": { "offset": { "x": 0, "y": 20 } } } · Effect: moves the label 20 pixels down from where it would go.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

blur on a selector string

Varies: screenshot.annotations[] · Value: { "blur": "#contact-email" } · Effect: blurs the first match only.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

blur with all

Varies: screenshot.annotations[] · Value: { "blur": { "selector": ".form-control" }, "all": true } · Effect: blurs every field that matches, not only the first.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

text in a named region

Varies: screenshot.annotations[] · Value: { "text": { "position": "top-right" } } · Effect: places a text box in the top-right corner of the image.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

text on a selector with a position point

Varies: screenshot.annotations[] · Value: { "text": "#username-input", "position": { "x": 40, "y": 40 } } · Effect: anchors the text to the field, then places it at a fixed point.

prose.md
# Mark the sign-in form
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field comes first.

annotate permutations

Each example draws into the page with annotate, then takes a screenshot that shows the result.

add

Varies: annotate.add · Value: [{ "id": "step", "badge": "#username-input" }] · Effect: draws a badge into the page, where it stays until something clears it.

prose.md
# Mark a field on the page
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is marked 1.

update

Varies: annotate.update · Value: [{ "id": "step", "badge": "#submit-button" }] · Effect: replaces the annotation with the same id, so the badge moves to the button.

prose.md
# Move a mark to the next field
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is marked 1.
3. Then the button is marked 2.

clear with ids

Varies: annotate.clear · Value: ["hint"] · Effect: removes only the annotations with those ids.

prose.md
# Remove one mark
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is marked 1, with a hint beside it.
3. The hint goes away, and the mark stays.

clear: true

Varies: annotate.clear · Value: true · Effect: removes every annotation on the page.

prose.md
# Remove every mark
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is marked 1.
3. All marks go away.

annotationDefaults precedence

A test’s theme wins over the spec’s, which wins over the config’s. An annotation’s own style wins over all of them. The config-level examples keep a doc-detective.json in their folder.

In the config

Varies: config.annotationDefaults · Value: { "color": "#E11D48", "strokeWidth": 3 } · Effect: every annotation in the run uses the red theme unless a spec or test sets its own.

prose.md
# Outline a field with the config theme
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is outlined.

On the spec

Varies: spec.annotationDefaults · Value: { "color": "#0EA5E9", "strokeWidth": 4 } · Effect: every test in the spec uses the blue theme. Inline statements can’t set spec fields, so the inline and detected variants set it on the test.

prose.md
# Outline a field with the spec theme
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is outlined.

On the test

Varies: test.annotationDefaults · Value: { "color": "#0EA5E9", "strokeWidth": 4 } · Effect: this test’s annotations use the blue theme.

prose.md
# Outline a field with the test theme
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is outlined.

Test over config

Varies: test.annotationDefaults over config.annotationDefaults · Value: blue over red · Effect: the test’s blue theme wins over the config’s red one.

prose.md
# Outline a field when config and test set themes
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is outlined.

Annotation style over test

Varies: annotation.style over test.annotationDefaults · Value: { "color": "#7C3AED" } · Effect: the annotation’s own purple style wins over the test’s blue theme.

prose.md
# Outline a field with its own style
1. Go to [the sample form](http://localhost:8092/enhanced-elements.html).
2. The username field is outlined.