mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2026-01-24 14:48:26 -05:00
New Features: - API endpoints now support comprehensive input validation with detailed error responses via Pydantic models. - OpenAPI specification endpoint (/openapi.json) and interactive Swagger UI documentation (/docs) now available for API discovery. - Enhanced MCP session lifecycle management with create, retrieve, and delete operations. - Network diagnostic tools: traceroute, nslookup, NMAP scanning, and network topology viewing exposed via API. - Device search, filtering by status (including 'offline'), and bulk operations (copy, delete, update). - Wake-on-LAN functionality for remote device management. - Added dynamic tool disablement and status reporting. Bug Fixes: - Fixed get_tools_status in registry to correctly return boolean values instead of None for enabled tools. - Improved error handling for invalid API inputs with standardized validation responses. - Fixed OPTIONS request handling for cross-origin requests. Refactoring: - Significant refactoring of api_server_start.py to use decorator-based validation (@validate_request).
47 lines
1.6 KiB
Python
47 lines
1.6 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Network Page UI Tests
|
|
Tests network topology visualization and device relationships
|
|
"""
|
|
|
|
from selenium.webdriver.common.by import By
|
|
from selenium.webdriver.support.ui import WebDriverWait
|
|
from selenium.webdriver.support import expected_conditions as EC
|
|
|
|
from .test_helpers import BASE_URL, wait_for_page_load
|
|
|
|
|
|
def test_network_page_loads(driver):
|
|
"""Test: Network page loads successfully"""
|
|
driver.get(f"{BASE_URL}/network.php")
|
|
WebDriverWait(driver, 10).until(
|
|
EC.presence_of_element_located((By.TAG_NAME, "body"))
|
|
)
|
|
wait_for_page_load(driver, timeout=10)
|
|
assert driver.title, "Network page should have a title"
|
|
|
|
|
|
def test_network_tree_present(driver):
|
|
"""Test: Network tree container is rendered"""
|
|
driver.get(f"{BASE_URL}/network.php")
|
|
wait_for_page_load(driver, timeout=10)
|
|
tree = driver.find_elements(By.ID, "networkTree")
|
|
assert len(tree) > 0, "Network tree should be present"
|
|
|
|
|
|
def test_network_tabs_present(driver):
|
|
"""Test: Network page loads successfully"""
|
|
driver.get(f"{BASE_URL}/network.php")
|
|
wait_for_page_load(driver, timeout=10)
|
|
# Check page loaded without fatal errors
|
|
assert "fatal" not in driver.page_source.lower(), "Page should not show fatal errors"
|
|
assert len(driver.page_source) > 100, "Page should load content"
|
|
|
|
|
|
def test_device_tables_present(driver):
|
|
"""Test: Device tables are rendered"""
|
|
driver.get(f"{BASE_URL}/network.php")
|
|
wait_for_page_load(driver, timeout=10)
|
|
tables = driver.find_elements(By.CSS_SELECTOR, ".networkTable, table")
|
|
assert len(tables) > 0, "Device tables should be present"
|