Skip to content

E2e coverage - #195

Merged
cg8-5712 merged 7 commits into
mainfrom
e2e-coverage
Aug 10, 2026
Merged

cg8-5712 merged 7 commits into
mainfrom
e2e-coverage

Conversation

@cg8-5712

@cg8-5712 cg8-5712 commented Aug 10, 2026 •

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • 新功能

    • 新增浏览器端到端测试,覆盖登录注销、角色访问、案件协作、线索审核、家庭端 intake、学习资源治理、资料保存及志愿者任务申请。
    • 新增端到端测试命令,支持本地运行完整前后端测试环境。
    • 演示数据支持配置指挥员和志愿者的审核管理权限。
  • 文档

    • 补充测试运行方式、覆盖范围及测试数据说明。
  • 测试

    • CI 自动执行前端单元测试和浏览器端到端测试,并在失败时保存诊断报告。

- Add Playwright tests for API proxying, authentication failures, logout, and role-based route access
- Configure isolated SQLite database setup with migrations and demo account bootstrapping
- Start the real Actix backend and Vite development server for end-to-end tests
- Add Playwright scripts, configuration, Chromium installation, and dependency lockfile entries
- Run frontend unit tests and browser tests in GitHub Actions
- Upload Playwright reports and failure diagnostics from CI
- Document browser coverage, local execution, and excluded generated test data
- Support configurable Vite API proxy targets and restrict Vitest discovery to source tests
- cover case workspace visibility, clue review, and volunteer task applications
- verify intake confirmation, learning governance, and profile persistence
- add shared API fixtures and SSE helpers for isolated Playwright scenarios
- enable reviewer admin capabilities for E2E demo bootstrap
- update E2E coverage documentation to mark implemented workflows
Copilot AI lite review requested due to automatic review settings August 10, 2026 02:06

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@cg8-5712, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 9 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: a59af263-b4f7-4740-a3ea-454f9329a074

📥 Commits

Reviewing files that changed from the base of the PR and between f9b8671 and 892665f.

📒 Files selected for processing (2)
  • frontend/e2e/playwright.config.ts
  • frontend/e2e/start-e2e.mjs
📝 Walkthrough

Walkthrough

新增 Playwright 浏览器端到端测试体系。测试使用隔离 SQLite 数据库、真实 Actix API 和 Vite 服务,覆盖认证、角色访问、案件协作、intake、学习治理、资料和志愿者任务,并接入 CI。

Changes

浏览器端到端测试

Layer / File(s) Summary
E2E 环境与演示权限
frontend/e2e/playwright.config.ts, frontend/e2e/start-backend.mjs, frontend/vite.config.ts, src/application/services/auth_service.rs, src/bin/angui-admin.rs, frontend/package.json, package.json, .gitignore
配置隔离数据库、前后端服务、Vite API 代理、Playwright 命令和演示账号权限。
认证与测试夹具
frontend/e2e/support.ts
新增认证令牌、API 请求、SSE 解析及案件、线索、任务和学习资源夹具。
浏览器业务流程验证
frontend/e2e/authentication-and-access.spec.ts, frontend/e2e/case-collaboration.spec.ts, frontend/e2e/case-workspace.spec.ts, frontend/e2e/intake-flow.spec.ts, frontend/e2e/learning-governance.spec.ts, frontend/e2e/profile.spec.ts, frontend/e2e/volunteer-tasks.spec.ts
新增认证访问、工作区、协作、intake、学习治理、资料持久化和志愿者任务测试。
CI 执行与覆盖说明
.github/workflows/ci.yml, README.md, frontend/e2e/COVERAGE.md, frontend/src/pages/CaseWorkspacePage.test.tsx
CI 执行单元测试和 E2E 测试,并在失败时上传 Playwright 诊断产物;文档说明本地运行方式和覆盖边界;前端测试延长异步断言超时。

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Playwright
  participant Vite
  participant AnguiDebugServer
  participant SQLite
  Playwright->>AnguiDebugServer: 启动并检查后端服务
  AnguiDebugServer->>SQLite: 使用隔离 E2E 数据库
  Playwright->>Vite: 启动前端服务
  Vite->>AnguiDebugServer: 代理浏览器 API 请求
  Playwright->>Vite: 执行业务流程断言
Loading

