MQL5-Google-Onedrive/verification/verify_dashboard.py

54 lines
2.1 KiB
Python
Raw Permalink Normal View History

from playwright.sync_api import sync_playwright
def run():
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
page = browser.new_page()
# Test index.html (Static PWA)
print("Testing index.html...")
page.goto("file:///app/index.html")
page.screenshot(path="/app/verification/index_page.png")
# Check if copy button exists
fly_app_copy_btn = page.get_by_label("Copy Fly.io App ID")
if fly_app_copy_btn.count() > 0:
print("Fly.io App copy button found on index.html.")
fly_app_copy_btn.click()
page.wait_for_timeout(1000) # Wait for animation
page.screenshot(path="/app/verification/index_page_clicked.png")
else:
print("Fly.io App copy button NOT found on index.html.")
# Test web_dashboard.py (Dynamic Flask)
print("Testing scripts/web_dashboard.py (localhost:8080)...")
try:
page.goto("http://localhost:8080")
page.screenshot(path="/app/verification/dashboard_page.png")
# Check if copy button exists
# We didn't add IDs to the status values in web_dashboard.py, just the structure.
# Look for button near text "mql5-automation"
# Or use aria-label
fly_copy_btn = page.get_by_label("Copy Fly.io App ID")
if fly_copy_btn.count() > 0:
print("Fly.io App copy button found on dynamic dashboard.")
fly_copy_btn.click()
page.wait_for_timeout(1000)
page.screenshot(path="/app/verification/dashboard_page_clicked.png")
else:
print("Fly.io App copy button NOT found on dynamic dashboard.")
except Exception as e:
print(f"Failed to load localhost:8080: {e}")
# Check logs
try:
with open("/app/logs/web_dashboard.log", "r") as f:
print(f.read())
except FileNotFoundError:
print("Log file not found.")
browser.close()
if __name__ == "__main__":
run()