fix(tests): resolve 9 CI test failures in journey-editor specs
All checks were successful
CI / Unit & Component Tests (pull_request) Successful in 3m29s
CI / OCR Service Tests (pull_request) Successful in 24s
CI / Backend Unit Tests (pull_request) Successful in 3m52s
CI / fail2ban Regex (pull_request) Successful in 48s
CI / Semgrep Security Scan (pull_request) Successful in 24s
CI / Compose Bucket Idempotency (pull_request) Successful in 1m7s

- useBlockDragDrop: add runtime expect() alongside expectTypeOf so
  browser-mode runner counts at least one assertion
- JourneyAddBar: use exact:true on 'Hinzufügen' button — partial match
  was hitting '+ Brief hinzufügen' and '+ Zwischentext hinzufügen' too
- JourneyEditor: fix 4 issues — drop wrong not.toBeInTheDocument()
  (placeholder creates accessible name); pass title:'' in publish-disabled
  test (default was non-empty); use getByPlaceholder for interlude
  textarea to avoid 4-element strict-mode violation; exact:true for
  'Hinzufügen' button
- DocumentPickerDropdown: use .click({force:true}) on aria-disabled
  option — userEvent refuses non-enabled elements

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-06-09 13:20:35 +02:00
parent 1f9107b620
commit ddcf61cc5e
4 changed files with 13 additions and 10 deletions

View File

@@ -85,7 +85,8 @@ describe('DocumentPickerDropdown — selection', () => {
await userEvent.fill(page.getByRole('combobox'), 'Brief');
await waitForDebounce();
await userEvent.click(page.getByRole('option', { name: /Brief von Eugenie/i }));
// aria-disabled items are not "enabled" — userEvent refuses them; use force click
await page.getByRole('option', { name: /Brief von Eugenie/i }).click({ force: true });
expect(onSelect).not.toHaveBeenCalled();
});

View File

@@ -25,6 +25,8 @@ describe('createBlockDragDrop — generic type guard', () => {
it('TranscriptionBlockData caller still compiles — regression guard for existing transcription editor', () => {
// If the generic constraint is wrong this line fails tsc --noEmit
expectTypeOf(createBlockDragDrop<TranscriptionBlockData>).toBeFunction();
// Runtime assertion so browser-mode doesn't report "no assertions"
expect(typeof createBlockDragDrop).toBe('function');
});
});

View File

@@ -11,7 +11,7 @@ describe('JourneyAddBar — interlude flow', () => {
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
const confirmBtn = page.getByRole('button', { name: 'Hinzufügen' });
const confirmBtn = page.getByRole('button', { name: 'Hinzufügen', exact: true });
await expect.element(confirmBtn).toHaveAttribute('aria-disabled', 'true');
});
@@ -21,7 +21,7 @@ describe('JourneyAddBar — interlude flow', () => {
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
await userEvent.fill(page.getByRole('textbox'), 'Eine schöne Reise');
const confirmBtn = page.getByRole('button', { name: 'Hinzufügen' });
const confirmBtn = page.getByRole('button', { name: 'Hinzufügen', exact: true });
await expect.element(confirmBtn).toHaveAttribute('aria-disabled', 'false');
});
@@ -31,7 +31,7 @@ describe('JourneyAddBar — interlude flow', () => {
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
await userEvent.fill(page.getByRole('textbox'), 'Reise nach Wien');
await userEvent.click(page.getByRole('button', { name: 'Hinzufügen' }));
await userEvent.click(page.getByRole('button', { name: 'Hinzufügen', exact: true }));
expect(onAddInterlude).toHaveBeenCalledWith('Reise nach Wien');
});

View File

@@ -47,9 +47,8 @@ afterEach(() => {
describe('JourneyEditor — empty state', () => {
it('renders title input and intro textarea', async () => {
render(JourneyEditor, defaultProps());
await expect.element(page.getByRole('textbox', { name: /Titel/ })).not.toBeInTheDocument(); // input has no aria-label
// title input has placeholder text
await expect.element(page.getByPlaceholder(/Titel/)).toBeInTheDocument();
await expect.element(page.getByPlaceholder(/Einleitung/)).toBeInTheDocument();
});
it('publish button disabled when no items', async () => {
@@ -80,6 +79,7 @@ describe('JourneyEditor — publish disabled when title empty', () => {
JourneyEditor,
defaultProps({
geschichte: makeGeschichte({
title: '',
items: [{ id: 'i1', position: 0, document: docSummary('d1', 'Brief A') }]
})
})
@@ -163,8 +163,8 @@ describe('JourneyEditor — add interlude', () => {
render(JourneyEditor, defaultProps());
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
await userEvent.fill(page.getByRole('textbox'), 'Reise nach Wien');
await userEvent.click(page.getByRole('button', { name: 'Hinzufügen' }));
await userEvent.fill(page.getByPlaceholder('Zwischentext eingeben…'), 'Reise nach Wien');
await userEvent.click(page.getByRole('button', { name: 'Hinzufügen', exact: true }));
expect(globalThis.fetch).toHaveBeenCalledWith(
expect.stringContaining('/items'),
@@ -203,8 +203,8 @@ describe('JourneyEditor — remove with rollback', () => {
// Add interlude (no unsaved warning should interfere)
await userEvent.click(page.getByText('Zwischentext hinzufügen'));
await userEvent.fill(page.getByRole('textbox'), 'Test');
await userEvent.click(page.getByRole('button', { name: 'Hinzufügen' }));
await userEvent.fill(page.getByPlaceholder('Zwischentext eingeben…'), 'Test');
await userEvent.click(page.getByRole('button', { name: 'Hinzufügen', exact: true }));
// Saving (which requires non-empty title) — no unsaved warning dialog
await expect.element(page.getByRole('dialog')).not.toBeInTheDocument();