-
- Notifications
You must be signed in to change notification settings - Fork 8.6k
[rb] Implement High Level Logging API with BiDi #14073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
PR Review 🔍(Review updated until commit aeb7b85)
Code feedback:
|
PR Code Suggestions ✨
|
CI Failure Feedback 🧐(Checks updated until commit 4252b00)
✨ CI feedback usage guide:The CI feedback tool (
In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR: where Configuration options
See more information about the |
| /help |
PR Agent Walkthrough 🤖Welcome to the PR Agent, an AI-powered tool for automated pull request analysis, feedback, suggestions and more. Here is a list of tools you can use to interact with the PR Agent:
(1) Note that each tool be triggered automatically when a new PR is opened, or called manually by commenting on a PR. (2) Tools marked with [*] require additional parameters to be passed. For example, to invoke the |
| Persistent review updated to latest commit aeb7b85 |
| PR Description updated to latest commit (aeb7b85)
|
PR Code Suggestions ✨
|
| I have some more tweaks for this, but does it look good enough for now? |
PR Code Suggestions ✨
|
* add and remove logging handlers with BiDi * use #object_id instead of creating new ids to track callbacks * do not send browsing contexts to subscription if not needed * deprecate Driver#script & LogInspector * error if trying to remove an id that does not exist * do not unsubscribe if never subscribed in the first place * do not deprecate callbacks people don't have to care about getting the id back
User description
Description
Motivation and Context
Partial Ruby implementation of #13992
#13964
Updates
Based on feedback:
#object_idof the proc to return the id instead of tracking it separatelyScriptclass is going to implement things from both script and log domains. It makes sense to implement the domain specific functionality in separate, lower level classes and keepScriptfor the high level API, so I createdLogHandlerclass for this.Driver#scriptalias ofDriver#exectue_scriptLogInspector- this should provide all of the required functionality of LogInspectorPR Type
Enhancement, Tests, Documentation
Description
LogHandlerclass for managing console and JavaScript log entries.BiDi#callbacksandLogInspectorclass.add_callbackandremove_callbackmethods toWebSocketConnection.Scriptclass to handle log entries and manage handlers.subscribeandunsubscribemethods inSessionclass to use keyword arguments.Scriptclass and BiDi error handling.DriverandScriptclasses.Changes walkthrough 📝
9 files
bidi.rb
Enhance BiDi with logging handlers and callback managementrb/lib/selenium/webdriver/bidi.rb
LogHandlerandStructautoloads.BiDi#callbacksmethod.add_callbackandremove_callbackmethods.log_handler.rb
Introduce LogHandler class for managing log entriesrb/lib/selenium/webdriver/bidi/log_handler.rb
LogHandlerclass for managing log entries.log_inspector.rb
Deprecate LogInspector and update callback handlingrb/lib/selenium/webdriver/bidi/log_inspector.rb
LogInspectorclass.add_callbackinstead of direct callbackmanipulation.
session.rb
Refactor session subscription methods with keyword argumentsrb/lib/selenium/webdriver/bidi/session.rb
subscribeandunsubscribemethods to use keyword arguments.struct.rb
Add Struct class for camel to snake case conversionrb/lib/selenium/webdriver/bidi/struct.rb
Structclass to convert camel case JSON keys to snake casemethods.
common.rb
Require Script class in common modulerb/lib/selenium/webdriver/common.rb
require 'selenium/webdriver/common/script'.driver.rb
Deprecate Driver#script alias and add Script instance methodrb/lib/selenium/webdriver/common/driver.rb
Driver#scriptalias for#execute_script.Driver#scriptmethod for accessingScriptinstance.script.rb
Add Script class for handling log entriesrb/lib/selenium/webdriver/common/script.rb
Scriptclass to handle console and JavaScript log entries.websocket_connection.rb
Add callback management methods to WebSocketConnectionrb/lib/selenium/webdriver/common/websocket_connection.rb
add_callbackandremove_callbackmethods for managing WebSocketcallbacks.
3 files
script_spec.rb
Add integration tests for Script classrb/spec/integration/selenium/webdriver/bidi/script_spec.rb
Scriptclass.bidi_spec.rb
Add BiDi error handling and deprecation testsrb/spec/integration/selenium/webdriver/bidi_spec.rb
BiDi#callbacks.driver_spec.rb
Add test for Driver#script method with deprecation warningrb/spec/integration/selenium/webdriver/driver_spec.rb
Driver#scriptmethod with deprecation warning.2 files
driver.rbs
Update type signature for Driver classrb/sig/lib/selenium/webdriver/common/driver.rbs
@scriptinstance variable to type signature.script.rbs
Add type signatures for Script classrb/sig/selenium/web_driver/script.rbs
Scriptclass methods.