test: update and add E2E, integration, visual, and webapp tests
Some checks failed
CI / scheduled-backup (push) Failing after 36s
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

- Update E2E tests: announcements, auth, auth-business-flow, full-route-regression, grades, navigation, smoke-auth, teacher-web-test

- Update integration tests: api-ai-chat, api-onboarding-complete, api-onboarding-status, proxy-guard, integration setup

- Update visual regression tests: admin-dashboard, homepage, student-dashboard, teacher-dashboard, visual config, helpers

- Update webapp tests: admin, parent, student full tests and debug scripts

- Add new webapp tests: announcements_messages, settings_profile, debug scripts

- Add webtest directory with test plans, screenshots, and diagnostic scripts
This commit is contained in:
SpecialX
2026-06-23 17:39:40 +08:00
parent f40ce0f560
commit d884c6d513
183 changed files with 19006 additions and 0 deletions

51
webtest/diag6_login.py Normal file
View File

@@ -0,0 +1,51 @@
"""诊断登录流程 - 详细版"""
import re
from playwright.sync_api import sync_playwright
BASE_URL = "http://localhost:3000"
with sync_playwright() as p:
browser = p.chromium.launch(headless=True)
context = browser.new_context()
page = context.new_page()
# 监听响应
def on_response(response):
url = response.url
if '/api/auth' in url or '/login' in url or '/teacher' in url:
print(f"[response] {response.status} {url[:100]}")
page.on("response", on_response)
page.on("pageerror", lambda err: print(f"[pageerror] {err}"))
print(">>> 访问登录页...")
page.goto(f"{BASE_URL}/login", timeout=30000)
page.wait_for_load_state("networkidle", timeout=15000)
page.wait_for_timeout(1000)
print("\n>>> 填写表单...")
page.locator('input[name="email"]').fill("t_chinese_1@xiaoxue.edu.cn")
page.locator('input[name="password"]').fill("123456")
print(">>> 点击登录按钮...")
page.get_by_role("button", name=re.compile(r"Sign In with Email", re.I)).click()
# 等待跳转
try:
page.wait_for_url("**/teacher/**", timeout=15000)
print(f"✓ 跳转成功: {page.url}")
except Exception:
print(f"✗ 未跳转到 /teacher/*,当前 URL: {page.url}")
page.wait_for_timeout(3000)
print(f"最终 URL: {page.url}")
# 截图
page.screenshot(path="webtest/diag6_after_login.png", full_page=True)
print("截图已保存: webtest/diag6_after_login.png")
# 检查页面内容
body_text = page.locator('body').text_content() or ""
print(f"\n页面文本前 500 字符: {body_text[:500]}")
browser.close()