test(post): share createPhotoEntry helper and fix cleanup leak
Hoist the duplicated per-spec createEntry photo-fixture into a single createPhotoEntry() in helpers.js (used by delete-flow, edit-mode, and the anon-view draft). Register the tag for cleanup BEFORE the awaited 15s success-toast assertion, so a create that lands on disk but whose toast assertion times out no longer leaks an untracked entry. Add AE3b covering the disclosure deviation branch (a non-default toggle auto-expands More options). Code review F2 (leak), F3 (duplication), F6 (coverage). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Mpdu3Dt1iVoozHwAMyjrbn
This commit is contained in:
@@ -28,6 +28,32 @@ test('AE3: advanced fields are hidden until "More options" is expanded', async (
|
||||
await expect(details).toHaveJSProperty('open', true);
|
||||
});
|
||||
|
||||
// ── AE3b: a toggle that deviates from its default auto-opens "More options" ────
|
||||
// AE3 covers the common non-deviating case (collapsed on a plain create). This
|
||||
// covers the OTHER branch of initDisclosure: an advanced toggle whose value
|
||||
// differs from its blueprint default force-opens the panel so a non-default
|
||||
// setting is never hidden. It also guards the data-driven default detection —
|
||||
// initDisclosure reads each toggle's default from the rendered `[checked]`
|
||||
// attribute rather than a hardcoded field name, so this must hold for a
|
||||
// default-OFF toggle (featured) flipped ON just as it does for published.
|
||||
test('AE3b: a non-default advanced toggle auto-expands "More options" on load', async ({ page }) => {
|
||||
await page.goto('/post');
|
||||
// Seed a create draft whose `featured` toggle deviates from its OFF default,
|
||||
// then reload so initDraft restores it before initDisclosure's auto-open check.
|
||||
await page.evaluate((k) => {
|
||||
localStorage.setItem(k, JSON.stringify({ 'data[featured]': '1' }));
|
||||
}, DRAFT_KEY);
|
||||
await page.reload();
|
||||
|
||||
const details = page.locator('details.more-options');
|
||||
await expect(details).toBeAttached();
|
||||
await expect(details).toHaveJSProperty('open', true);
|
||||
// The restored deviation is reflected in the live toggle state.
|
||||
await expect(page.locator('input[name="data[featured]"][value="1"]')).toBeChecked();
|
||||
|
||||
await page.evaluate((k) => localStorage.removeItem(k), DRAFT_KEY);
|
||||
});
|
||||
|
||||
// ── AE1: HEIC → JPEG conversion, posted with a working thumbnail ───────────────
|
||||
test('AE1: a HEIC photo is converted to JPEG client-side and posted', async ({ page }) => {
|
||||
const tag = `heic-${Date.now()}`;
|
||||
|
||||
Reference in New Issue
Block a user