-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvalidation_script.py
More file actions
139 lines (125 loc) · 6.43 KB
/
Copy pathvalidation_script.py
File metadata and controls
139 lines (125 loc) · 6.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
import asyncio
import sys
from playwright.async_api import async_playwright
async def run():
async with async_playwright() as p:
browser = await p.chromium.launch(headless=True)
context = await browser.new_context()
# 1) Open digital_mind_web_ui.html and confirm status text
page = await context.new_page()
url_ui = "http://127.0.0.1:5500/digital_mind_web_ui.html?apiBase=http://127.0.0.1:8000"
print(f"--- 1) Opening Web UI: {url_ui} ---")
try:
await page.goto(url_ui, wait_until="networkidle", timeout=15000)
content = await page.content()
for term in ["API online", "Ready", "GitHub Brain online", "OpenAI Advisor", "GitHub Ingestion Limits"]:
found = term in content
print(f"Status '{term}': {'Found' if found else 'NOT FOUND'}")
except Exception as e:
print(f"Failed to load Web UI: {e}")
# 2) Open digital_mind_operator_dashboard.html and check for console errors
url_dash = "http://127.0.0.1:5500/digital_mind_operator_dashboard.html?apiBase=http://127.0.0.1:8000"
print(f"\n--- 2) Opening Operator Dashboard: {url_dash} ---")
dash_page = await context.new_page()
console_errors = []
dash_page.on("console", lambda msg: console_errors.append(msg.text) if msg.type == "error" else None)
try:
await dash_page.goto(url_dash, wait_until="networkidle", timeout=15000)
if console_errors:
print("Console Errors detected:")
for err in console_errors:
print(f" - {err}")
else:
print("No console errors detected on dashboard.")
except Exception as e:
print(f"Failed to load Dashboard: {e}")
# 3) Confirm GitHub Ingestion Limits panel and values
print("\n--- 3) Checking GitHub Ingestion Limits ---")
try:
panel = await dash_page.wait_for_selector("#limits-container, .limits-panel", timeout=5000)
limits_text = await dash_page.inner_text("#limits-container, .limits-panel")
print(f"Limits content: {limits_text.strip()}")
except Exception as e:
print("GitHub Ingestion Limits panel not found or empty.")
# 4 & 5) Ingest n8n-io/n8n
print("\n--- 4 & 5) Ingesting n8n-io/n8n ---")
try:
# Look for input and button
# Based on standard dashboard patterns, look for repo input
repo_input = await dash_page.wait_for_selector("input[placeholder*='repo'], #repo-url, #repo-name", timeout=5000)
await repo_input.fill("n8n-io/n8n")
# Handle potential dialogs
dash_page.on("dialog", lambda dialog: dialog.accept())
# Click ingest button
ingest_btn = await dash_page.wait_for_selector("button:has-text('Ingest'), button:has-text('Add')", timeout=5000)
await ingest_btn.click()
# Check for "too large" message and selective ingest
# Wait for some response
await asyncio.sleep(5)
content_after = await dash_page.content()
if "too large" in content_after.lower() or "limit" in content_after.lower():
print("Repo reported as too large or limit hit.")
selective_btn = await dash_page.query_selector("button:has-text('Selective Ingest')")
if selective_btn:
print("Found Selective Ingest button, clicking...")
await selective_btn.click()
# Wait for completion (long pole)
print("Waiting for selective ingest (up to 60s)...")
await asyncio.sleep(30)
else:
print("Selective Ingest button NOT found.")
else:
print("Ingest processed (or still in progress).")
except Exception as e:
print(f"Error during ingest step: {e}")
# 6) Confirm repo list contains n8n-io/n8n
print("\n--- 6) Checking Repo List ---")
try:
repo_list_text = await dash_page.inner_text("#repo-list, .repo-table, body")
if "n8n-io/n8n" in repo_list_text:
print("n8n-io/n8n found in repo list.")
# Note status
if "partial" in repo_list_text.lower() or "selective" in repo_list_text.lower():
print("Status indicates partial/selective ingest.")
else:
print("n8n-io/n8n NOT found in repo list.")
except Exception as e:
print(f"Error checking repo list: {e}")
# 7) View Report for n8n
print("\n--- 7) Viewing Report ---")
try:
report_btn = await dash_page.query_selector("button:has-text('View Report')") # Simple heuristic
if report_btn:
await report_btn.click()
await asyncio.sleep(3)
print("Clicked View Report. Checking for crash/errors...")
# If we are still on a page with content and no new console errors
if not console_errors:
print("Report seems to have rendered without immediate console errors.")
else:
print("View Report button not found.")
except Exception as e:
print(f"Error viewing report: {e}")
# 8) Search for n8n
print("\n--- 8) Searching for n8n ---")
try:
search_input = await dash_page.wait_for_selector("input[placeholder*='Search'], #search-query", timeout=5000)
await search_input.fill("n8n functionality")
await search_input.press("Enter")
await asyncio.sleep(3)
results = await dash_page.inner_text("#search-results, .results-container, body")
if "n8n" in results.lower():
print("Search results for n8n found.")
else:
print("No clear search results for n8n found.")
except Exception as e:
print(f"Error during search: {e}")
# 9) Existing repo: mem0ai/mem0
print("\n--- 9) Checking existing repo (mem0ai/mem0) ---")
all_text = await dash_page.inner_text("body")
if "mem0ai/mem0" in all_text:
print("Existing repo 'mem0ai/mem0' is still visible.")
else:
print("Existing repo 'mem0ai/mem0' not found.")
await browser.close()
asyncio.run(run())