Conversation
* update JUnit and Selenium dependencies * add missing dependencies to Gradle script * add IDEA- and Gradle- specific files to .gitignore
* always wrap `driver.quit()` into `if (driver != null)` to avoid NPE if the browser hadn't been started due to some error * mark the closing @AfterEach method as final to avoid occasional overriding in subclasses * No need to call `driver.quit()` in `BaseTest` subclasses because it's already done by `BaseTest`.
✅ Deploy Preview for selenium-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
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:
|
|||||||||||||
|
I see multiple flaky tests here... Will tackle them in a following PR. |
examples/java/src/test/java/dev/selenium/elements/InformationTest.java
Outdated
Show resolved
Hide resolved
examples/java/src/test/java/dev/selenium/elements/InformationTest.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Swastik Baranwal <swstkbaranwal@gmail.com>
|
@diemol Just in case, I cannot merge this PR by myself... :( |
|
@diemol The example on site is still outdated: https://www.selenium.dev/documentation/webdriver/getting_started/using_selenium/#tabs-8-content Is there some other GA build that should publish Java code to the site? |
User description
Description
fix IDEA setup for Java project
fix closing WebDriver after tests
driver.quit()intoif (driver != null)to avoid NPE if the browser hadn't been started due to some errordriver.quit()inBaseTestsubclasses because it's already done byBaseTest.Motivation and Context
Avoid spreading typical errors. First of all, this bad method:
it will cause NPE if the driver hadn't even been started (due to some previous error).
Types of changes
Checklist
PR Type
Enhancement, Bug fix
Description
Update Selenium and JUnit dependencies to latest versions
Refactor WebDriver cleanup to prevent NPE and improve code consistency
driver.quit()with null checks in all test classesfinalto prevent overridingdriver.quit()calls from individual test methodsImprove code formatting and style consistency across test files
Add missing test scope to selenium-logger dependency
Diagram Walkthrough
File Walkthrough
1 files
Update Selenium and JUnit dependencies5 files
Refactor cleanup method with null checks and final modifierAdd null check to driver cleanup in AfterAllAdd null checks and remove redundant quit callsAdd null check and final modifier to teardown methodCentralize driver cleanup with AfterEach and fix formatting4 files
Remove redundant driver.quit() call from test methodRemove redundant driver.quit() calls from test methodsRemove redundant endSession cleanup methodRemove try-finally blocks and rely on base class cleanup2 files
Fix indentation and formatting consistencyRemove unused import statement