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 for one-time backlogs
Mir Bhatiae244057ca9ce
diff --git a/modules/meeting/app/models/meeting.rb b/modules/meeting/app/models/meeting.rbindex 8dad3218a12..5f8e3dc318f 100644--- a/modules/meeting/app/models/meeting.rb+++ b/modules/meeting/app/models/meeting.rb@@ -130,16 +130,17 @@ class Meeting < ApplicationRecord### Cache key for detecting changes to be shown to the user- def changed_hash # rubocop:disable Metrics/AbcSize+ def changed_hashparts = Meeting- .unscoped- .where(id:)- .left_joins(:agenda_items, :sections, agenda_items: :outcomes)- .pick(- MeetingAgendaItem.arel_table[:updated_at].maximum,- MeetingSection.arel_table[:updated_at].maximum,- MeetingOutcome.arel_table[:updated_at].maximum- )+ .unscoped+ .where(id:)+ .joins("LEFT JOIN meeting_sections ON meeting_sections.meeting_id = meetings.id")+ .left_joins(:agenda_items, agenda_items: %i[outcomes meeting_section])+ .pick(+ Arel.sql("MAX(CASE WHEN meeting_sections.backlog = FALSE THEN meeting_agenda_items.updated_at END)"),+ Arel.sql("MAX(CASE WHEN meeting_sections.backlog = FALSE THEN meeting_sections.updated_at END)"),+ Arel.sql("MAX(meeting_outcomes.updated_at)")+ )parts << lock_versiondiff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rbindex 2db7b6b2951..e8a57872dd8 100644--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_update_flash_spec.rb@@ -52,130 +52,225 @@ RSpec.describe "Meetings CRUD",.and_return(0)end- it do- flash_component = ".op-primer-flash--item"+ context "for meeting related actions" do+ it do+ flash_component = ".op-primer-flash--item"- ## Add agenda item- show_page.visit!+ ## Add agenda item+ show_page.visit!- first_window = current_window- second_window = open_new_window+ first_window = current_window+ second_window = open_new_window- within_window(second_window) do- show_page.visit!+ within_window(second_window) do+ show_page.visit!- show_page.add_agenda_item do- fill_in "Title", with: "Update toast test item"+ retry_block do+ show_page.add_agenda_item do+ fill_in "Title", with: "Update toast test item"+ end+ endend- end- # Expect notification in window1- within_window(first_window) do- show_page.trigger_change_poll- expect(page).to have_css(flash_component, wait: 5)- expect(page).to have_text I18n.t(:notice_meeting_updated)- page.within(flash_component) { click_on "Reload" }- end+ # Expect notification in window1+ within_window(first_window) do+ show_page.trigger_change_poll+ expect(page).to have_css(flash_component, wait: 5)+ expect(page).to have_text I18n.t(:notice_meeting_updated)+ page.within(flash_component) { click_on "Reload" }+ sleep 1+ end- # Expect no notification in window2- within_window(second_window) do- show_page.trigger_change_poll- expect(page).to have_no_text I18n.t(:notice_meeting_updated)- end+ # Expect no notification in window2+ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end- ## Edit agenda item- within_window(first_window) do- item = MeetingAgendaItem.find_by(title: "Update toast test item")+ ## Edit agenda item+ within_window(first_window) do+ item = MeetingAgendaItem.find_by(title: "Update toast test item")- show_page.edit_agenda_item(item) do- fill_in "Title", with: "Updated title"- click_on "Save"+ show_page.edit_agenda_item(item) do+ fill_in "Title", with: "Updated title"+ click_on "Save"+ end++ # Expect no notification in window1+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)end- # Expect no notification in window1- show_page.trigger_change_poll- expect(page).to have_no_text I18n.t(:notice_meeting_updated)- end+ # Expect notification in window2+ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_css(flash_component, wait: 5)+ expect(page).to have_text I18n.t(:notice_meeting_updated)- # Expect notification in window2- within_window(second_window) do- show_page.trigger_change_poll- expect(page).to have_css(flash_component, wait: 5)- expect(page).to have_text I18n.t(:notice_meeting_updated)+ page.within(flash_component) { click_on "Reload" }+ sleep 1- page.within(flash_component) { click_on "Reload" }+ ## Add section+ show_page.add_section do+ fill_in "Title", with: "First section"+ click_on "Save"+ end- ## Add section- show_page.add_section do- fill_in "Title", with: "First section"- click_on "Save"+ show_page.expect_section(title: "First section")+ show_page.visit!+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)end- show_page.expect_section(title: "First section")- show_page.visit!- expect(page).to have_no_text I18n.t(:notice_meeting_updated)- end+ # Expect notification in window1+ within_window(first_window) do+ show_page.trigger_change_poll+ expect(page).to have_css(flash_component, wait: 5)+ expect(page).to have_text I18n.t(:notice_meeting_updated)+ page.within(flash_component) { click_on "Reload" }+ sleep 1+ end- # Expect notification in window1- within_window(first_window) do- show_page.trigger_change_poll- expect(page).to have_css(flash_component, wait: 5)- expect(page).to have_text I18n.t(:notice_meeting_updated)- page.within(flash_component) { click_on "Reload" }- end+ # Expect no notification in window2+ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end- # Expect no notification in window2- within_window(second_window) do- show_page.trigger_change_poll- expect(page).to have_no_text I18n.t(:notice_meeting_updated)- end+ ## Edit meeting details+ within_window(first_window) do+ find_test_selector("edit-meeting-details-button").click+ fill_in "meeting_duration", with: "2.5"+ click_link_or_button "Save"- ## Edit meeting details- within_window(first_window) do- find_test_selector("edit-meeting-details-button").click- fill_in "meeting_duration", with: "2.5"- click_link_or_button "Save"+ # Expect updated duration+ expect(page).to have_text "2 hrs, 30 mins"- # Expect updated duration- expect(page).to have_text "2 hrs, 30 mins"+ # Expect no notification in window1+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end- # Expect no notification in window1- show_page.trigger_change_poll- expect(page).to have_no_text I18n.t(:notice_meeting_updated)- end+ # Expect notification in window2+ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_text I18n.t(:notice_meeting_updated)- # Expect notification in window2- within_window(second_window) do- show_page.trigger_change_poll- expect(page).to have_text I18n.t(:notice_meeting_updated)+ page.within(flash_component) { click_on "Reload" }+ sleep 1- page.within(flash_component) { click_on "Reload" }+ ## Close meeting+ find_test_selector("close-meeting-button").click+ expect(page).to have_text "This meeting is in progress."+ find_test_selector("close-meeting-button").click+ expect(page).to have_text "This meeting is closed."- ## Close meeting- find_test_selector("close-meeting-button").click- expect(page).to have_text "This meeting is in progress."- find_test_selector("close-meeting-button").click- expect(page).to have_text "This meeting is closed."+ show_page.visit!+ expect(page).to have_text "This meeting is closed."+ end- show_page.visit!- expect(page).to have_text "This meeting is closed."- end+ # Expect notification in window1+ within_window(first_window) do+ show_page.trigger_change_poll+ expect(page).to have_css(flash_component, wait: 5)+ expect(page).to have_text I18n.t(:notice_meeting_updated)+ page.within(flash_component) { click_on "Reload" }+ sleep 1+ end++ # Expect no notification in window2+ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end- # Expect notification in window1- within_window(first_window) do- show_page.trigger_change_poll- expect(page).to have_css(flash_component, wait: 5)- expect(page).to have_text I18n.t(:notice_meeting_updated)- page.within(flash_component) { click_on "Reload" }+ second_window.closeend+ end- # Expect no notification in window2- within_window(second_window) do- show_page.trigger_change_poll- expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ context "for backlog related actions" do+ context "for one-time meetings" do+ it do+ show_page.visit!+ first_window = current_window+ second_window = open_new_window++ # Add item to backlog - expect no flash in both windows+ within_window(first_window) do+ show_page.add_agenda_item_to_backlog do+ fill_in "Title", with: "Backlog agenda item"+ end++ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end++ within_window(second_window) do+ show_page.visit!++ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)++ # Edit item in backlog - expect no flash in both windows+ item = MeetingAgendaItem.find_by(title: "Backlog agenda item")+ show_page.edit_agenda_item(item) do+ fill_in "Title", with: "Edited title"+ click_on "Save"+ end++ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end++ within_window(first_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ show_page.reload!++ # Reorder items in backlog - expect no flash in both windows+ show_page.add_agenda_item_to_backlog do+ fill_in "Title", with: "Second item"+ end+ item = MeetingAgendaItem.find_by(title: "Edited title")+ retry_block do+ show_page.select_action(item, I18n.t(:label_agenda_item_move_to_bottom))+ end++ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end++ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)++ # Delete item in backlog - expect no flash in both windows+ item = MeetingAgendaItem.find_by(title: "Edited title")+ show_page.remove_agenda_item(item)++ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end++ within_window(first_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)++ # Clear backlog - expect no flash in both windows+ show_page.clear_backlog++ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end++ within_window(second_window) do+ show_page.trigger_change_poll+ expect(page).to have_no_text I18n.t(:notice_meeting_updated)+ end++ second_window.close+ endend- second_window.closeendendenddiff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rbindex 4eeb4c1a1c1..52c9c1ea17d 100644--- a/modules/meeting/spec/support/pages/meetings/show.rb+++ b/modules/meeting/spec/support/pages/meetings/show.rb@@ -391,12 +391,10 @@ module Pages::Meetingsenddef clear_backlog- retry_block do- select_backlog_action(I18n.t("label_backlog_clear"))- expect(page).to have_modal(I18n.t("label_backlog_clear"))- page.within_modal(I18n.t("label_backlog_clear")) do- click_on "Clear all"- end+ select_backlog_action(I18n.t("label_backlog_clear"))+ expect(page).to have_modal(I18n.t("label_backlog_clear"), wait: 3)+ page.within_modal(I18n.t("label_backlog_clear")) do+ click_on "Clear all"endend