[py] Fix flaky WebDriverWait tests #15650
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
User description
💥 What does this PR do?
This PR adjusts many of the wait times in our internal tests for
WebDriverWait
(inwebdriverwait_tests.py
) to make the tests less flaky. These tests are very timing dependent and sometimes fail on slow systems (we often get CI failures due to this).These changes raise most wait times to 5 seconds to account for elements loading too slow, and reduces wait times to 0.01 seconds in tests for timeouts so the timeouts occur more consistently.
Overall, this should reduce flakiness and keep CI green more often.
💡 Additional Considerations
The tests could still be flaky on very slow systems. There's no real way around this without making the tests extremely slow all the time.
🔄 Types of changes
PR Type
Tests, Bug fix
Description
Increased wait times in positive WebDriverWait tests to 5 seconds
Decreased wait times in negative/timeout tests to 0.01 seconds
Reduces test flakiness, especially in CI environments
No production code changes; test-only improvements
Changes walkthrough 📝
webdriverwait_tests.py
Adjust WebDriverWait timeouts to improve test reliability
py/test/selenium/webdriver/common/webdriverwait_tests.py
seconds