Skip to content

[py] Fix flaky WebDriverWait tests #15650

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

Merged

Conversation

cgoldberg
Copy link
Contributor

@cgoldberg cgoldberg commented Apr 20, 2025

User description

💥 What does this PR do?

This PR adjusts many of the wait times in our internal tests for WebDriverWait (in webdriverwait_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

  • Internal/CI
  • Bug fix (backwards compatible)

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 📝

Relevant files
Tests
webdriverwait_tests.py
Adjust WebDriverWait timeouts to improve test reliability

py/test/selenium/webdriver/common/webdriverwait_tests.py

  • Increased wait durations for positive/element-present tests to 5
    seconds
  • Decreased wait durations for negative/timeout tests to 0.01 seconds
  • Updated all relevant WebDriverWait usages for consistency
  • No changes to test logic or production code
  • +49/-49 

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • @selenium-ci selenium-ci added the C-py Python Bindings label Apr 20, 2025
    Copy link
    Contributor

    qodo-merge-pro bot commented Apr 20, 2025

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    @SeleniumHQ SeleniumHQ deleted a comment from qodo-merge-pro bot Apr 20, 2025
    @cgoldberg cgoldberg merged commit 65fcc08 into SeleniumHQ:trunk Apr 20, 2025
    18 of 19 checks passed
    @cgoldberg cgoldberg deleted the py-fix-flaky-webdriverwait-tests branch April 20, 2025 22:58
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants