Adds the FR-TITLE-005 helper line under the title input in DescriptionSection, shown only on the single-document edit form via a new showTitleHelp prop (off for the new-document and bulk-edit forms). It is wired to the input with aria-describedby and uses text-ink-3 (WCAG AA on bg-surface). New Paraglide key form_helper_title_autogenerated in de/en/es. Adds a component test for the helper + aria wiring and an end-to-end pass: create an auto-titled doc, edit its date, and see the title follow on the detail page. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
37 lines
1.8 KiB
TypeScript
37 lines
1.8 KiB
TypeScript
import { expect, test } from '@playwright/test';
|
|
|
|
/**
|
|
* Auto-title sync, full-stack happy path (#726). A document whose stored title equals its
|
|
* machine-generated auto-title must follow a date correction forward on save; a hand-edit would
|
|
* be kept. The exhaustive permutations live in the backend unit/integration suites — this is the
|
|
* single end-to-end pass, and it also asserts the FR-005 helper line is present on the edit form.
|
|
*/
|
|
test.describe('Document auto-title sync (#726)', () => {
|
|
test('editing the date rebuilds the auto-title, and the edit form explains it', async ({
|
|
page
|
|
}) => {
|
|
// 1. Create a document with no date/location, so its stored title == its auto-title
|
|
// (originalFilename only). createDocument derives originalFilename from the title.
|
|
await page.goto('/documents/new');
|
|
await page.waitForSelector('[data-hydrated]');
|
|
await page.getByLabel('Titel').fill('E2E Auto-Titel Sync');
|
|
await page.getByRole('button', { name: 'Speichern', exact: true }).click();
|
|
await expect(page).toHaveURL(/\/documents\/[^/]+$/);
|
|
const detailUrl = page.url();
|
|
|
|
// 2. The edit form carries the FR-005 helper explaining the auto-generated title.
|
|
await page.goto(`${detailUrl}/edit`);
|
|
await page.waitForSelector('[data-hydrated]');
|
|
await expect(page.locator('#title-help')).toBeVisible();
|
|
|
|
// 3. Add a YEAR-precision date WITHOUT touching the title, then save.
|
|
await page.locator('#documentDate').fill('15.01.1928');
|
|
await page.locator('#metaDatePrecision').selectOption('YEAR');
|
|
await page.getByRole('button', { name: 'Speichern', exact: true }).click();
|
|
|
|
// 4. The detail page shows the regenerated title carrying the new year.
|
|
await expect(page).toHaveURL(/\/documents\/[^/]+$/);
|
|
await expect(page.getByRole('heading', { name: /E2E Auto-Titel Sync.*1928/ })).toBeVisible();
|
|
});
|
|
});
|