Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions e2e/tests/pages/hearing.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
};
Expand Down Expand Up @@ -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 () => {
Expand Down
3 changes: 1 addition & 2 deletions src/actions/hearingEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading