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
Fix flaky meeting spec partially
Christophe Bliard36b9e2517f10
diff --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 2fc21de5c09..cc9e4cedb86 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@@ -94,7 +94,7 @@ RSpec.describe "Meetings CRUD",show_page.edit_agenda_item(item) dofill_in "Title", with: "Updated title"- click_on "Save"+ show_page.click_save_and_wait_for_agenda_item_updateend# Expect no notification in window1@@ -285,6 +285,7 @@ RSpec.describe "Meetings CRUD",next_occurrence_page.edit_agenda_item(item) dofill_in "Title", with: "Edited title"click_on "Save"+ sleep 0.5 # wait for save to applyendnext_occurrence_page.trigger_change_polldiff --git a/modules/meeting/spec/features/structured_meetings/update_flash_shared_examples.rb b/modules/meeting/spec/features/structured_meetings/update_flash_shared_examples.rbindex 775bf296a43..eee406a1095 100644--- a/modules/meeting/spec/features/structured_meetings/update_flash_shared_examples.rb+++ b/modules/meeting/spec/features/structured_meetings/update_flash_shared_examples.rb@@ -52,6 +52,7 @@ RSpec.shared_examples "no flash appears when interacting with backlog in multiplshow_page.edit_agenda_item(item) dofill_in "Title", with: "Edited title"click_on "Save"+ sleep 1 # cannot use `show_page.click_save_and_wait_for_agenda_item_update` because of `travel_to`endshow_page.trigger_change_polldiff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rbindex 64c8cfebd71..740f4a1de2e 100644--- a/modules/meeting/spec/support/pages/meetings/show.rb+++ b/modules/meeting/spec/support/pages/meetings/show.rb@@ -33,6 +33,7 @@ require_relative "base"module Pages::Meetingsclass Show < Baseinclude ::Components::Autocompleter::NgSelectAutocompleteHelpers+attr_accessor :meetingdef initialize(meeting)@@ -116,10 +117,12 @@ module Pages::Meetingsclick_on type.model_name.humanend+ created_id = nilin_agenda_form doyield- click_on("Save") if save+ created_id = click_save_and_wait_for_agenda_item_creation if saveend+ expect(page).to have_css("#meeting-agenda-items-item-component-#{created_id}") if created_idenddef expect_modal(...)@@ -134,10 +137,12 @@ module Pages::Meetingsselect_section_action(section, "Add #{type.model_name.human.downcase}")within("#meeting-sections-show-component-#{section.id}") do+ created_id = nilin_agenda_form doyield- click_on("Save") if save+ created_id = click_save_and_wait_for_agenda_item_creation if saveend+ expect(page).to have_css("#meeting-agenda-items-item-component-#{created_id}") if created_idendend@@ -370,13 +375,36 @@ module Pages::Meetingsselect_backlog_action("Add #{type.model_name.human.downcase}")within("#meeting-sections-backlogs-container-component") do+ created_id = nilin_agenda_form doyield- click_on("Save")+ created_id = click_save_and_wait_for_agenda_item_creationend+ expect(page).to have_css("#meeting-agenda-items-item-component-#{created_id}")endend+ def click_save_and_wait_for_agenda_item_creation+ initial_db_items_count = MeetingAgendaItem.count+ click_on("Save")++ # wait for db save+ wait_for { MeetingAgendaItem.count }.not_to eq(initial_db_items_count)++ # return created item id so that caller can wait for it (can't do it here+ # because of being "in_agenda_form" scope)+ MeetingAgendaItem.maximum(:id)+ end++ # warning: does not work when using `travel_to` because time is stopped.+ def click_save_and_wait_for_agenda_item_update+ initial_db_items_updated_at = MeetingAgendaItem.order(:id).pluck(:updated_at)+ click_on("Save")++ # wait for db save+ wait_for { MeetingAgendaItem.order(:id).pluck(:updated_at) }.not_to eq(initial_db_items_updated_at)+ end+def select_backlog_action(action)retry_block doclick_on_backlog_menu