feat(cv): rebuild section editing workflow
CI and Deploy / test (push) Failing after 30s
CI and Deploy / deploy (push) Has been skipped

This commit is contained in:
cesnimda
2026-08-27 15:27:54 +02:00
parent ccd0af908c
commit b5249357c7
10 changed files with 525 additions and 221 deletions
@@ -177,8 +177,12 @@ test('custom entries can be added, edited, reordered and deleted with confirmati
renderAt(3);
await screen.findByLabelText('Headline override');
fireEvent.click(screen.getByRole('button', { name: 'Add' }));
fireEvent.change(screen.getByLabelText('Custom section title'), { target: { value: 'Selected projects' } });
fireEvent.mouseDown(screen.getByLabelText('Section type'));
fireEvent.click(await screen.findByRole('option', { name: 'Additional Experience' }));
fireEvent.click(screen.getByRole('button', { name: 'Add section' }));
const title = screen.getByLabelText(/Section name for custom:/);
fireEvent.change(title, { target: { value: 'Selected projects' } });
fireEvent.click(screen.getByRole('button', { name: 'Expand Selected projects' }));
fireEvent.click(screen.getByRole('button', { name: 'Add entry' }));
fireEvent.change(screen.getByLabelText('Entry 1'), { target: { value: 'First project' } });
fireEvent.click(screen.getByRole('button', { name: 'Add entry' }));
@@ -207,15 +211,15 @@ test('custom entries can be added, edited, reordered and deleted with confirmati
}),
}));
fireEvent.click(screen.getByRole('button', { name: 'Remove custom section' }));
fireEvent.click(screen.getByRole('button', { name: 'Remove Selected projects section from this CV' }));
dialog = await screen.findByRole('dialog', { name: 'Delete custom section' });
fireEvent.click(within(dialog).getByRole('button', { name: 'Cancel' }));
await waitFor(() => expect(screen.queryByRole('dialog')).not.toBeInTheDocument());
expect(screen.getByLabelText('Custom section title')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Remove custom section' }));
expect(screen.getByLabelText(/Section name for custom:/)).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Remove Selected projects section from this CV' }));
dialog = await screen.findByRole('dialog', { name: 'Delete custom section' });
fireEvent.click(within(dialog).getByRole('button', { name: 'Delete section' }));
await waitFor(() => expect(screen.queryByLabelText('Custom section title')).not.toBeInTheDocument());
await waitFor(() => expect(screen.queryByLabelText(/Section name for custom:/)).not.toBeInTheDocument());
});
test('profile-backed sections expand, reorder, hide and persist variant-only overrides', async () => {
@@ -230,8 +234,8 @@ test('profile-backed sections expand, reorder, hide and persist variant-only ove
mockedApi.put.mockResolvedValue({ data: variant } as any);
renderAt(3);
fireEvent.click(await screen.findByRole('button', { name: 'Expand Experience entries' }));
expect(screen.getByRole('button', { name: 'Collapse Experience entries' })).toHaveAttribute('aria-expanded', 'true');
fireEvent.click(await screen.findByRole('button', { name: 'Expand Experience' }));
expect(screen.getByRole('button', { name: 'Collapse Experience' })).toHaveAttribute('aria-expanded', 'true');
fireEvent.click(screen.getByRole('button', { name: 'Move Engineer entry down' }));
fireEvent.click(screen.getByRole('button', { name: 'Hide Lead entry' }));
fireEvent.click(screen.getByRole('button', { name: 'Move Experience section down' }));
@@ -253,7 +257,7 @@ test('preview failure is visible and retryable without leaving the editor', asyn
expect(await screen.findByText('Preview unavailable')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Retry preview' }));
await waitFor(() => expect(screen.getByTitle('CV preview')).toHaveAttribute('srcdoc', '<p>retry</p>'));
expect(screen.getByTitle('CV preview')).toHaveAttribute('sandbox', 'allow-same-origin');
await waitFor(() => expect(screen.getByTitle('CV preview').getAttribute('srcdoc')).toContain('<p>retry</p>'));
expect(screen.getByTitle('CV preview')).toHaveAttribute('sandbox', 'allow-same-origin allow-scripts');
await waitFor(() => expect(screen.queryByText('Preview unavailable')).not.toBeInTheDocument());
});