Files
PlantAI-rag-new/tests/e2e/smoke.spec.js
T
jerryandClaude Fable 5 1e94de7464 PlantAI-rag-new 首次提交:文献知识工作台
- BFF 薄适配层(FastAPI,8090):QA 代理/SSE 中继/Neo4j 直连/抽取代理/会话持久化
- Vue3 前端:五相位检索流水线、文献来源与证据链、知识图谱、提取任务四 tab
- 四档响应式(桌面/笔记本/平板/手机)、深浅主题
- 81 个 FR 全部实现,测试追溯矩阵 81/81,后端 121 测/前端 156 测
- 真实凭据已脱敏,运行时配置在 backend/.env(不入 git)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-25 20:47:52 +08:00

45 lines
2.3 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// smoke.spec.js —— L5 冒烟骨架(本波仅 2 条)。
// 每一条在 mobile(390×844)/tablet(768×1024)/desktop(1440×900) 三项目上各执行一次。
// 对应 docs/TEST_CASES.md:TC-E2E-SMOKE-01(页面加载)、TC-E2E-SMOKE-02(AppShell 存在)。
//
// 契约依据:UI_SPEC.md §5.3 类名(app-shell/top-bar/status-bar/session-panel/chat-panel/bench-panel)。
// 说明:M0 阶段 AppShell 尚未实现(App.vue 为占位),AppShell 断言带占位回退(app-shell-placeholder),
// B1 交付后断言即走真实分支。完整用例(TC-E2E-01~11)在后续轮次按 TEST_CASES.md 补齐。
import { test, expect } from '@playwright/test';
// 项目:mobile/tablet/desktop(playwright.config.js projects)。三档视口下页面可加载。
test('TC-E2E-SMOKE-01 | 页面加载:首屏可渲染,标题正确', async ({ page }) => {
await page.goto('/');
await expect(page).toHaveTitle(/海古纪 PlantAI/);
// #app 挂载且非空(M0 为占位文案,M1 起为 AppShell)
const app = page.locator('#app');
await expect(app).toBeVisible();
const html = (await app.innerHTML()).trim();
expect(html.length, '#app 不应为空').toBeGreaterThan(0);
});
// 项目:mobile/tablet/desktop。AppShell 骨架存在。
// M0 回退:仅断言 #app 内容;M1 起断言 shell 三要素与占位符消失。
// 注意:移动端底栏按 FR-RESP-004 有意隐藏(四个 agent 点合并为顶栏聚合状态点),
// 因此 .status-bar 只在 ≥768px 视口断言可见,移动端断言隐藏。
test('TC-E2E-SMOKE-02 | AppShell 存在:壳层三要素渲染(含 M0 占位回退)', async ({ page }) => {
await page.goto('/');
const shell = page.locator('.app-shell');
const placeholder = page.locator('.app-shell-placeholder');
if (await shell.count()) {
// M1+:B1 交付的真实三栏壳层
await expect(shell).toBeVisible();
await expect(page.locator('.top-bar')).toBeVisible();
const width = (await page.viewportSize()).width;
if (width >= 768) {
await expect(page.locator('.status-bar')).toBeVisible();
} else {
await expect(page.locator('.status-bar')).toBeHidden();
}
await expect(placeholder).toHaveCount(0);
} else {
// M0:脚手架占位期,AppShell 未实现时仅验证页面可渲染
await expect(placeholder).toBeVisible();
}
});