-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[py]: reuse driver in case of bidi tests #16597
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 Compliance Guide 🔍(Compliance updated until commit dad0ca9)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 Previous compliance checksCompliance check up to commit bcd7095
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
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.
As long as all tests pass and we are cleaning up everything, this should be a pretty huge improvement in the time it takes to run tests.
Yup, all the tests ran much quicker than ever except the 2 windows tests, I don't know what's wrong with them. Maybe, just a windows thing! Edit: there is significant reduction in windows tests too when compared to previous runs, from 1h40m to 37m approx. |
User description
🔗 Related Issues
💥 What does this PR do?
Reuses the driver instance while running bidi tests. Currently, we restart the driver between every bidi test, which increase the test execution time.
This change will reduce the test execution times for all browsers.
Although, we need to make sure all the tests, especially event handler tests are properly cleaned up in the end.
If a test requires a fully isolated driver, then we can use the
needs_fresh_drivermarker added in this PR.🔧 Implementation Notes
💡 Additional Considerations
🔄 Types of changes
PR Type
Enhancement, Tests
Description
Reuse driver instance across BiDi tests to reduce execution time
Add
needs_fresh_drivermarker for tests requiring isolationImplement window validity check instead of full driver restart
Clean up event handlers and network callbacks in BiDi tests
Diagram Walkthrough
flowchart LR A["BiDi Test Execution"] --> B{"needs_fresh_driver marker?"} B -->|Yes| C["Restart Driver"] B -->|No| D["Check Window Validity"] D -->|Invalid| E["Restart Driver"] D -->|Valid| F["Reuse Driver"] C --> G["Next Test"] E --> G F --> GFile Walkthrough
conftest.py
BiDi driver reuse with selective restart logicpy/conftest.py
instead of always restarting
needs_fresh_drivermarker check to allow selective full driverrestart when needed
ensure_valid_window()function to verify window handlevalidity before reusing driver
bidi_browsing_context_tests.py
Add event handler callback wait conditionpy/test/selenium/webdriver/common/bidi_browsing_context_tests.py
assertion
events_receivedlist lengthbidi_network_tests.py
Add network handler cleanup in BiDi testspy/test/selenium/webdriver/common/bidi_network_tests.py
pyproject.toml
Add needs_fresh_driver pytest markerpy/pyproject.toml
needs_fresh_driverpytest marker definitionrequirement