feat: 新增备课模块并修复全模块 P0/P1/P2 缺陷
Some checks failed
Security / deep-security-scan (push) Failing after 20m5s
DR Drill / dr-drill (push) Failing after 1m31s
CI / scheduled-backup (push) Failing after 1m31s
CI / backup-verify (push) Has been skipped
CI / weekly-dr-drill (push) Failing after 0s
CI / build-deploy (push) Has been cancelled
CI / security-scan (push) Has been cancelled
Some checks failed
Security / deep-security-scan (push) Failing after 20m5s
DR Drill / dr-drill (push) Failing after 1m31s
CI / scheduled-backup (push) Failing after 1m31s
CI / backup-verify (push) Has been skipped
CI / weekly-dr-drill (push) Failing after 0s
CI / build-deploy (push) Has been cancelled
CI / security-scan (push) Has been cancelled
主要变更: - 新增 lesson-preparation 模块: 备课编辑器、节点编辑、AI 建议、知识点选择、版本历史、作业发布 - 新增 shared 通用组件: charts/question-bank-filters/schedule-list/ui (chip-nav/filter-bar/page-header/stat-card/stat-item) - 新增 student/admin 端 loading.tsx 与 error.tsx, 优化加载与错误态体验 - 新增 teacher/lesson-plans 页面 (列表/新建/编辑) - 新增 drizzle 迁移 0002_tiny_lionheart 及 snapshot - 新增 textbooks/schema.ts 与 exams/utils/normalize-structure.ts - 修复 Tiptap v3 SSR hydration 崩溃 (rich-text-block immediatelyRender: false) - 重构多模块 data-access/actions/组件, 修复权限校验与类型规范 - 同步架构文档 004/005 反映新增模块、导出、依赖关系 - 归档 bugs/* 测试报告与 e2e 测试脚本 (admin/parent/student/teacher web_test)
This commit is contained in:
103
bugs/test_node_editor.py
Normal file
103
bugs/test_node_editor.py
Normal file
@@ -0,0 +1,103 @@
|
||||
"""测试节点图编辑器"""
|
||||
from playwright.sync_api import sync_playwright
|
||||
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(headless=True)
|
||||
context = browser.new_context(viewport={"width": 1400, "height": 900})
|
||||
page = context.new_page()
|
||||
|
||||
errors = []
|
||||
console_msgs = []
|
||||
page.on("console", lambda msg: console_msgs.append(f"[{msg.type}] {msg.text}"))
|
||||
page.on("pageerror", lambda err: errors.append(str(err)))
|
||||
|
||||
# 登录
|
||||
print("=== 登录 ===")
|
||||
page.goto("http://localhost:3000/login", wait_until="networkidle", timeout=30000)
|
||||
page.locator("input[name='email']").fill("t_chinese_1@xiaoxue.edu.cn")
|
||||
page.locator("input[name='password']").fill("123456")
|
||||
page.get_by_role("button", name="Sign In", exact=False).click()
|
||||
try:
|
||||
page.wait_for_url("**/dashboard**", timeout=15000)
|
||||
except Exception:
|
||||
page.wait_for_load_state("networkidle", timeout=10000)
|
||||
print(f"登录后: {page.url}")
|
||||
|
||||
# 新建课案
|
||||
print("\n=== 新建课案 ===")
|
||||
page.goto("http://localhost:3000/teacher/lesson-plans/new", wait_until="networkidle", timeout=30000)
|
||||
page.locator("input[placeholder*='秋天']").fill("节点图测试")
|
||||
page.locator("button[type='button']:has-text('常规课')").click()
|
||||
page.wait_for_timeout(500)
|
||||
page.get_by_role("button", name="创建课案", exact=False).click()
|
||||
try:
|
||||
page.wait_for_url("**/edit**", timeout=15000)
|
||||
except Exception:
|
||||
pass
|
||||
print(f"编辑页: {page.url}")
|
||||
|
||||
if "/edit" in page.url:
|
||||
print("进入编辑页!")
|
||||
page.wait_for_timeout(5000) # 等待 React Flow 渲染
|
||||
page.screenshot(path="e:/Desktop/CICD/bugs/v3_node_editor.png", full_page=True)
|
||||
|
||||
# 检查 React Flow 画布是否存在
|
||||
rf_canvas = page.locator(".react-flow")
|
||||
print(f"React Flow 画布数量: {rf_canvas.count()}")
|
||||
|
||||
# 检查节点数量
|
||||
nodes = page.locator(".react-flow__node")
|
||||
print(f"节点数量: {nodes.count()}")
|
||||
|
||||
# 检查边数量
|
||||
edges = page.locator(".react-flow__edge")
|
||||
print(f"边数量: {edges.count()}")
|
||||
|
||||
# 检查控件
|
||||
controls = page.locator(".react-flow__controls")
|
||||
print(f"控件数量: {controls.count()}")
|
||||
|
||||
# 检查 minimap
|
||||
minimap = page.locator(".react-flow__minimap")
|
||||
print(f"小地图数量: {minimap.count()}")
|
||||
|
||||
# 测试添加节点
|
||||
print("\n=== 测试添加节点 ===")
|
||||
add_btn = page.get_by_role("button", name="添加节点", exact=False)
|
||||
if add_btn.count() > 0:
|
||||
add_btn.click()
|
||||
page.wait_for_timeout(500)
|
||||
# 点击第一个节点类型
|
||||
menu_items = page.locator("button:has-text('教学目标')")
|
||||
if menu_items.count() > 0:
|
||||
menu_items.first.click()
|
||||
page.wait_for_timeout(1000)
|
||||
nodes_after = page.locator(".react-flow__node")
|
||||
print(f"添加后节点数量: {nodes_after.count()}")
|
||||
page.screenshot(path="e:/Desktop/CICD/bugs/v3_after_add.png", full_page=True)
|
||||
|
||||
# 测试点击节点选中
|
||||
print("\n=== 测试节点选中 ===")
|
||||
if nodes.count() > 0:
|
||||
nodes.first.click()
|
||||
page.wait_for_timeout(1000)
|
||||
page.screenshot(path="e:/Desktop/CICD/bugs/v3_node_selected.png", full_page=True)
|
||||
# 检查侧边面板是否出现
|
||||
panel = page.locator("text=点击节点编辑内容")
|
||||
panel_selected = page.locator("input[value]")
|
||||
print(f"侧边面板可见: {panel.count() > 0 or panel_selected.count() > 0}")
|
||||
|
||||
# 错误输出
|
||||
print("\n=== 页面错误 ===")
|
||||
for e in errors:
|
||||
print(f" ERROR: {e[:200]}")
|
||||
if not errors:
|
||||
print(" 无")
|
||||
|
||||
print("\n=== 控制台 error/warning ===")
|
||||
for m in console_msgs:
|
||||
if m.startswith("[error]") or m.startswith("[warning]"):
|
||||
print(f" {m[:200]}")
|
||||
|
||||
browser.close()
|
||||
print("\n完成")
|
||||
Reference in New Issue
Block a user