documents
10 requirements and 38 scenarios in openspec/specs/documents/spec.md. A scenario’s test is test('<scenario>') inside describe('<requirement>'), in Vitest or Playwright.
Adding a document
Section titled “Adding a document”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| Adding a financial statement | Playwright e2e/documents.spec.ts |
| The name is suggested from the file | Vitest src/features/documents/DocumentForm.test.tsxPlaywright e2e/documents.spec.ts |
| A document needs a name | Vitest src/features/documents/DocumentForm.test.tsxPlaywright e2e/documents.spec.ts |
| Another flat’s tenancy in the address is ignored | Playwright e2e/documents.spec.ts |
| A member can’t add a document | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
Document files
Section titled “Document files”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| A photo is resized before upload | Playwright e2e/documents.spec.ts |
| A PDF is stored as it is | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
| A file that isn’t an image or a PDF is refused | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
| A file over 10 MB is refused | Vitest src/features/documents/documents.server.test.ts |
A lease’s tenancy
Section titled “A lease’s tenancy”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| A lease names its tenancy | Playwright e2e/documents.spec.ts |
| Another flat’s tenancy is refused | Vitest src/features/documents/documents.server.test.ts |
| A lease stays when its tenancy is removed | Vitest src/features/documents/document.repository.server.test.ts |
The documents page
Section titled “The documents page”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| Documents are grouped by kind, newest first | Vitest src/features/documents/DocumentsPage.test.tsxPlaywright e2e/documents.spec.ts |
| Filtering by kind | Vitest src/features/documents/DocumentsPage.test.tsxPlaywright e2e/documents.spec.ts |
| A flat without documents | Vitest src/features/documents/DocumentsPage.test.tsxPlaywright e2e/documents.spec.ts |
| An owner sees their storage use | Vitest src/features/documents/DocumentsPage.test.tsxPlaywright e2e/documents.spec.ts |
| A member sees the documents but can’t add | Playwright e2e/documents.spec.ts |
| Another user can’t open the documents page | Playwright e2e/documents.spec.ts |
Document details
Section titled “Document details”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| An owner opens a document | Vitest src/features/documents/DocumentDetails.test.tsxPlaywright e2e/documents.spec.ts |
| A member opens a document | Vitest src/features/documents/DocumentDetails.test.tsxPlaywright e2e/documents.spec.ts |
| A deleted document is not found | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
Viewing and downloading a document
Section titled “Viewing and downloading a document”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| A member downloads a document | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
| A user without access can’t open a document’s file | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
| Opening an image document full screen | Playwright e2e/documents.spec.ts |
Editing a document
Section titled “Editing a document”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| Renaming a document | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
| Changing a lease to another kind removes its tenancy | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
| Editing a deleted document is refused | Vitest src/features/documents/documents.server.test.ts |
| A member can’t edit a document | Vitest src/features/documents/documents.server.test.tsPlaywright e2e/documents.spec.ts |
Deleting a document
Section titled “Deleting a document”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| Deleting a document and its file | Playwright e2e/documents.spec.ts |
| Cancelling keeps the document | Playwright e2e/documents.spec.ts |
| A member can’t delete a document | Vitest src/features/documents/documents.server.test.ts |
Storage quota for documents
Section titled “Storage quota for documents”No Playwright test: reaching the quota needs 500 MB or 1,000 stored files; Workers tests cover the check with recorded sizes, and a component test shows the message.
| Scenario | Tests |
|---|---|
| Receipts and documents count together | Vitest src/features/documents/documents.server.test.ts |
| A document over the size is refused | Vitest src/features/documents/documents.server.test.ts |
| Another owner’s documents don’t count | Vitest src/features/documents/documents.server.test.ts |
The lease on the tenancy page
Section titled “The lease on the tenancy page”Playwright: e2e/documents.spec.ts
| Scenario | Tests |
|---|---|
| The current tenancy’s lease | Vitest src/features/tenancies/TenancyPage.test.tsxVitest src/features/tenancies/tenancy-lease.server.test.tsPlaywright e2e/documents.spec.ts |
| Adding the lease from the tenancy page | Playwright e2e/documents.spec.ts |
| A lease of another tenancy isn’t on the card | Vitest src/features/tenancies/tenancy-lease.server.test.ts |
| A member sees the lease but can’t add one | Vitest src/features/tenancies/TenancyPage.test.tsxPlaywright e2e/documents.spec.ts |