mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-07-09 12:41:05 +02:00
## ℹ️ Description Adds configurable human-like browser interaction behavior to make automation less mechanically deterministic while preserving the existing publish/update workflows. Related to #1120. ## 📋 Changes Summary - Added `humanization` configuration for action delays, typing jitter, thinking pauses, idle micro-actions, and randomized viewport sizes. - Applied humanized timing and interaction behavior to relevant browser automation paths. - Added validation for viewport size formats and min/max timing ranges, including German translations for user-facing validation errors. - Hardened fallback behavior for humanized click and typing flows so automation can continue when a lower-level interaction fails. - Added focused unit coverage for delay edge cases, config validation, and typing fallback behavior. - Regenerated committed config/schema artifacts for the new settings. ## 🧪 Validation - `pdm run pytest tests/unit/test_humanization.py tests/unit/test_web_scraping_mixin.py` - `pdm run ruff check src/kleinanzeigen_bot/utils/web_scraping_mixin.py src/kleinanzeigen_bot/model/config_model.py tests/unit/test_humanization.py` - Live DOM probes with the PR worktree code via `data/verify_dom_assumptions.py`: - `login-selectors` - `publish-selectors` - `price-type-controls` ### ⚙️ Type of Change - [ ] 🐞 Bug fix (non-breaking change which fixes an issue) - [x] ✨ New feature (adds new functionality without breaking existing usage) - [ ] 💥 Breaking change (changes that might break existing user setups, scripts, or configurations) ## ✅ Checklist Before requesting a review, confirm the following: - [x] I have reviewed my changes to ensure they meet the project's standards. - [x] I have tested my changes and ensured that all tests pass (`pdm run test`). - [x] I have formatted the code (`pdm run format`). - [x] I have verified that linting passes (`pdm run lint`). - [x] I have updated documentation where necessary. By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added configurable “humanization” behavior for browser automation: optional mouse movement, per-keystroke typing jitter/delays, probabilistic thinking pauses, idle micro-actions, and optional launch viewport randomization. * Navigation timing now incorporates human-like action delays. * **Bug Fixes** * Improved resilience: humanized click/typing safely fall back to standard actions when needed. * Added stronger validation for viewport-size formatting and delay min/max range consistency. * **Tests** * Added comprehensive unit coverage for humanization routing, event dispatch, timing, fallbacks, idle/thinking behavior, viewport launch arguments, and validation. * **Documentation** * Updated default configuration, configuration schema, and a related translation message. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Jens <1742418+1cu@users.noreply.github.com>