Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

Merge branch 'dev' into feature/notify-on-meeting-creation

Mir Bhatiae65b1d07c0af
diff --cc modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
index 04cb6654fb5,71b194955a8..e3de7175d85
--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb
@@@ -306,8 -312,132 +321,137 @@@ RSpec.describe "Structured meetings CRU
end
end
+ it "does not send emails on creation when 'Send emails' is unchecked", :unchecked do
+ perform_enqueued_jobs
+ expect(ActionMailer::Base.deliveries.size).to eq 0
+ end
++
+ context "with sections" do
+ let!(:meeting) { create(:structured_meeting, project:, author: current_user) }
+ let(:show_page) { Pages::StructuredMeeting::Show.new(meeting) }
+
+ context "when starting with empty sections" do
+ it "can add, edit and delete sections" do
+ show_page.expect_toast(message: "Successful creation")
+
+ # create the first section
+ show_page.add_section do
+ fill_in "Title", with: "First section"
+ click_on "Save"
+ end
+
+ show_page.expect_section(title: "First section")
+
+ first_section = MeetingSection.find_by!(title: "First section")
+
+ # edit the first section
+ show_page.edit_section(first_section) do
+ fill_in "Title", with: "Updated first section title"
+ click_on "Save"
+ end
+
+ show_page.expect_no_section title: "First section"
+ show_page.expect_section title: "Updated first section title"
+
+ # add a second section
+ show_page.add_section do
+ fill_in "Title", with: "Second section"
+ click_on "Save"
+ end
+
+ show_page.expect_section(title: "Updated first section title")
+ show_page.expect_section(title: "Second section")
+
+ second_section = MeetingSection.find_by!(title: "Second section")
+
+ # remove the second section
+ show_page.remove_section second_section
+
+ ## the first section is still rendered explicitly, as a name was specified
+ show_page.expect_section(title: "Updated first section title")
+ show_page.expect_no_section(title: "Second section")
+
+ # add a section without a name
+ show_page.add_section do
+ click_on "Save"
+ end
+
+ ## "Untitled" is applied automatically as a name
+ show_page.expect_section(title: "Updated first section title")
+ show_page.expect_section(title: "Untitled")
+
+ # remove the first section
+ show_page.remove_section first_section
+
+ ## the last existing section is not explicitly rendered as a section as no name was specified for this section
+ ## -> back to "no section mode"
+ show_page.expect_no_section(title: "Updated first section title")
+ show_page.expect_no_section(title: "Untitled")
+
+ # add a second section again
+ show_page.add_section do
+ fill_in "Title", with: "Second section"
+ click_on "Save"
+ end
+
+ ## the first section without a name is now explicitly rendered as "Untitled"
+ show_page.expect_section(title: "Untitled")
+ show_page.expect_section(title: "Second section")
+
+ second_section = MeetingSection.find_by!(title: "Second section")
+
+ # add an item to the latest section
+ show_page.add_agenda_item do
+ fill_in "Title", with: "First item"
+ fill_in "min", with: "25"
+ end
+
+ show_page.expect_agenda_item_in_section title: "First item", section: second_section
+
+ first_section = MeetingSection.find_by!(title: "Untitled")
+
+ # add an item to the first section explicitly
+ show_page.add_agenda_item_to_section(section: first_section) do
+ fill_in "Title", with: "Second item"
+ fill_in "min", with: "30"
+ end
+
+ show_page.expect_agenda_item_in_section title: "Second item", section: first_section
+
+ # duration per section is shown
+ show_page.expect_section_duration(section: first_section, duration_text: "30 min")
+ show_page.expect_section_duration(section: second_section, duration_text: "25 min")
+
+ item_in_first_section = MeetingAgendaItem.find_by!(title: "Second item")
+ item_in_second_section = MeetingAgendaItem.find_by!(title: "First item")
+
+ show_page.edit_agenda_item(item_in_second_section) do
+ fill_in "min", with: "15"
+ click_on "Save"
+ end
+
+ # duration gets updated
+ show_page.expect_section_duration(section: second_section, duration_text: "15 min")
+
+ # deleting a section with agenda items is not possible
+ show_page.select_section_action(second_section, "Delete") # delete is disabled
+ ## -> no effect
+ show_page.expect_section(title: "Untitled")
+ show_page.expect_section(title: "Second section")
+
+ show_page.click_on_section_menu(second_section) # close the menu again
+
+ # deleting a section without agenda items is possible
+ show_page.remove_agenda_item(item_in_second_section)
+ show_page.remove_section(second_section) # empty secion gets deleted
+
+ # only untitle secion is left -> will not be rendered explicitly as secion
+ show_page.expect_no_section(title: "Untitled")
+ show_page.expect_no_section(title: "Second section")
+
+ # the agenda items of the "untitled" section are still visible in "no-section mode"
+ show_page.expect_agenda_item(title: item_in_first_section.title)
+ end
+ end
+ end
end