test(post-form): add edit/delete/anon coverage and fix stale photo-gate assumptions
New specs: edit-mode (ES1 save round-trip + ES2/ES3 prefill 404/500 states), delete-flow (DEL1-3 happy/cancel/failed), anon-view (AN1 no owner controls, AN2 draft hidden from anon), photo-editor (live add/delete/reorder). Existing: P3-P8 now attach a photo to satisfy the create photo-gate; V3 picker cap 4->6. Full post suite 38/38, stable across parallel (3-worker) runs. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mpdu3Dt1iVoozHwAMyjrbn
This commit is contained in:
@@ -33,21 +33,23 @@ test('V2: submit without content shows a validation error or stays on /post', as
|
||||
expect(bodyText).not.toContain('Entry posted successfully');
|
||||
});
|
||||
|
||||
// ── V3: Photo limit (max 4) ───────────────────────────────────────────────────
|
||||
test('V3: FilePond caps attachments at the limit (4)', async ({ page }) => {
|
||||
// ── V3: Photo limit (max 6) ───────────────────────────────────────────────────
|
||||
// The blueprint limit is 6 (asserted directly as maxFiles===6 in the UX suite);
|
||||
// this is the behavioral counterpart — the picker must refuse a 7th attachment.
|
||||
test('V3: FilePond caps attachments at the limit (6)', async ({ page }) => {
|
||||
await page.goto('/post');
|
||||
const browser = page.locator('input.filepond--browser');
|
||||
|
||||
// Attach 4 photos (same fixture — we only need four items).
|
||||
await browser.setInputFiles([TEST_PHOTO, TEST_PHOTO, TEST_PHOTO, TEST_PHOTO]);
|
||||
// Attach 6 photos (same fixture — we only need six items).
|
||||
await browser.setInputFiles([TEST_PHOTO, TEST_PHOTO, TEST_PHOTO, TEST_PHOTO, TEST_PHOTO, TEST_PHOTO]);
|
||||
await page.waitForFunction(() =>
|
||||
document.querySelectorAll('.filepond--item').length === 4, { timeout: 10_000 });
|
||||
document.querySelectorAll('.filepond--item').length === 6, { timeout: 10_000 });
|
||||
|
||||
// A 5th is ignored once the limit is reached.
|
||||
// A 7th is ignored once the limit is reached.
|
||||
await browser.setInputFiles([TEST_PHOTO]);
|
||||
await page.waitForTimeout(500);
|
||||
|
||||
expect(await page.locator('.filepond--item').count()).toBe(4);
|
||||
expect(await page.locator('.filepond--item').count()).toBe(6);
|
||||
});
|
||||
|
||||
// ── V4: Non-image file rejected ───────────────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user