[tests] Fix ChromeDriver timeouts and restore removed Selenium tests#585
Draft
[tests] Fix ChromeDriver timeouts and restore removed Selenium tests#585
Conversation
This commit addresses the random hangs and crashes in Selenium tests with websockets on GitHub Actions (issue #582). Changes: - Added explicit timeout configuration to ChromeDriver (page load, script, implicit wait) - Increased WebDriverWait timeout values for CI environments - Added configurable timeout parameters (webdriver_wait_timeout, websocket_wait_timeout) - Replaced time.sleep() with explicit WebDriverWait in alert handling - Restored test_websocket_marker for real-time websocket communication - Restored test_topology_graph for network topology visualization - Restored test_create_prefix_users for RADIUS batch operations - Added comprehensive documentation in tests/SELENIUM_FIXES.md All restored tests now use increased timeouts and improved error handling to prevent ChromeDriver hangs and ReadTimeoutError exceptions. Agent-Logs-Url: https://github.com/openwisp/docker-openwisp/sessions/e6e9f9d3-3c38-4f93-9cb5-e8273e4289ac Co-authored-by: pandafy <32094433+pandafy@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Checklist
Reference to Existing Issue
Closes #582.
Description of Changes
Selenium tests were intermittently hanging on GitHub Actions with
ReadTimeoutErrorwhen ChromeDriver became unresponsive. This particularly affected websocket tests removed in PR #581.Root causes:
time.sleep()used instead of explicit waits for alert handlingChanges:
ChromeDriver timeout configuration (
tests/utils.py)get_chrome_webdriver()to set explicit timeouts:set_page_load_timeout(60)- prevents indefinite page load hangsset_script_timeout(60)- handles async script executionimplicitly_wait(10)- element search timeoutConfigurable timeout values (
tests/config.json)webdriver_wait_timeout: 20- general WebDriverWait operationswebsocket_wait_timeout: 30- websocket connection establishmentAlert handling improvements (
tests/utils.py)Test updates
test_device_monitoring_charts,test_forgot_password: use configurable timeoutstest_websocket_marker: real-time location updates via websockets (30s timeout)test_topology_graph: network visualization with proper wait sequencestest_create_prefix_users: RADIUS batch operations with PDF generationtest_console_errorsDocumentation
Added
tests/SELENIUM_FIXES.mdwith troubleshooting guide and best practices for future test development.Screenshot
N/A - Test infrastructure changes only.