Refactor WebUI to reduce flakiness with retry logic and better waits#1
Conversation
- Refactor `waitForPageLoaded` to handle exceptions during JS execution more safely. - Implement retry logic in `clickElement` and `setText` to handle `StaleElementReferenceException` and `ElementClickInterceptedException`. - Reduce hardcoded `sleep` durations and replace with `waitForPageLoaded` where appropriate. - Optimize `uploadFileWithLocalForm` and file verification methods.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
This change improves the stability of the Selenium automation framework by addressing common causes of flaky tests.
Key changes:
waitForPageLoaded: Wrapped the initial JS check in a try-catch block to prevent unchecked exceptions from crashing the test flow when the driver is in an unstable state.clickElementandsetTextmethods. This automatically recovers fromStaleElementReferenceException(common in dynamic apps) andElementClickInterceptedException(common with overlays/spinners).sleep(3)calls withwaitForPageLoaded()or reduced sleep times where explicit waits weren't fully applicable but a shorter delay suffices.These changes aim to make the
WebUIutility class more resilient to timing issues and dynamic DOM updates.PR created automatically by Jules for task 14217734582414245073 started by @anhtester