feat: support external and step images with structured cooking instructions

This commit is contained in:
Sascha Nesterovic committed 2026-10-24 17:31:47 +02:00
1 parent 361862ad0b
commit 0ec1d45bdb
34 files changed
+898 -92

No files matched your search

+21
View File
@@ -36,6 +36,9 @@ test('admin creates and edits recipes with recoverable drafts and image upload',
await page.getByRole('textbox', { name: 'Anleitung 1' }).fill('In Salzwasser weich kochen.');
await page.getByRole('button', { name: 'Kartoffeln', exact: true }).click();
await page.getByRole('button', { name: 'Timer hinzufügen' }).click();
await page.getByText('Bilder zu Schritt 1 (0)', { exact: true }).click();
await page.getByLabel('Schritt 1: Bild hochladen').setInputFiles('public/images/garden.jpg');
await expect(page.getByRole('img', { name: 'Schritt 1: Bild 1', exact: true })).toBeVisible();
await page.getByRole('button', { name: 'Live-Vorschau', exact: true }).click();
await expect(page.locator('.editor-preview')).toContainText('400 g Kartoffeln');
await page.screenshot({ path: 'docs/screenshots/editor-desktop.png', fullPage: true });
@@ -58,11 +61,29 @@ test('admin creates and edits recipes with recoverable drafts and image upload',
const download = await downloadPromise;
const data = JSON.parse(await readFile((await download.path())!, 'utf8'));
expect(data.recipes[0].title).toBe('Browser-Küchenrezept verbessert');
const stepImage = data.recipes[0].steps[0].images[0];
expect(stepImage).toMatch(/^\/media\/.+\.webp$/);
expect(
(
await page.request.delete('/api/media', {
headers: { origin: 'http://localhost:3100' },
data: { name: stepImage.split('/').at(-1) },
})
).status(),
).toBe(409);
await page.getByRole('button', { name: 'Browser-Küchenrezept verbessert löschen' }).click();
await page.getByRole('button', { name: 'Endgültig löschen' }).click();
await expect(page.getByRole('heading', { name: 'Browser-Küchenrezept verbessert' })).toHaveCount(
0,
);
expect(
(
await page.request.delete('/api/media', {
headers: { origin: 'http://localhost:3100' },
data: { name: stepImage.split('/').at(-1) },
})
).status(),
).toBe(200);
await page.getByRole('button', { name: 'Abmelden' }).click();
await expect(page.getByRole('heading', { name: 'Willkommen zurück.' })).toBeVisible();
});