feat(publish): Publish preview before Woo draft POST

After Review → Continue to Publish, show a glanceable confirmation:
ordered photo thumbs, SKU/title/price, taxonomy + dims, short and long
descriptions (plain text). Back to Review edits; Publish posts the draft.
Reuses slab/taxonomy/photos only — no invented fields.
This commit is contained in:
grokbot_ty
2026-09-26 11:47:18 -07:00
parent 8f8e0132e6
commit 73e28180c8
6 changed files with 542 additions and 23 deletions
+20
View File
@@ -243,6 +243,20 @@ async function mockApi(page: Page, hooks: ApiHooks = {}) {
await json(route, slab);
return;
}
if (path === `/api/v1/slabs/${slab.id}/photos` && method === 'GET') {
// Publish preview + Review strip: ordered lineup (empty is fine for golden path).
await json(route, [
{
id: 'photo-1', seq: 1, is_calibration: 1, role: 'calibration',
width_px: 100, height_px: 100, has_original: 1, has_processed: 1,
},
{
id: 'photo-2', seq: 2, is_calibration: 0, role: 'overlay',
width_px: 100, height_px: 100, has_original: 1, has_processed: 1,
},
]);
return;
}
if (path === `/api/v1/slabs/${slab.id}/photos` && method === 'POST') {
// Photo uploads are multipart; `payload` is {} — the client's photo_id is
// in the form body, not JSON, so echo a stable synthetic id.
@@ -251,6 +265,7 @@ async function mockApi(page: Page, hooks: ApiHooks = {}) {
slab_id: slab.id,
seq: 1,
is_calibration: 1,
role: 'calibration',
original_retained: false,
processed_retained: true,
}, 201);
@@ -351,6 +366,11 @@ test.describe('M3 Review→Publish flow (#77)', () => {
await expect(page.getByTestId('continue-publish')).toBeEnabled();
await page.getByTestId('continue-publish').click();
await expect(page.getByTestId('publish-screen')).toBeVisible();
// Publish preview: glanceable confirm before Woo draft POST.
await expect(page.getByTestId('publish-preview')).toBeVisible();
await expect(page.getByTestId('preview-title')).toBeVisible();
await expect(page.getByTestId('preview-facts')).toBeVisible();
await expect(page.getByTestId('back-review')).toBeVisible();
// Publish → success → Done panel (draft in UAT store).
await page.getByTestId('publish-btn').click();
await expect(page.getByText('Published')).toBeVisible({ timeout: 15000 });