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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Add specs
Mir Bhatia2658937efd57
diff --git a/modules/meeting/spec/factories/meeting_factory.rb b/modules/meeting/spec/factories/meeting_factory.rbindex c594299a981..cb321e6bdb4 100644--- a/modules/meeting/spec/factories/meeting_factory.rb+++ b/modules/meeting/spec/factories/meeting_factory.rb@@ -48,7 +48,7 @@ FactoryBot.define domeeting.project = evaluator.project if evaluator.project# create backlog- create(:meeting_section, meeting:, backlog: true)+ create(:meeting_section, meeting:, backlog: true, title: I18n.t(:label_agenda_backlog))endfactory :meeting_template do |meeting|diff --git a/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb b/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rbindex d4f8aeaacfc..7607247420d 100644--- a/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb+++ b/modules/meeting/spec/features/structured_meetings/work_package_meetings_tab_spec.rb@@ -478,6 +478,103 @@ RSpec.describe "Open the Meetings tab",expect(page.find(".op-meeting-agenda-item--presenter")).to have_text(user.name)end++ context "when testing section selection behaviour" do+ shared_let(:meeting_without_sections) { create(:meeting, project:, start_time: 1.hour.from_now) }+ shared_let(:meeting_with_sections) do+ create(:meeting, project:, start_time: 2.hours.from_now).tap do |meeting|+ create(:meeting_section, meeting:, title: "Section 1")+ create(:meeting_section, meeting:, title: "Section 2")+ end+ end+ shared_let(:recurring_meeting) do+ create(:recurring_meeting, project:)+ end+ shared_let(:empty_recurring_meeting_occurrence) do+ create(:meeting,+ project:,+ recurring_meeting:,+ start_time: 3.hours.from_now)+ end+ shared_let(:recurring_meeting_occurrence) do+ create(:meeting,+ project:,+ recurring_meeting:,+ start_time: 4.hours.from_now).tap do |meeting|+ create(:meeting_section, meeting:, title: "Section 1")+ create(:meeting_section, meeting:, title: "Section 2")+ end+ end++ it "automatically selects the backlog for one-time meetings without sections" do+ check_section_auto_selection(meeting_without_sections, "Agenda backlog")+ end++ it "automatically selects the backlog for one-time meetings with sections" do+ check_section_auto_selection(meeting_with_sections, "Agenda backlog")+ end++ it "automatically selects the last section for recurring meeting occurrences" do+ last_section = recurring_meeting_occurrence.sections.last.title+ check_section_auto_selection(recurring_meeting_occurrence, last_section)+ end++ it "shows no preselection when no sections exist for recurring meeting occurrences" do+ meeting = empty_recurring_meeting_occurrence++ work_package_page.visit!+ switch_to_meetings_tab++ meetings_tab.open_add_to_meeting_dialog++ fill_in("meeting_agenda_item_meeting_id", with: meeting.title)+ page.find(".ng-option-marked", text: meeting.title)+ page.find(".ng-option-marked").click++ wait_for_network_idle++ section_field = find_field("meeting_agenda_item_meeting_section_id")+ expect(section_field).not_to be_disabled++ expect(page).to have_no_css(".ng-value-label")+ end++ it "updates section selection when switching between meetings" do+ work_package_page.visit!+ switch_to_meetings_tab++ meetings_tab.open_add_to_meeting_dialog++ retry_block do+ fill_in("meeting_agenda_item_meeting_id", with: recurring_meeting_occurrence.title)+ page.find(".ng-option-marked", text: recurring_meeting_occurrence.title)+ page.find(".ng-option-marked").click++ wait_for_network_idle++ last_section = recurring_meeting_occurrence.sections.last+ expect(page).to have_content(last_section.title)++ fill_in("meeting_agenda_item_meeting_id", with: meeting_without_sections.title)+ page.find(".ng-option-marked", text: meeting_without_sections.title)+ page.find(".ng-option-marked").click++ wait_for_network_idle++ expect(page).to have_content("Agenda backlog")+ end+ end++ it "shows section autocompleter as disabled when no meeting is selected" do+ work_package_page.visit!+ switch_to_meetings_tab++ meetings_tab.open_add_to_meeting_dialog++ page.find_field("meeting_agenda_item_meeting_section_id", disabled: true, visible: false)+ expect(page).to have_content("Meeting selection is required first")+ end+ endendend@@ -513,8 +610,28 @@ RSpec.describe "Open the Meetings tab",it_behaves_like "with a meetings tab"end+ private+def switch_to_meetings_tabwork_package_page.switch_to_tab(tab: "meetings")meetings_tab.expect_tab_content_rendered # wait for the tab to be renderedend++ def check_section_auto_selection(meeting, expected_section)+ work_package_page.visit!+ switch_to_meetings_tab++ meetings_tab.open_add_to_meeting_dialog++ fill_in("meeting_agenda_item_meeting_id", with: meeting.title)+ page.find(".ng-option-marked", text: meeting.title)+ page.find(".ng-option-marked").click++ wait_for_network_idle++ section_field = find_field("meeting_agenda_item_meeting_section_id")+ expect(section_field).not_to be_disabled++ expect(page).to have_css(".ng-value-label", text: expected_section)+ endend