-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py][bidi]: add emulation command set_network_conditions
#16702
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
base: trunk
Are you sure you want to change the base?
Conversation
PR Compliance Guide 🔍Below is a summary of compliance checks for this PR:
Compliance status legend🟢 - Fully Compliant🟡 - Partial Compliant 🔴 - Not Compliant ⚪ - Requires Further Human Verification 🏷️ - Compliance label |
||||||||||||||||||||||||||||||||||
PR Code Suggestions ✨Explore these optional code suggestions:
|
|||||||||||||||||
cgoldberg
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
The AI bot had some good suggestions. To summarize:
- Change the default and type hint for
offlinetoFalse(offline=False) - Add a try/finally to the tests, so it always resets even if the test fails
Also, do browsers support latency and download/upload throughput conditions? If so, we should add those.
Is CI failing because we don't have Chrome 143 yet?
They will support these in the future, currently as per spec, only
Only the windows CI is failing because they are not using the pinned browser, they use default gh actions chrome browser which is currently at 142, we had this issue earlier too. Once github has 143 as latest browser, the CI will pass. |
Actually, the spec doesn't allows a boolean value, I added it for API simplicity, @cgoldberg do you see any issue with this approach? |
User description
🔗 Related Issues
💥 What does this PR do?
Adds support for
set_network_conditionscommand in the emulation module - https://w3c.github.io/webdriver-bidi/#command-emulation-setNetworkConditions🔧 Implementation Notes
💡 Additional Considerations
Only Chrome supports this from 143, Edge might also support from 143 (we have 142 currently in trunk).
🔄 Types of changes
PR Type
Enhancement
Description
Adds
set_network_conditionsemulation command for BiDiSupports offline network condition emulation via contexts
Supports offline network condition emulation via user contexts
Includes comprehensive tests for both context types
Diagram Walkthrough
File Walkthrough
emulation.py
Add set_network_conditions emulation methodpy/selenium/webdriver/common/bidi/emulation.py
set_network_conditionsmethod to Emulation classofflineparameter to enable/disable offline modecontextsoruser_contextsparametersparameters
bidi_emulation_tests.py
Add network conditions emulation testspy/test/selenium/webdriver/common/bidi_emulation_tests.py
is_onlineto check navigator.onLine status