Skip to content

feat: add trace recording and HTML report viewer#19

Open
tosh7 wants to merge 5 commits intomainfrom
feature/trace-viewer
Open

feat: add trace recording and HTML report viewer#19
tosh7 wants to merge 5 commits intomainfrom
feature/trace-viewer

Conversation

@tosh7
Copy link
Copy Markdown
Owner

@tosh7 tosh7 commented Mar 24, 2026

Summary

  • Trace recording: era trace start/stop captures each operation with timestamps, inputs/outputs, and optional screenshots
  • Trace storage: Persists traces to ~/.era/traces/{trace_id}/ with JSON data + screenshot files
  • HTML reports: Single-file HTML report with dark theme, timeline visualization, expandable step details, and base64-embedded screenshots

Changes

New src/trace/ module

  • recorder.rs: TraceData/TraceStep types, start/stop/record_step, file-based active trace state (~/.era/active-trace.json)
  • store.rs: save/load/list/delete operations on ~/.era/traces/
  • reporter.rs: Single-file HTML generation (dark theme, CSS/JS embedded, base64 screenshots, timeline expand/collapse)
  • mod.rs: Module registration

CLI commands

  • era trace start --name "login-flow" — Start recording
  • era trace stop — Stop recording + auto-generate HTML report
  • era trace show [--format html|json] — View trace (opens browser for HTML)
  • era trace list — List all recorded traces

Usage example

# Record a test flow
era trace start --name "login-test"
era tap -d $UDID --text "Email"
era fill -d $UDID --ref 3 "user@test.com"
era tap -d $UDID --text "Login"
era trace stop
# → HTML report auto-generated and opened in browser

# View later
era trace list
era trace show --format html

Test plan

  • All 226 tests pass (116 lib + 18 coordinate + 63 regression + 12 retry + 17 scale)
  • recorder: 8 tests (TraceData creation, summary calculation, serialization, timestamp formatting)
  • store: 6 tests (paths, save/load round-trip, delete, list)
  • reporter: 10 tests (HTML structure, device info, steps, summary, status, escaping, duration)
  • regression: 7 new tests (trace start/stop/show/list parsing, error cases)

tosh7 added 5 commits March 24, 2026 17:53
- Add --text option: find element by AXLabel/AXValue (case-insensitive
  partial match) via live UI tree query
- Add --type/--index options: find element by type with optional 0-based
  index among matches
- Both tap and fill now support 4 target modes: -x/-y, --ref, --text,
  --type (mutually exclusive via clap conflicts)
- Fill --target for text-based element search, --type/--index for type
- Add find_by_text() and find_by_type_index() to snapshot module
- resolve_live_element() helper queries idb describe-all on the fly
Add era session connect/list/disconnect/disconnect-all commands.
Sessions store UDID, device name, and auto-detected scale factor
in ~/.era/sessions.json. Existing commands (tap, snapshot, fill,
swipe, tap-region) gain --session option as alternative to --device.
When neither is specified, the default session is used.
…tor-session

# Conflicts:
#	src/cli/mod.rs
#	tests/regression.rs
Implement the complete trace module for recording automation sessions:

- trace/recorder.rs: TraceData/TraceStep types, start/stop/record_step
  with file-based active trace state (~/.era/active-trace.json)
- trace/store.rs: save/load/list/delete traces in ~/.era/traces/
- trace/reporter.rs: single-file HTML report with dark theme, embedded
  CSS/JS, base64 screenshot encoding, step timeline with expand/collapse
- CLI: `era trace start|stop|show|list` subcommands
- 7 new regression tests for trace CLI argument parsing
- 28 new unit tests across recorder, store, and reporter modules
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant