Files
fleet/tools/screencap/workflows/test.json
T
George KarrandLuke Heath 51da3581e6 Adding new screencap tool to help with automated testing (#42437)
## Summary

Adds `tools/screencap`, a CLI for automated screenshots of the Fleet UI
via headless Chrome (CDP).

- **Built-in full workflow** captures all major pages and their
modals/tabs (dashboard, hosts, queries, policies, software, controls,
settings, account) in one command.
- **Record custom workflows** in a visible browser — clicks, tabs,
radios, checkboxes, and tooltip hovers are recorded automatically and
saved as replayable JSON under `tools/screencap/workflows/`.
- **Auth options** for SSO, email/password, or session cookie; the
Chrome profile is persisted at `~/.fleet/screencap-profile/` so sessions
survive across runs.
- **Output** is written to `screenshots/<timestamp>-<workflow>-<host>/`
as numbered PNGs, with multi-viewport pages split into separate images.

See `tools/screencap/README.md` for full usage.

## Test plan

- [ ] `cd tools/screencap && make build` produces the binary
- [ ] `./screencap -sso https://<fleet-host>` captures the full built-in
workflow
- [ ] `./screencap -record demo https://<fleet-host>` records a workflow
and saves it under `workflows/demo.json`
- [ ] `./screencap -workflow demo https://<fleet-host>` replays the
recorded workflow
- [ ] `./screencap -list` shows saved workflows

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Added a screenshot automation tool that records and replays UI
workflows, captures full-page and modal screenshots, restores scroll
positions, and supports session persistence and multiple login methods.

* **Chores**
* Added a minimal build/clean workflow for the tool and updated ignore
rules to avoid committing generated screenshots.

* **Documentation / Templates**
* Included example workflow templates demonstrating common navigation
and interaction sequences.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/fleetdm/fleet/pull/42437?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Luke Heath <luke@fleetdm.com>
2026-05-21 13:49:56 -05:00

111 lines
3.9 KiB
JSON

{
"name": "test",
"steps": [
{
"name": "step-1",
"path": "/software/add/fleet-maintained",
"actions": [
{
"kind": "click",
"selector": ".software-page__title",
"text": "option All fleets selected, 1 of 7. 7 results available. Use Up and Down to choose options, press En"
},
{
"kind": "click",
"selector": ".software-page__title",
"text": "option 🧪 Testing \u0026 QA focused, 7 of 7. 7 results available. Use Up and Down to choose options, pres"
},
{
"kind": "hover",
"selector": "#app \u003e div \u003e div \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div:nth-of-type(2) \u003e div:nth-of-type(2) \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div \u003e div:nth-of-type(1) \u003e table \u003e tbody \u003e tr:nth-of-type(2) \u003e td:nth-of-type(1) \u003e a \u003e div \u003e div:nth-of-type(1)",
"text": "true"
},
{
"kind": "hover",
"selector": "#app \u003e div \u003e div \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div:nth-of-type(2) \u003e div:nth-of-type(2) \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div \u003e div:nth-of-type(1) \u003e table \u003e tbody \u003e tr:nth-of-type(1) \u003e td:nth-of-type(1) \u003e a \u003e div \u003e div:nth-of-type(1)",
"text": "true"
},
{
"kind": "hover",
"selector": "#app \u003e div \u003e div \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div:nth-of-type(1) \u003e div:nth-of-type(1) \u003e div:nth-of-type(2) \u003e span:nth-of-type(1) \u003e div",
"text": "true"
},
{
"kind": "hover",
"selector": "#app \u003e div \u003e div \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div:nth-of-type(1) \u003e div:nth-of-type(1) \u003e div:nth-of-type(2) \u003e span:nth-of-type(2) \u003e div",
"text": "true"
},
{
"kind": "click",
"selector": ".button.button--default",
"text": "Add software"
}
]
},
{
"name": "step-2",
"path": "/software/add/app-store",
"actions": [
{
"kind": "tab",
"selector": "[data-text=\"App store\"]",
"text": "App store"
}
]
},
{
"name": "step-3",
"path": "/software/add/package",
"actions": [
{
"kind": "tab",
"selector": "[data-text=\"Custom package\"]",
"text": "Custom package"
}
]
},
{
"name": "step-4",
"path": "/software/add/package",
"scroll_y": 243,
"actions": [
{
"kind": "click",
"selector": ".target-label-selector.package-form__target.form",
"text": "TargetAll hostsCustom"
},
{
"kind": "radio",
"selector": "#custom-target-radio-btn"
},
{
"kind": "click",
"selector": ".target-label-selector__custom-label-chooser",
"text": "Include anyInclude anyExclude anySoftware will only be available for install on hosts that have any "
}
]
},
{
"name": "step-5",
"path": "/software/vulnerabilities?page=0",
"actions": [
{
"kind": "click",
"selector": "#app \u003e div \u003e div \u003e div \u003e div \u003e div:nth-of-type(2) \u003e div \u003e div \u003e div:nth-of-type(3) \u003e div \u003e form \u003e div:nth-of-type(3) \u003e button:nth-of-type(2)",
"text": "Cancel"
},
{
"kind": "tab",
"selector": "[data-text=\"OS\"]",
"text": "OS"
},
{
"kind": "tab",
"selector": "[data-text=\"Vulnerabilities\"]",
"text": "Vulnerabilities"
}
]
}
]
}