Extend endpoint and browser tests for ESPNow and UI
Add coverage for /presets/send and updated tab/preset UI workflows in HTTP and Selenium tests.
This commit is contained in:
@@ -398,42 +398,49 @@ def test_tabs_ui(browser: BrowserTest) -> bool:
|
||||
except Exception as e:
|
||||
print(f"✗ Failed to create tab via UI: {e}")
|
||||
|
||||
# Test 4: Edit a tab via UI
|
||||
# Test 4: Edit a tab via UI (right-click in Tabs list)
|
||||
total += 1
|
||||
try:
|
||||
# Find edit button (should be in the tabs list)
|
||||
# First, close and reopen modal to refresh
|
||||
browser.click_element(By.ID, 'tabs-close-btn')
|
||||
time.sleep(0.5)
|
||||
browser.click_element(By.ID, 'tabs-btn')
|
||||
time.sleep(0.5)
|
||||
|
||||
# Look for edit button - it should be in a profiles-row
|
||||
edit_buttons = browser.driver.find_elements(By.XPATH, "//button[contains(text(), 'Edit')]")
|
||||
if edit_buttons:
|
||||
# Use JavaScript click to avoid interception
|
||||
browser.driver.execute_script("arguments[0].click();", edit_buttons[0])
|
||||
# Right-click the row corresponding to 'Browser Test Tab'
|
||||
try:
|
||||
tab_row = browser.driver.find_element(
|
||||
By.XPATH,
|
||||
"//div[@id='tabs-list-modal']//div[contains(@class,'profiles-row')][.//span[contains(text(), 'Browser Test Tab')]]"
|
||||
)
|
||||
except Exception:
|
||||
tab_row = None
|
||||
|
||||
if tab_row:
|
||||
actions = ActionChains(browser.driver)
|
||||
actions.context_click(tab_row).perform()
|
||||
time.sleep(0.5)
|
||||
|
||||
# Check if edit modal opened
|
||||
edit_modal = browser.wait_for_element(By.ID, 'edit-tab-modal')
|
||||
if edit_modal:
|
||||
print("✓ Edit modal opened")
|
||||
print("✓ Edit modal opened via right-click")
|
||||
# Fill in new name
|
||||
if browser.fill_input(By.ID, 'edit-tab-name', 'Edited Browser Tab'):
|
||||
print(" ✓ Filled new tab name")
|
||||
# Submit form
|
||||
edit_form = browser.wait_for_element(By.ID, 'edit-tab-form')
|
||||
if edit_form:
|
||||
edit_form.submit()
|
||||
browser.driver.execute_script("arguments[0].submit();", edit_form)
|
||||
time.sleep(1) # Wait for update
|
||||
print("✓ Submitted edit form")
|
||||
passed += 1
|
||||
else:
|
||||
print("✗ Edit form not found")
|
||||
else:
|
||||
print("✗ Edit modal didn't open")
|
||||
print("✗ Edit modal didn't open after right-click")
|
||||
else:
|
||||
print("✗ No edit buttons found (might need to create a tab first)")
|
||||
print("✗ Could not find tab row for 'Browser Test Tab'")
|
||||
except Exception as e:
|
||||
print(f"✗ Failed to edit tab via UI: {e}")
|
||||
import traceback
|
||||
|
||||
@@ -332,7 +332,22 @@ def test_presets(client: TestClient) -> bool:
|
||||
else:
|
||||
print(f"✗ PUT /presets/{preset_id} - Status: {response.status_code}")
|
||||
|
||||
# Test 5: Delete preset
|
||||
# Test 5: Send preset via /presets/send
|
||||
total += 1
|
||||
try:
|
||||
send_body = {"preset_ids": [preset_id]}
|
||||
response = client.post('/presets/send', json_data=send_body)
|
||||
if response.status_code == 200:
|
||||
data = response.json()
|
||||
sent = data.get('presets_sent')
|
||||
print(f"✓ POST /presets/send - Sent presets (presets_sent={sent})")
|
||||
passed += 1
|
||||
else:
|
||||
print(f"✗ POST /presets/send - Status: {response.status_code}, Response: {response.text}")
|
||||
except Exception as e:
|
||||
print(f"✗ POST /presets/send - Error: {e}")
|
||||
|
||||
# Test 6: Delete preset
|
||||
total += 1
|
||||
response = client.delete(f'/presets/{preset_id}')
|
||||
if response.status_code == 200:
|
||||
|
||||
Reference in New Issue
Block a user