[feature] Add ChromeDriver log output #717#718
Conversation
|
Warning Review limit reached
Next review available in: 12 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthrough
Estimated code review effort: 2 (Simple) | ~10 minutes Sequence Diagram(s)sequenceDiagram
participant Environment
participant SeleniumTestMixin
participant ChromeService
participant ChromeWebDriver
Environment->>SeleniumTestMixin: Read CHROMEDRIVER_LOG
SeleniumTestMixin->>ChromeService: Create verbose service when set
SeleniumTestMixin->>ChromeWebDriver: Construct with options and optional service
Suggested labels: Caution Pre-merge checks failedPlease resolve all errors before merging. Addressing warnings is optional.
❌ Failed checks (1 error, 2 warnings)
✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openwisp_utils/tests/selenium.py`:
- Around line 284-287: Update get_chrome_webdriver so CHROMEDRIVER_LOG uses a
worker-unique log filename when tests run in parallel, incorporating the
existing free_port() debugging-port value or equivalent unique suffix; preserve
the current filename for non-parallel runs and keep the change consistent with
the geckodriver.log handling.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: ASSERTIVE
Plan: Pro
Run ID: 6b6b53d1-3784-4301-ad76-6d0bddc5990c
📒 Files selected for processing (2)
openwisp_utils/tests/selenium.pytests/test_project/tests/test_selenium_mixin.py
📜 Review details
⏰ Context from checks skipped due to timeout. (15)
- GitHub Check: CodeRabbit / Review
- GitHub Check: Python==3.10 | django~=5.2.0
- GitHub Check: Python==3.12 | django~=4.2.0
- GitHub Check: Python==3.12 | django~=5.2.0
- GitHub Check: Python==3.13 | django~=5.2.0
- GitHub Check: Python==3.11 | django~=4.2.0
- GitHub Check: Python==3.11 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=5.0.0
- GitHub Check: Python==3.10 | django~=5.1.0
- GitHub Check: Python==3.13 | django~=5.1.0
- GitHub Check: Python==3.12 | django~=5.1.0
- GitHub Check: Python==3.10 | django~=4.2.0
- GitHub Check: Python==3.11 | django~=5.0.0
- GitHub Check: Python==3.10 | django~=5.0.0
- GitHub Check: Python==3.11 | django~=5.2.0
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{py,html,txt}
📄 CodeRabbit inference engine (Custom checks)
For Django pull requests, ensure all user-facing strings are marked as translatable using the Django i18n framework
Files:
openwisp_utils/tests/selenium.pytests/test_project/tests/test_selenium_mixin.py
**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
**/*.py: Place imports at the top of the file; only defer imports when necessary (e.g., Django model imports inside functions or methods where the app registry is not yet ready)
Avoid unnecessary blank lines inside function and method bodies
Add or update tests for every behavior change
Runopenwisp-qa-formatafter editing
Prefer in-process tests so coverage tools can measure changed code
When checking coverage for a changed module, usepython -m pytest <test_path> --cov=<dotted.module.path> --cov-report=term-missing
Watch for unsafe file paths, unsafe subprocess usage, token or secret exposure, and changes that could weaken QA or release safeguards
Write comments and docstrings only when they explain why code is shaped a certain way; place comments before the relevant code block instead of scattering them inside it
Files:
openwisp_utils/tests/selenium.pytests/test_project/tests/test_selenium_mixin.py
**/tests/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
For bug fixes, write the regression test first, run it against the unfixed code, confirm it fails for the expected reason, then implement the fix
Files:
openwisp_utils/tests/selenium.pytests/test_project/tests/test_selenium_mixin.py
🧠 Learnings (1)
📚 Learning: 2026-06-15T22:45:01.529Z
Learnt from: nemesifier
Repo: openwisp/openwisp-utils PR: 701
File: setup.py:72-72
Timestamp: 2026-06-15T22:45:01.529Z
Learning: When reviewing changes that require a minimum Selenium Python version for specific APIs (e.g., BiDi features like `Options.enable_bidi`, console/message handlers like `Script.add_console_message_handler`, or event handlers like `BrowsingContext.add_event_handler`), do not use the Selenium API docs site (`https://www.selenium.dev/selenium/docs/api/py/`) as the source of introduction/version history, since it reflects the latest API shape. Instead, confirm feature availability by checking the official Python changelog (`py/CHANGES` in the Selenium repo) and/or inspecting the Selenium source (tags/commits corresponding to candidate versions). Only accept the stated minimum version after verifying that the referenced APIs exist in that Selenium version (e.g., Selenium 4.32.0 includes the BiDi APIs used by openwisp-utils’ BiDi-related PR `#701` as of that version).
Applied to files:
openwisp_utils/tests/selenium.pytests/test_project/tests/test_selenium_mixin.py
🔇 Additional comments (3)
openwisp_utils/tests/selenium.py (2)
280-288: LGTM!
284-287: ChromeService args are supported here.service_argsandlog_outputare valid in Selenium 4.32.0, so this code can stay as-is.tests/test_project/tests/test_selenium_mixin.py (1)
2-6: LGTM!Also applies to: 30-56
| if CHROMEDRIVER_LOG: | ||
| kwargs["service"] = webdriver.ChromeService( | ||
| service_args=["--verbose"], log_output="chromedriver.log" | ||
| ) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win
Parallel test workers share a single chromedriver.log file.
When running with --parallel, each TestCase class calls get_chrome_webdriver() independently, but all write to the same hardcoded chromedriver.log. This can cause interleaved or corrupted log output. Consider incorporating a unique suffix (e.g., the free_port() already used for debugging ports) into the log filename when parallelism is detected. This is consistent with the existing geckodriver.log pattern, so it's a pre-existing concern, but the new code propagates it to Chrome.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@openwisp_utils/tests/selenium.py` around lines 284 - 287, Update
get_chrome_webdriver so CHROMEDRIVER_LOG uses a worker-unique log filename when
tests run in parallel, incorporating the existing free_port() debugging-port
value or equivalent unique suffix; preserve the current filename for
non-parallel runs and keep the change consistent with the geckodriver.log
handling.
Allow Selenium tests to write verbose ChromeDriver logs when CHROMEDRIVER_LOG is set.\n\nFixes openwisp#717
4a39370 to
a18cf05
Compare
|
Do not open PRs for issues that haven't been discussed thorougly. See Anti AI spam policy and Contributing Guidelines. |
Summary
CHROMEDRIVER_LOGis setValidation
isort --check-only openwisp_utils/tests/selenium.py tests/test_project/tests/test_selenium_mixin.pyblack --check openwisp_utils/tests/selenium.py tests/test_project/tests/test_selenium_mixin.pyflake8 openwisp_utils/tests/selenium.py tests/test_project/tests/test_selenium_mixin.pyFixes #717