mirror of
https://github.com/actionbook/actionbook.git
synced 2026-09-19 03:28:06 +08:00
feature/parallel-e2e
7 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
fac7647c6c |
[packages/actionbook-rs]fix: align tab ID to 1-based (t1, t2, ...) per spec and add tab management E2E assertions
- Fix next_tab_id counter to start from 1 instead of 0 - Fix hardcoded "t0" in browser start response (router.rs) - Update TabId doc comment to reflect t1, t2, ... convention - Rewrite browser_tab.rs with full JSON envelope assertions for list-tabs, new-tab (browser open), and close-tab commands - Update all e2e test files to use 1-based tab IDs (t1, t2, t3) - Fix harness ensure_no_sessions() field name: "id" -> "session_id" Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> |
||
|
|
dcd900adea |
[packages/actionbook-rs]fix: preserve non-HTTP schemes in URL normalization
Fix ensure_scheme to detect colon-based schemes (about:blank, data:, chrome://, mailto:) in addition to :// schemes. Updates e2e test for invalid URL to use a truly invalid URL since bare strings are now auto-prefixed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |
||
|
|
625994d0cd |
feat: semantic session_id (Phase A-1) + E2E update (#283)
* [packages/actionbook-rs]feat: semantic session_id (#t21, #t25)
Replace numeric SessionId(u32) with semantic SessionId(String) validated
against ^[a-z][a-z0-9-]{0,63}$. Auto-generates local-1, local-2, ...
when --set-session-id is not provided. Add --set-session-id flag to
browser start for explicit naming. Update all 86 E2E tests from s0→local-1.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: address review feedback on PR #283
- Tighten SessionId validator from {0,63} to {1,63} (min 2 chars)
- Profile-based auto-generation: explicit --profile derives session ID
from profile name (default, default-2, ...); no --profile uses local-N
- Add --set-session-id contract E2E tests (explicit, invalid, conflict)
- Add profile-based auto-generation E2E test
- Update clap help text from "s0" to "local-1" examples
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: resolve rebase conflicts with PR #282 formatter
- Add set_session_id: None to Action::StartSession in formatter tests
- Update SessionId(0) → SessionId::new_unchecked("local-1") in formatter
- Update test assertions from "s0" to "local-1" session IDs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: add clippy allow for too_many_arguments on handle_start_session
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: prevent auto-generated session ID collision with explicit IDs
Auto-generate path now loops to skip IDs already occupied (e.g. by
--set-session-id local-1). Adds UT covering the collision scenario.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: resolve rebase conflicts with PR #284 formatter tests
Update SessionId(0) → SessionId::new_unchecked("local-1") and
"s0" → "local-1" in new tests added by PR #284.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: profile-based session ID sanitization and multi-session support
- SessionId::from_profile() now sanitizes profile names: lowercase,
replace non-alphanumeric with hyphens, collapse consecutive hyphens,
strip leading/trailing hyphens. Falls back to local-N if invalid.
- Local mode session_exists gate now only applies when no explicit
--profile is passed, allowing work, work-2, work-3 with explicit profiles.
- Added 6 UTs covering sanitization edge cases and fallback behavior.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
* [packages/actionbook-rs]fix: reserve room for suffix in long-profile session IDs
Truncate sanitized profile base before appending collision suffix
to prevent suffix from being erased by the 64-char limit. Ensures
distinct session IDs even for very long profile names.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
||
|
|
99815cc2dc |
fix: add SessionGuard to prevent E2E test cascade failures (#275)
* [packages/actionbook-rs]fix: add SessionGuard to prevent E2E test cascade failures Add a RAII SessionGuard that calls ensure_no_sessions() on both creation and drop. This ensures sessions are cleaned up even when a test panics mid-execution, preventing one test failure from cascading into all subsequent tests (which was causing 64/65 E2E failures). - Replace all bare ensure_no_sessions() calls with SessionGuard::new() - Add SessionGuard to 8 tests that were missing session cleanup entirely - Guard runs cleanup on drop (including panic unwind), not just on success Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]chore: fix cargo fmt formatting in E2E test imports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
31290b5968 |
feat: tab management — close-tab + list-tabs URL fix (#t3) (#272)
* [packages/actionbook-rs]feat: implement tab management CLI commands (close-tab, list-tabs URL fix) - Add CloseTab subcommand to BrowserCmd and wire to Action::CloseTab - Fix handle_goto to update tab registry URL after navigation - Fix handle_start_session to send Goto on t0 when --open-url is set, ensuring list-tabs shows correct URL for the initial tab - Add ensure_no_sessions cleanup to all tab E2E tests All 7 tab E2E tests pass, along with 9 lifecycle + 5 navigation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]feat: enable observation output E2E tests (snapshot, screenshot, pdf, title, url) Add ensure_no_sessions() cleanup to all observation E2E tests for test isolation. All 8 observation output tests pass. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: address review feedback on PRs #268 and #272 - Store headless flag in SessionHandle and use it during restart - Preserve session ID on restart (reuse_id parameter) - Update tab registry URL after back/forward/reload navigation - Align JSON response formats with api-reference.md PRD: - goto/back/forward/reload: return kind, from_url, to_url - list-tabs: use tab_id instead of id, add total_tabs - close-tab: use closed_tab_id instead of closed_tab Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: resolve clippy too_many_arguments and missing headless field - Add #[allow(clippy::too_many_arguments)] to handle_start_session_inner - Add headless field to SessionHandle in daemon_e2e.rs test Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]feat: implement query command with cardinality modes (one/all/count/nth) - Add QueryCardinality enum (One, All, Count, Nth) to types.rs - Restructure CLI query as subcommands: query one/all/count/nth - Update Action::Query with cardinality and nth_index fields - Rewrite handle_query to support all four cardinality modes with PRD-compliant JSON responses (§10.7) - Add query-specific text formatting in formatter.rs - All 7 #t5 E2E tests pass (viewport, eval x2, query x4) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]feat: add html/text CLI commands, fix attr/fill argument order - Add Html and TextCmd subcommands to BrowserCmd enum - Fix Attr: change name from --name flag to positional argument - Fix Fill: reorder args to (selector, text) matching test expectations - All 5 #t6 E2E tests pass (html, text, value, attr, attrs) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: make drag args positional, add ensure_no_sessions to interaction tests Drag command now accepts positional `from` and `to` args matching test expectations. Added ensure_no_sessions() to all 18 interaction E2E tests to prevent stale session interference. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]feat: implement mouse-move coords parsing, scroll subcommands with top/bottom/into-view - MouseMove CLI: accepts single "x,y" coordinate string instead of separate x/y args - Scroll CLI: converted to subcommands (up/down/left/right/top/bottom/into-view) with positional amount and selector args - Scroll handler: added top (scrollTo 0), bottom (scrollTo max), and into-view (scrollIntoView) direction support Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]feat: implement wait subcommands (element/navigation/network-idle/condition) - Replaced top-level WaitNavigation/WaitNetworkIdle/WaitCondition with Wait(WaitCmd) subcommand group - Added WaitElement subcommand (was missing from CLI, handler existed) - Added ensure_no_sessions() to all 5 waiting E2E tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]feat: implement cookies/storage/error CLI subcommands, fix cookie domain and eval error handling - Cookies: replaced CookiesList/Get/Set/Delete/Clear with Cookies(CookiesCmd) subcommand - Storage: replaced StorageList/Get/Set/Delete/Clear with LocalStorage/SessionStorage subcommands - Fixed cookie set/delete: derive domain from page hostname when not specified - Fixed eval: detect JS exceptions in result and return fatal error - Added ensure_no_sessions() to all browser_data (8) and browser_errors (6) E2E tests Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: adapt cookies subcommand to domain filter from #273 Update CookiesCmd List/Clear variants and unit tests to include domain parameter added by PR #273, ensuring compatibility with the subcommand pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]refactor: split action_handler.rs into module directory Extract 3866-line monolith into 7 focused files: - mod.rs: dispatch, shared types, helpers, tests - navigation.rs: goto, history, reload - observation.rs: snapshot, screenshot, pdf, eval, query, etc. - interaction.rs: click, type, fill, scroll, drag, etc. - data.rs: cookies and storage CRUD - waiting.rs: wait navigation/network-idle/condition - session.rs: list-tabs, list-windows, new-tab, close-tab Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]refactor: split cli_v2.rs into module directory Extract subcommand enums (QueryCmd, ScrollCmd, CookiesCmd, StorageSubCmd, WaitCmd) and CLI-facing helper types (CliMode, CliSameSite, etc.) into cli_v2/commands.rs. The main mod.rs retains CliV2, BrowserCmd, build_action, daemon lifecycle, and tests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: cargo fmt for long use imports Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: pass QueryCmd --mode flag through build_action and error on bad MouseMove coords - QueryCmd variants now pass the user-specified mode (css/xpath/text) instead of hardcoding QueryMode::Css - MouseMove returns a parse error instead of silently defaulting to (0,0) on invalid coordinates Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: remove unused imports QueryMode and CliSameSite Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * [packages/actionbook-rs]fix: add mode field to QueryCmd variants in commands.rs The mode field was added to the build_action destructuring in mod.rs but the corresponding field was missing from the QueryCmd enum variants in commands.rs, causing CI compile failure. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
862d7c138b |
[packages/actionbook-rs]fix: format code for lint compliance (#267)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> |
||
|
|
de43e3edbf |
[packages/actionbook-rs]test: E2E tests — full command coverage (61 tests) (#260)
* [packages/actionbook-rs]test: full E2E test suite — 83 tests across 9 modules Add 8 E2E test modules covering all browser commands from api-reference.md: - browser_lifecycle.rs (9): start, list-sessions, status, close, restart - browser_tab.rs (7): list-tabs, new-tab/open, close-tab - browser_navigation.rs (5): goto, back, forward, reload - browser_observation.rs (26): snapshot, screenshot, pdf, title, url, viewport, eval, html, text, value, attr, attrs, box, styles, query, describe, state, inspect-point, logs console/errors - browser_interaction.rs (17): click, type, fill, select, hover, focus, press, drag, upload, mouse-move, cursor-position, scroll - browser_waiting.rs (5): wait element, navigation, network-idle, condition - browser_data.rs (7): cookies CRUD, local-storage, session-storage - browser_errors.rs (6): error path coverage Scene coverage: S1T1, S1T2 (tab isolation), SEQ (sequential operations) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [packages/actionbook-rs]fix: address codex review — 13 E2E test fixes Observation: - Compare snapshot content only, not full JSON envelope (s1t2/seq tests) - Add obs_query_nth test for query nth mode - Strengthen obs_query_count assertion with numeric parsing Interaction: - Fix drag: positional args, not --from/--to flags - Fix mouse-move: single "x,y" arg, not two positional - Fix scroll: "scroll down 500", not "--amount 500" - Add int_scroll_into_view test Waiting: - Fix wait_nav assertion: compare URL before/after, not vacuous check Data: - Fix S1T2 tests: create second tab before using t1 - Add local-storage clear step - Add storage_session_list_delete_clear test - Meaningful assertion in storage_s1t2_isolation Errors: - All 6 tests now check error message content, not just exit code Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [packages/actionbook-rs]fix: address codex round 2 — snapshot content, storage clear/isolation - Snapshot content extraction: use JSON pointer /data/content for true content comparison - Storage clear tests: verify store is empty after clear (list + assert not contains) - Storage s1t2 isolation: assert same-origin tabs share localStorage ("crossval" visible) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [packages/actionbook-rs]fix: address PR review — 3 P1 issues 1. Restrict browser-intent detection to subcommand position (args[1]) instead of scanning all argv — prevents misrouting "actionbook search b" 2. Daemon stop: send SIGTERM via PID file instead of just deleting socket. Old approach left orphaned daemon process running. 3. Add #[cfg(unix)] gate to daemon module in lib.rs, commands/mod.rs, and main.rs — restores cross-platform compilation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * [packages/actionbook-rs]docs: enhance CLI documentation and add API reference - Added a new section on Product Principles to CLAUDE.md, outlining key design philosophies for the CLI and daemon architecture. - Introduced a comprehensive API reference document for Actionbook CLI, detailing design goals, principles, command definitions, and error protocols. This update aims to improve clarity and usability for developers interacting with the Actionbook CLI. --------- Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com> |