Possibly related PRs

  • AG-Angui/Angui#93:本 PR 扩展了该 PR 建立的前端测试脚本和配置。
  • AG-Angui/Angui#122:本 PR 验证该 PR 实现的指挥端工作区访问限制和角色路由。
  • AG-Angui/Angui#174:本 PR 验证该 PR 引入的 AI 初审、家庭确认和案件创建流程。
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 5.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题准确概括了本次新增端到端测试覆盖及其相关配置,且与变更主体直接相关。
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch e2e-coverage

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@README.md`:
- Around line 135-140: Update the README’s browser end-to-end test setup
instructions to run corepack enable before the existing Yarn Playwright
installation and npm test commands, ensuring Yarn is available as documented.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: ec253c47-0224-4497-9a01-82fb1f94397d

📥 Commits

Reviewing files that changed from the base of the PR and between 1467594 and 8f682d9.

⛔ Files ignored due to path filters (1)
  • frontend/yarn.lock is excluded by !**/yarn.lock, !**/*.lock
📒 Files selected for processing (19)
  • .github/workflows/ci.yml
  • .gitignore
  • README.md
  • frontend/e2e/COVERAGE.md
  • frontend/e2e/authentication-and-access.spec.ts
  • frontend/e2e/case-collaboration.spec.ts
  • frontend/e2e/case-workspace.spec.ts
  • frontend/e2e/intake-flow.spec.ts
  • frontend/e2e/learning-governance.spec.ts
  • frontend/e2e/playwright.config.ts
  • frontend/e2e/profile.spec.ts
  • frontend/e2e/start-backend.mjs
  • frontend/e2e/support.ts
  • frontend/e2e/volunteer-tasks.spec.ts
  • frontend/package.json
  • frontend/vite.config.ts
  • package.json
  • src/application/services/auth_service.rs
  • src/bin/angui-admin.rs

Comment thread README.md
Comment on lines +135 to +140
Browser end-to-end tests create an isolated SQLite database, explicitly run migrations, and bootstrap only `.invalid` demo accounts. Playwright then starts the real Actix API and Vite server to verify API proxying, login failure, session logout, and role-based route access. Install Chromium once before running the suite locally:

```powershell
yarn --cwd frontend playwright install chromium
npm run test:e2e
```

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

先启用 Corepack。

README 只要求 Node.js 和 npm,但此处直接调用 yarn。未安装 Yarn 的开发者会在安装 Chromium 前失败。

在这些命令前添加 corepack enable。CI 已在 .github/workflows/ci.yml 的第 245-246 行执行此步骤。

建议修改
+corepack enable
 yarn --cwd frontend playwright install chromium
 npm run test:e2e
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Browser end-to-end tests create an isolated SQLite database, explicitly run migrations, and bootstrap only `.invalid` demo accounts. Playwright then starts the real Actix API and Vite server to verify API proxying, login failure, session logout, and role-based route access. Install Chromium once before running the suite locally:
```powershell
yarn --cwd frontend playwright install chromium
npm run test:e2e
```
Browser end-to-end tests create an isolated SQLite database, explicitly run migrations, and bootstrap only `.invalid` demo accounts. Playwright then starts the real Actix API and Vite server to verify API proxying, login failure, session logout, and role-based route access. Install Chromium once before running the suite locally:
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@README.md` around lines 135 - 140, Update the README’s browser end-to-end
test setup instructions to run corepack enable before the existing Yarn
Playwright installation and npm test commands, ensuring Yarn is available as
documented.

- install Linux dependencies alongside Chromium in CI
- ensure browser end-to-end tests run with required packages
- rely on self-hosted runner image for Chromium Linux dependencies
- install only the Chromium browser without Playwright's `--with-deps` flag
- allow async workspace heading rendering up to five seconds
- reduce test flakiness during slower test runs
- derive unique run IDs from GitHub workflow metadata or local process state
- assign per-run database files, attachment directories, and port offsets
- clean up the configured database and SQLite sidecar files before startup
- add unique test suffixes using test IDs and retry counts
- apply isolated suffixes to case, task, intake, profile, and learning fixtures
@github-actions

Copy link
Copy Markdown

Preview ready

The preview for this build is available at https://pr-195-892665fa7f64.angui.cg8.site.

Temporary demo accounts (all use the password d11b961f4c152d46e4b7ab8b3accde53dc1e9a15a1fdf944):

Role Email
Family family@demo.invalid
Commander commander@demo.invalid
Volunteer volunteer@demo.invalid
Learner learner@demo.invalid
Administrator admin@demo.invalid

These accounts and all preview data belong only to this deployment. The next preview deployment resets the SQLite database and invalidates these credentials.

@cg8-5712
cg8-5712 merged commit 673f4b4 into main Aug 10, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants