Files
FileCodeBoxFronted2026/tests/README.md
T
orion 3d70f67cf7 ✨ feat: 支持单个、选中及全量手动检测下载状态
* 默认关闭定时检测,取消页面加载、翻页和刷新列表触发检测
* 提供明确的检测可下载状态入口,支持全量跨分页和选中文件
* 逐个读取文件并显示进度,支持取消及过期响应隔离
* 保持检测结果标签与时间展示,验证桌面和移动端交互
* 补充手动范围、失败重试、取消及跨页全量检测的集成验收
2026-09-19 01:24:16 +08:00

146 lines
8.9 KiB
Markdown
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.
# Detail motion regression checks
Requires Node 22.6+ for the TypeScript unit tests (no extra test dependencies).
- `npm run test:motion`: animation completion, cancellation, reversal and reduced motion.
- `npm run test:motion:coverage`: coverage of `src/utils/detailMotion.ts` only.
Browser integration uses the actual Vue file-detail view and backend data. Start
Vite with the desired test backend, sign in, and open a file with more than three
lifecycle rows and at least one retrieval event. In that page's DevTools console:
```js
await (await import('/theme-assets/tests/detailMotion.browser.mjs')).runDetailMotionChecks()
```
Run again at 390px width, then with `prefers-reduced-motion: reduce` emulated:
```js
await (await import('/theme-assets/tests/detailMotion.browser.mjs')).runDetailMotionChecks({ reducedMotion: true })
```
Checks three expand/collapse cycles, nonidentical height endpoints, return to
natural height, visible retrieval records, no vertical record transform, rapid
reversals and final collapsed layout. It only toggles presentation and never
uploads, deletes, restores or changes file data. These checks do not measure
whole-project coverage or validate the storage implementation.
## Recycle bin information
- `npm run test:trash`: relative-time boundary tests and Vue SSR integration
checks for normal, urgent, permanent, purged and incomplete records.
- `npm run test:trash:coverage`: coverage of `src/utils/trashPresentation.ts` only.
Seven days is inclusive in both directions; older or more distant dates use
exact local date/time. Relative labels refresh every minute. Native title text
retains the exact date/time. The three-day cleanup warning is independent of
the seven-day formatting boundary. These tests do not modify backend data.
## 2026 buttons, palette and responsive controls
- `npm run test:ui`: palette text contrast, native action coverage, stationary
large sections, no submit hover overlays, and real Vue component SSR tests.
- With Vite running, open `/theme-assets/tests/ui-system.html` in a clean browser
window. Test at 320/390/430px and desktop widths; append `?dark` for dark mode.
The fixture uses real components and checks rendered heights, same-row pagination,
date part styling, leap-year changes and pagination emissions. It displays its
results; hover on buttons/cards to inspect motion without business operations.
The native UI harness is separate from server-side integration tests. Code
coverage for the existing motion/time helpers does not measure CSS coverage.
Final interaction rules: large settings/table/section containers stay fixed;
inner cards and action buttons retain their motion. List rows only fade their
background with no border or box-shadow. Light card shadows are bright at the
upper left and shaded at the lower right; dark mode reverses that direction.
Primary submit actions must not add white/gradient hover overlays.
## 清理失败弹窗
`purgeFailure.browser.mjs` 导出 `runPurgeFailureChecks(page, failure)`,接受独立
Playwright Page。Vite 固定运行于 `127.0.0.1:5180`;分别传入 `http` 和 `network`
验证服务端 500、断网时错误显示于弹窗内、原记录保留,以及重新打开时清空旧错误。
测试拦截全部管理 API,不会修改部署实例。
## 本地文件分享
- `localShare.test.mjs`:目录导航、路径原样保留、有效期白名单与输入边界。
- `localShare.integration.test.mjs`:真实 Vue 状态与服务边界,覆盖目录响应乱序、重复提交、失败重试。
- `localShare.browser.mjs`:导出 `runLocalShareChecks(page, dark)`;Vite 运行于
`127.0.0.1:5180`。管理 API 全部拦截为独立数据,覆盖目录/搜索/分页、生成失败重试、
取件码/链接复制、空目录/加载错误和移动端溢出检查。
## WebDAV 后台完成上传
`uploadCompletion.test.mjs` 覆盖 202 轮询、临时网络错误重试及明确失败退出;
`uploadStrategy.integration.test.mjs` 验证用户在丢失完成响应后手动重试时复用原上传 ID,
不重新上传分片。发送页在此阶段显示文件校验提示,确认成功后才给出取件码。
## 中断上传与历史状态
`uploadCancellation.integration.test.mjs` 验证中断当前请求、等待初始化返回会话后清理、
清理失败后重试及同文件重新上传。`cancelUpload.browser.mjs` 使用隔离 API 数据验证
发送页“中断上传”按钮和清理反馈,不会访问线上文件。
`historyStatus.test.mjs` 验证回收站原因共用标签、已清理、恢复后的现存状态。
分片使用原始请求体发送,最大 100 MiB,避免 multipart 额外开销超过 CDN 上限。
## 可配置分片大小
`uploadStrategy.integration.test.mjs` 验证配置决定新会话请求大小,服务端返回的
会话大小决定续传切片。`chunkSizeSettings.browser.mjs` 验证真实设置页面拒绝无效值、
保存/刷新后保留以及发送页读取公共配置;全部 API 拦截为隔离数据。
## 可下载状态
`downloadChecks.integration.test.mjs` 覆盖当前页批量检测、分页乱序响应隔离、
请求失败与重试、间隔保存及失败保留旧值、自动刷新与离开页面取消、状态组件渲染。
沿用 `node --experimental-strip-types --test --experimental-test-coverage tests/*.test.mjs`。
真实测试站验收另验证 WebDAV 小文件上传、检测不扣次数、桌面/移动端显示和间隔持久化;
验收完成后恢复间隔并清理验收文件。
## 查件与取件时间
- `receiveRecord.test.mjs`:旧日期按查件时间兼容、ISO 显示、最近下载时间独立更新。
- `retrieveTimes.integration.test.mjs`:真实 Vue/Pinia 查件流程、两种时间分离、
再次查件保留取件时间、重复下载更新、无下载动作不生成取件时间、弹窗与列表文案。
- 浏览器验收:测试站创建独立次数限制文件,查件不扣次数,分别点击弹窗和记录下载,
核对显示时间及后台次数,结束后清理测试文件。
- 表头验收:1440/1024/800px 下所有表头单行,390px 移动端无页面横向溢出。
### 表格列宽、查件生命周期和筛选动画
- `columnWidth.test.mjs` 覆盖指定列增减宽度、最小宽度及相邻列不受影响。
- `retrieveTimes.integration.test.mjs` 同时验证签名文本下载入口,以及查件和取件事件的顺序与显示。
- `tests/browser/admin-tables.cjs` 用真实浏览器验证所有文件、历史文件、下载排行表头居中及拖拽,
包括键盘调整、松开/失焦/卸载清理、窄屏无页面溢出、精简下载状态。
同时逐帧测量筛选收起末段,验证快速反向切换及减少动态效果模式。
- 浏览器脚本需要有现存文件的测试站、Playwright 和 Chromium,以及环境变量
`FCB_TEST_PASSWORD`;可通过 `FCB_TEST_URL` 指定站点。用 Playwright skill 的 `run.js`
运行该脚本,或在安装 Playwright 的环境中直接运行。`FCB_FRONTEND_DIST` 可指定本地构建目录,
仅在浏览器内替换静态资源进行部署前验证,不修改站点。
- 前端单元/集成 72 项通过;新增列宽计算工具覆盖率 100%。Node 原生覆盖率
不涵盖 Vite SSR 动态载入的 Vue 和指令模块,真实 DOM 行为由浏览器验收覆盖。
### 仪表盘刷新按钮
- `tests/browser/dashboard-refresh.cjs` 验证深浅主题和 1440/640/390px 屏宽下的左右留白、
图标间距、移动端图标及加载动画居中,同时确认禁用加载状态和两类数据刷新请求。
- 使用 `FCB_TEST_PASSWORD`、可选 `FCB_TEST_URL` 和 `FCB_FRONTEND_DIST`,运行方式同表格验收脚本。
- 72 项前端单元/集成与覆盖率检查、类型检查、架构检查和生产构建通过;
本轮仅修改仪表盘按钮样式,未变更后端。Vue 样式行为通过真实浏览器测量验证。
### 手动检测范围与取消
- 默认关闭定时检测;进入页面、列表刷新、搜索、分页都不会主动读取文件。
- 每行「检测可下载状态」检测单个文件;勾选检测只处理选中 ID;顶部同名按钮
检测全部未回收文件,包含当前过滤和分页之外的文件。
- 每次只发起一个文件的检测请求,显示已处理/总数,可取消后续请求。
- `downloadChecks.integration.test.mjs` 覆盖默认静默、选择去重、串行请求、失败重试、
全量 ID 枚举、空结果、取消、旧响应隔离和卸载清理。
- `tests/browser/manual-download-checks.cjs` 通过 25 文件的受控 API 响应验证跨页全量、
单个、选中、取消、移动布局,防止测试向真实网盘批量发起请求。
可使用 `FCB_TEST_TOKEN` 或 `FCB_TEST_PASSWORD`;可选本地前端产物路径。
- 当前前端单元/集成 75 项通过,架构/类型/构建通过;Node 覆盖率不覆盖 SSR 动态 Vue 模块,
交互另经真实浏览器验证。此前自动随列表刷新的行为已撤销。