test(post-form): assert photo section auto-collapse + summary bar
Retarget AE1's completed-item assertion (the item is now hidden once the section auto-collapses) to the "✓ N photo ready" summary, and add a spec covering collapse-after-upload + re-expand on tap. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -33,7 +33,8 @@ test('AE1: a HEIC photo is converted to JPEG client-side and posted', async ({ p
|
|||||||
|
|
||||||
await page.locator('input.filepond--browser').setInputFiles(TEST_HEIC);
|
await page.locator('input.filepond--browser').setInputFiles(TEST_HEIC);
|
||||||
await waitForPhotoUpload(page, 1); // converted (beforeAddFile) + uploaded via FilePond
|
await waitForPhotoUpload(page, 1); // converted (beforeAddFile) + uploaded via FilePond
|
||||||
await expect(page.locator('.filepond--item[data-filepond-item-state="processing-complete"]')).toBeVisible();
|
// The photo section auto-collapses to a summary bar once the upload settles.
|
||||||
|
await expect(page.locator('.photos-collapse__summary')).toContainText('1 photo ready');
|
||||||
|
|
||||||
await page.locator('.btn-post').evaluate(el => el.click());
|
await page.locator('.btn-post').evaluate(el => el.click());
|
||||||
await expect(page.locator('.notices')).toContainText('Entry posted successfully!', { timeout: 15_000 });
|
await expect(page.locator('.notices')).toContainText('Entry posted successfully!', { timeout: 15_000 });
|
||||||
@@ -68,6 +69,24 @@ test('AE4: a corrupt HEIC is blocked (fail-closed) and never posted', async ({ p
|
|||||||
expect(files.some(f => /\.heic$/i.test(f)), 'the corrupt HEIC must never be posted').toBe(false);
|
expect(files.some(f => /\.heic$/i.test(f)), 'the corrupt HEIC must never be posted').toBe(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// ── Photo section collapses to a summary after upload, re-expands on tap ──────
|
||||||
|
test('photo section auto-collapses to a summary after upload and re-expands on tap', async ({ page }) => {
|
||||||
|
await page.goto('/post');
|
||||||
|
const details = page.locator('details.photos-collapse');
|
||||||
|
await expect(details).toHaveJSProperty('open', true); // open while empty
|
||||||
|
|
||||||
|
await page.locator('input.filepond--browser').setInputFiles(TEST_HEIC);
|
||||||
|
await waitForPhotoUpload(page, 1);
|
||||||
|
|
||||||
|
// Settled → auto-collapsed, summary reflects the ready count.
|
||||||
|
await expect(details).toHaveJSProperty('open', false);
|
||||||
|
await expect(page.locator('.photos-collapse__summary')).toContainText('1 photo ready');
|
||||||
|
|
||||||
|
// Native <details>: clicking the summary re-expands for review.
|
||||||
|
await page.locator('.photos-collapse__summary').click();
|
||||||
|
await expect(details).toHaveJSProperty('open', true);
|
||||||
|
});
|
||||||
|
|
||||||
// ── R18: Get Weather is gated on coordinates ──────────────────────────────────
|
// ── R18: Get Weather is gated on coordinates ──────────────────────────────────
|
||||||
test('R18: Get Weather is disabled until Get Location provides coordinates', async ({ page, context }) => {
|
test('R18: Get Weather is disabled until Get Location provides coordinates', async ({ page, context }) => {
|
||||||
await context.grantPermissions(['geolocation']);
|
await context.grantPermissions(['geolocation']);
|
||||||
|
|||||||
Reference in New Issue
Block a user