-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
[java] Fix flaky tests #16862
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
[java] Fix flaky tests #16862
Conversation
1. When a previous test env was non-"secure", 2. And the current test env is "secure", 3. Then "appServer" was still referring the previous non-secure env. So the test failed with WebDriverException "Reached error page: about:neterror?e=dnsNotFound&u=https%3A//not_a_valid_url.test/&c=UTF-8&d=We%20can%E2%80%99t%20connect%20to%20the%20server%20at%20not_a_valid_url.test" I wonder how it worked at all...
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:
|
|||||||||||||||||
BiDiSessionCleanUpTest left the browser open if the test failed.
Otherwise, method `NettyServer.stop` failed with NPE because `this.channel` was null.
02e5803 to
0daa50f
Compare
User description
💥 What does this PR do?
Fixes few Java tests
🔧 Implementation Notes
See every commit separately
🔄 Types of changes
PR Type
Bug fix
Description
Prevent NPE in NettyServer.stop() when called on already stopped server
Fix appServer reference after test environment restart with secure mode
Ensure browser cleanup in BiDiSessionCleanUpTest using @AfterEach
Refactor test setup to use field initialization instead of manual setup
Diagram Walkthrough
File Walkthrough
NettyServer.java
Prevent NPE when stopping already stopped serverjava/src/org/openqa/selenium/netty/server/NettyServer.java
isStarted()check at beginning ofstop()method to prevent NPEthis.channelBiDiSessionCleanUpTest.java
Add guaranteed browser cleanup with @AfterEachjava/test/org/openqa/selenium/bidi/BiDiSessionCleanUpTest.java
@AfterEachmethod to ensure browser cleanup even if test failsdriveras field with BiDi-enabled FirefoxOptionsdriver.quit()calls from test methodsNoSuchSessionExceptionin cleanup for already-closed browsersfinaland reorganize importsJupiterTestBase.java
Update appServer reference after environment restartjava/test/org/openqa/selenium/testing/JupiterTestBase.java
appServerreference after restarting test environment in securemode
environment