feat(cv): redesign document editing with revision-safe letters and writing tools

This commit is contained in:
cesnimda
2026-10-25 22:44:14 +01:00
parent 01e10996c5
commit 2bfaf6c14b
57 changed files with 2859 additions and 118 deletions
@@ -54,7 +54,7 @@ async function measure(page: Page, browser: Browser, info: TestInfo, cvUrl: stri
});
const variant = await (await page.request.get(cvUrl)).json();
const directory = path.join(output, fixture); await fs.mkdir(directory, { recursive: true });
const response = page.waitForResponse(r => r.url() === `${cvUrl}/export-pdf` && r.request().method() === 'POST');
const response = page.waitForResponse(r => new URL(r.url()).pathname === new URL(`${cvUrl}/export-pdf`).pathname && new URL(r.url()).searchParams.has('expectedVersion') && r.request().method() === 'POST');
const downloading = page.waitForEvent('download');
await page.getByRole('button', { name: t.cvEditorDownloadPdf, exact: true }).click();
const pdf = await response; expect(pdf.status()).toBe(200); expect((await downloading).suggestedFilename()).toMatch(/\.pdf$/i);
@@ -163,9 +163,15 @@ for (const [mode, language, premium] of [['light', 'en', false], ['dark', 'nb',
await capture(page, info, 'templates'); await scan(page, info, 'templates');
const target = premium ? technical : page.getByRole('button', { name: t.cvTemplateCodeName, exact: true });
await target.focus(); await page.keyboard.press('Enter');
const dialog = page.getByRole('dialog', { name: t.cvEditorChangeTemplateTitle }); await expect(dialog).toBeVisible(); await capture(page, info, 'reset-confirmation');
const candidate = page.getByRole('dialog', { name: new RegExp(t.cvEditorPreviewDesign) });
await expect(candidate).toBeVisible();
await expect(candidate.getByRole('button', { name: t.cvEditorApplyTemplate, exact: true })).toBeEnabled();
expect((await read()).settings).toEqual(changed.settings);
await capture(page, info, 'candidate-preview'); await scan(page, info, 'candidate-preview');
await page.keyboard.press('Escape'); await expect(target).toBeFocused(); expect((await read()).settings.themeId).toBe('minimal');
await page.keyboard.press('Space'); await dialog.getByRole('button', { name: t.cvEditorApplyTemplate, exact: true }).click(); await saved();
await page.keyboard.press('Space'); await candidate.getByRole('button', { name: t.cvEditorApplyTemplate, exact: true }).click();
const dialog = page.getByRole('dialog', { name: t.cvEditorChangeTemplateTitle }); await expect(dialog).toBeVisible(); await capture(page, info, 'reset-confirmation');
await dialog.getByRole('button', { name: t.cvEditorApplyTemplate, exact: true }).click(); await saved();
await expect.poll(async () => (await read()).settings.themeId).toBe(premium ? 'technical' : 'code');
const selected = await read(); expect(selected.settings.themeId).toBe(premium ? 'technical' : 'code');
for (const key of ['accentColor', 'bodyFont', 'baseFontSizePt', 'pageMarginMm', 'entryGapMm', 'sectionGapMm', 'lineHeight']) expect(selected.settings[key]).toBeNull();