Files
FileCodeBoxFronted2026/tests/README.md
T

4.1 KiB
Raw Blame History

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:

await (await import('/theme-assets/tests/detailMotion.browser.mjs')).runDetailMotionChecks()

Run again at 390px width, then with prefers-reduced-motion: reduce emulated:

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, 不重新上传分片。发送页在此阶段显示文件校验提示,确认成功后才给出取件码。