Commit 98faf0
2026-03-13 20:02:44 Claude (MCP): [mcp] P2-10: Add E2E test summary| /dev/null .. Dev/P2-10_Summary.md | |
| @@ 0,0 1,65 @@ | |
| + | --- |
| + | category: reference |
| + | tags: [phase-2, testing, e2e] |
| + | last_updated: 2026-03-13 |
| + | --- |
| + | |
| + | # P2-10: Phase 2 E2E Integration Tests |
| + | |
| + | ## Overview |
| + | |
| + | E2E integration tests for Phase 2 multi-tenancy features. These tests run against the deployed stack after `pulumi up` with all Phase 2 changes. |
| + | |
| + | **File:** `tests/test_e2e_phase2.py` |
| + | **Branch:** `feat/P2-10-e2e` (from `phase-2`) |
| + | **Tests collected:** 17 |
| + | |
| + | ## Required Environment Variables |
| + | |
| + | | Variable | Description | |
| + | |----------|-------------| |
| + | | `E2E_USER_A_TOKEN` | Platform JWT for User A (wiki owner) | |
| + | | `E2E_USER_B_TOKEN` | Platform JWT for User B (collaborator) | |
| + | | `E2E_USER_A_ID` | User A's platform user ID (used as subdomain) | |
| + | | `E2E_USER_B_EMAIL` | User B's registered email (for ACL grants) | |
| + | | `E2E_BASE_URL` | Optional, defaults to `https://dev.wikibot.io` | |
| + | |
| + | All tests skip cleanly when tokens are not set. |
| + | |
| + | ## Test Scenarios |
| + | |
| + | | # | Scenario | Class | Tests | |
| + | |---|----------|-------|-------| |
| + | | 1 | User A creates wiki | `TestCreateWiki` | 1 | |
| + | | 2 | User A writes page via REST API | `TestWritePage` | 1 | |
| + | | 3 | User B denied on private wiki | `TestCrossUserDenied` | 1 | |
| + | | 4 | User A grants User B editor | `TestGrantAccess` | 1 | |
| + | | 5 | User B writes after grant | `TestGrantedAccess` | 1 | |
| + | | 6 | User A revokes User B | `TestRevokeAccess` | 1 | |
| + | | 7 | User B denied after revoke | `TestDeniedAfterRevoke` | 1 | |
| + | | 8 | Free tier limit enforced | `TestFreeTierLimit` | 1 | |
| + | | 9 | Public wiki anonymous READ | `TestPublicWikiRead` | 1 | |
| + | | 10 | Public wiki anonymous WRITE blocked | `TestPublicWikiWriteBlocked` | 1 | |
| + | | 11 | MCP bearer token access | `TestMcpTokenAccess` | 1 | |
| + | | 12 | MCP wrong token rejected | `TestMcpWrongToken` | 1 | |
| + | | 13 | Admin panel hiding | `TestAdminPanelHiding` | 2 | |
| + | | 14 | Wiki list isolation | `TestWikiListIsolation` | 2 | |
| + | | 15 | Token regeneration | `TestTokenRegeneration` | 1 | |
| + | |
| + | ## Design Decisions |
| + | |
| + | - **Module-scoped fixtures** for wiki creation/teardown — wiki_a creates a private wiki once and cleans up after all tests. |
| + | - **Unique slug per run** (`e2e-p2-{uuid}`) avoids collisions between parallel runs. |
| + | - **Tenant URL helper** constructs subdomain-based URLs (`{user_id}.wikibot.io/{slug}/...`). |
| + | - **Two skip markers**: `_require_tokens` (needs A+B tokens) and `_require_all` (needs all 4 env vars). |
| + | - Tests use `httpx` consistent with Phase 1 E2E tests. |
| + | |
| + | ## Running |
| + | |
| + | ```bash |
| + | export E2E_USER_A_TOKEN="..." |
| + | export E2E_USER_B_TOKEN="..." |
| + | export E2E_USER_A_ID="..." |
| + | export E2E_USER_B_EMAIL="..." |
| + | pytest tests/test_e2e_phase2.py -v -m e2e |
| + | ``` |