mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 13:58:00 +00:00
* feat(project): add recent viewed files section to project folder tree * feat(webui): disable toolbar buttons and context menu in recents page * test(core): optimize recents cap test execution time * feat(webui): show hint text in recents page top toolbar * feat(webui): rename recents section to Recently Viewed * refactor(core): consolidate recents methods into AssetService * fix(api): forward pagination parameters in folder children endpoint (#349) * fix(project-recents): scope views and disable recents mutations * fix(api): allow recent views in demo mode * fix(api): limit demo recent view exception to post
115 lines
6.9 KiB
Markdown
115 lines
6.9 KiB
Markdown
# 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`):
|
|
|
|
```ts
|
|
// 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` |
|
|
|
|
### 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 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` |
|
|
| 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` |
|
|
|
|
### 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` |
|
|
|
|
## 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.
|