mirror of
https://github.com/Second-Hand-Friends/kleinanzeigen-bot.git
synced 2026-07-09 12:41:05 +02:00
## ℹ️ Description - Link to the related issue(s): PR #1193 follow-up - Adds screen-aware humanization viewport selection so randomized desktop sizes fit the available browser-reported screen area while preserving permissive config validation. ## 📋 Changes Summary - Add larger common desktop viewport defaults: `2560x1440`, `1920x1200`, `1728x1117`, and `1512x982`. - Probe browser-reported CSS-pixel screen metrics at launch time using `window.screen.availWidth` / `window.screen.availHeight`. - Filter configured viewport base sizes against available screen dimensions, apply bounded jitter, and preserve explicit `--window-size` overrides. - Omit automatic `--window-size` when no configured size fits, screen metrics are unavailable, the launch is headless, or no real display/window manager is available; explicit user `--window-size` remains preserved. - Cache successful probe metrics and bound the probe with the `chrome_remote_probe` timeout. - Update generated default config and German translations. - Add unit coverage and real-browser integration coverage for viewport probing/filtering, headless/no-display skips, probe timeout/cache behavior, and `create_browser_session()`. ### ⚙️ Type of Change Select the type(s) of change(s) included in this pull request: - [ ] 🐞 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** * Browser sessions now support screen-aware viewport selection automatically when viewport randomization is enabled. * Expanded the default set of candidate viewport sizes used for randomized sizing. * **Bug Fixes** * Viewport sizing now filters out candidates that don’t fit within the available screen area. * If a window size is already specified, it’s preserved. * **Tests** * Added/expanded slow integration tests for screen probing and viewport fitting. * Expanded unit tests for viewport filtering, jittering, fallback behavior, and probe reuse/timeout. <!-- end of auto-generated comment: release notes by coderabbit.ai -->