Files
Yiling-J 35a0e82284 refactor(agent)!: migrate to Pi Durable and embed the agent queue (#525)
* refactor(agent)!: migrate sessions to Pi Durable

Replace patched AgentHarness storage with per-session SQLite and PostgreSQL commit mirroring. Migrate legacy history automatically and run agent queues with the main server.

BREAKING CHANGE: Remove standalone agent workers and return native Pi entry records from chat history APIs.

* fix(agent): constrain session log dialog scrolling

Keep the header visible and wrap long output while log entries and expanded records scroll within the dialog. Cover desktop and narrow viewports through the dashboard Sessions flow.

* fix(agent): hide entry IDs from session log card headers

Retain internal entry IDs in expanded raw records for debugging. Verify that card headers omit the IDs while raw JSON preserves them.

* test(e2e): handle browser wheel limits in session log checks

Verify that a normal wheel event moves the viewport before explicitly scrolling to the final record. Keep the dialog bounds, fixed header, wrapping, and expanded-record assertions.

* fix(agent): select model providers without inheriting unrelated auth

* fix(webui): prevent resize feedback when toggling agent panel

* test(agent): reproduce concurrent comment session races

* fix(agent): serialize comment sessions and deduplicate history

* docs(changelog): consolidate Pi Durable changes into one entry
2026-11-11 16:05:18 +08:00
..

Web App E2E Tests

Fullstack end-to-end tests for the Shumai web app. They run against a real backend (pgvector container + local S3 storage) served on http://localhost:5200 and are executed with Playwright via bun run test:e2e:app.

Structure

apps/web/e2e/
├── fixtures.ts          # prisma / owner / project / file fixtures
├── serve.ts             # starts the test DB container + web app
├── global-teardown.ts   # stops the container and cleans up storage
├── helpers/
│   ├── auth.ts          # signup / auth-state injection helpers
│   ├── project.ts       # project creation helpers
│   ├── files.ts         # share link API helpers
│   ├── team.ts          # team member seeding helpers
│   └── ui.ts            # common UI flows (signup, login, members dialog)
└── tests/<domain>/      # domain-scoped specs (auth, team, project)

Fixtures

  • prisma — auto fixture that truncates all tables before each test. Also the direct way to read/write DB state for assertions and seeding.

  • owner — an authenticated team owner (seeded through the API), with the session cookie and auth state injected into the browser context, opened on the team page.

  • project — owner plus a project created through the API (projectId, projectName).

  • file — project plus a seeded processed file asset in the project root (fileId, fileName). The media kind is configurable per test via fileOptions (default binary):

    // default binary file (no extension, no proxy)
    test('...', async ({ file }) => {})
    
    // type-scoped file for future viewer/transcode tests
    test('...', { fileOptions: { mediaType: 'image' } }, async ({ file }) => {})
    
    mediaType filename notes
    binary (default) test-file-<ts> never transcoded, no proxy
    text test-file-<ts>.txt gets a PDF proxy in real usage
    image test-file-<ts>.png
    video test-file-<ts>.mp4
    pdf test-file-<ts>.pdf
    audio test-file-<ts>.wav

Test Cases

auth

Test File
Sign up as the first user and become the team owner tests/auth/signup.spec.ts
Log in with existing credentials tests/auth/login.spec.ts
Show error when accessing reset-password page without token tests/auth/reset-password.spec.ts
Reset password with valid token and allow logging in with new password tests/auth/reset-password.spec.ts

team

Test File
Owner invites a member via invite link and the invitee joins tests/team/invite-member.spec.ts
Owner removes a member via the members dialog; the membership is deleted from the DB tests/team/remove-member.spec.ts
Owner changes a team member role in the members dialog and permissions update tests/team/change-member-role.spec.ts
Owner manages resource quotas in settings and resets usage from the dashboard tests/team/quotas-settings.spec.ts
Owner creates an API token that is shown once, listed by hint, and authenticates API calls tests/team/api-tokens.spec.ts
Session logs stay within the dialog and scroll through long messages and expanded records on desktop and narrow screens tests/team/agent-session-logs.spec.ts

project

Test File
Owner creates a project with a cover image tests/project/create-project.spec.ts
Owner uploads a file or an unsupported file via the "Upload File" context menu action tests/project/upload-file.spec.ts
Owner deletes a file, finds it in recently deleted, and restores it tests/project/delete-restore.spec.ts
Owner deletes a folder and still sees its contents preview and countdown in recently deleted tests/project/delete-restore.spec.ts
Owner deletes a version stack and restores it from recently deleted tests/project/delete-restore.spec.ts
Owner creates a share link from a file context menu and lands on the share page tests/project/create-share-link.spec.ts
Owner protects a share with a password; guests must enter it to view tests/project/share-password.spec.ts
Owner creates a collection from the sidebar; the collection shows project files tests/project/create-collection.spec.ts
Owner invites a member to a project; the member only sees the invited project tests/project/invite-member.spec.ts
Owner changes a project member role in the members dialog and permissions update tests/project/change-member-role.spec.ts
Owner adds team member to project with role override and permissions enforce project role tests/project/role-override.spec.ts
Owner deletes a member from project via the members dialog and project access is revoked tests/project/remove-member.spec.ts
Owner drags a file into a folder and a folder into another folder tests/project/move-folder-file.spec.ts
Owner drags a file onto a file to create a version stack tests/project/version-stack-create.spec.ts
Owner drags a file onto a version stack to add a new version tests/project/version-stack-add-version.spec.ts
Owner manages version stack: removes version from 3-version stack tests/project/version-stack-manage.spec.ts
Owner removes version from 2-version stack which dissolves into standalone files tests/project/version-stack-manage.spec.ts
Dissolving a shared version stack renders the remaining standalone file name on the share page tests/project/version-stack-manage.spec.ts
Moving a shared file into a shared version stack leaves only 1 stack card on the share page tests/project/version-stack-manage.spec.ts
Manage versions dialog constrains card width and truncates long file names without dialog overflow tests/project/version-stack-manage.spec.ts
Owner searches the file list by an English name keyword tests/project/search-file-list.spec.ts
Owner searches the file list by Chinese, Japanese, and Korean name keywords tests/project/search-file-list.spec.ts
Owner searches the file list with a keyword and a filter condition tests/project/search-file-list.spec.ts
Owner saves a search result as a collection tests/project/save-search-collection.spec.ts
Image share with watermark + download disabled: no download buttons on public list/detail pages, watermarked proxy served, download-url rejected tests/project/share-watermark-no-download.spec.ts
Video share with watermark + download disabled: no download buttons on public list/detail pages, watermarked proxy served, download-url rejected tests/project/share-watermark-no-download.spec.ts
Owner views a file and it appears in recents tests/project/recents.spec.ts
Owner archives a file to archive storage and restores it back to main storage tests/project/archive-restore.spec.ts
Owner opens Copy submenu in context menu and copies file name tests/project/copy-menu.spec.ts

file

Test File
Create a comment on a binary file tests/file/binary-comment.spec.ts
Upload a txt file, wait for transcode, and create a comment with draw tests/file/txt-draw-comment.spec.ts
Upload an image file, wait for transcode, and create a comment with draw tests/file/image-draw-comment.spec.ts
Upload a video file, wait for transcode, and create a comment with draw at a non-zero timestamp tests/file/video-draw-comment.spec.ts
Upload an audio file, wait for transcode, and create a comment at a non-zero timestamp tests/file/audio-timestamp-comment.spec.ts
Show a breathing poster preview and "Preparing..." while a video is still transcoding tests/file/processing-preview.spec.ts
Show a preparing circle before the poster is generated tests/file/processing-preview.spec.ts

Conventions

  • Seed data via fixtures/API/DB; use the UI only for the flow under test.
  • Each test truncates all tables via the auto prisma fixture, so fixtures must create their data per-test.
  • App projects run with workers: 1 because all tests share a single database.
  • Every new test case MUST be documented in this README.