diff --git a/e2e/tests/pages/hearing.spec.js b/e2e/tests/pages/hearing.spec.js index 42b6cabf4..f6619f574 100644 --- a/e2e/tests/pages/hearing.spec.js +++ b/e2e/tests/pages/hearing.spec.js @@ -3,11 +3,8 @@ import { expect, test } from '@playwright/test'; const API_URL = process.env.API_URL || 'https://kerrokantasi.api.dev.hel.ninja'; const fetchHearing = async () => { - const res = await fetch(`${API_URL}/v1/hearing/`); - const json = await res.json(); - const openHearings = json.results.filter((hearing) => !hearing.closed); - const hearingId = openHearings[0].id; - const hearing = await fetch(`${API_URL}/v1/hearing/${hearingId}/`); + const hearingSlug = 'kuuleminen-e2e-testausta-varten'; + const hearing = await fetch(`${API_URL}/v1/hearing/${hearingSlug}/`); return hearing.json(); }; @@ -99,7 +96,11 @@ test.describe('Hearing', () => { const questionText = firstQuestion.text.fi; const options = firstQuestion.options.map((o) => o.text.fi); await expect(page.locator('.comment-form')).toContainText(questionText); - await expect(page.getByTestId('question-form-group').locator('.radio')).toContainText(options); + + // Check each option individually to ensure they are present in the form + for (const option of options) { + await expect(page.getByTestId('question-form-group')).toContainText(option); + } }); test('user can successfully submit a comment', async () => { diff --git a/src/actions/hearingEditor.js b/src/actions/hearingEditor.js index 210405956..4fe2557af 100644 --- a/src/actions/hearingEditor.js +++ b/src/actions/hearingEditor.js @@ -391,9 +391,8 @@ export function addSectionAttachment(section, file, title, isNew) { export function saveAndPreviewHearingChanges(hearing) { return (dispatch, getState) => { - const preparedHearing = prepareHearingForSave(hearing); const cleanedHearing = filterTitleAndContentByLanguage( - filterFrontIdsFromAttributes(preparedHearing), getState().hearingEditor.languages + filterFrontIdsFromAttributes(hearing), getState().hearingEditor.languages ); const preSaveAction = createAction(EditorActions.SAVE_HEARING, null, () => ({ fyi: 'saveAndPreview' }))({ cleanedHearing,