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 and update specs
Mir Bhatiabd26b00c7933
diff --git a/modules/meeting/app/components/meetings/email_updates_banner_component.rb b/modules/meeting/app/components/meetings/email_updates_banner_component.rbindex dbc8e91a1f9..c6540453b87 100644--- a/modules/meeting/app/components/meetings/email_updates_banner_component.rb+++ b/modules/meeting/app/components/meetings/email_updates_banner_component.rb@@ -37,7 +37,7 @@ module Meetingsenddef call- render(Primer::Alpha::Banner.new(description:, scheme:, icon:))+ render(Primer::Alpha::Banner.new(description:, scheme:, icon:, data: { "test-selector": "notifications-banner" }))endprivatediff --git a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erbindex c7f56e7ab1a..3df9d4e8a10 100644--- a/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb+++ b/modules/meeting/app/components/meetings/side_panel/notifications_button_component.html.erb@@ -28,7 +28,7 @@ See COPYRIGHT and LICENSE files for more details.++#%><%=- component_wrapper do+ component_wrapper(data: { "test-selector": "notifications-button" }) dorender(Primer::OpenProject::SidePanel::Section.new) do |section|section.with_title { I18n.t("meeting.notifications.sidepanel.title") }diff --git a/modules/meeting/app/controllers/meetings_controller.rb b/modules/meeting/app/controllers/meetings_controller.rbindex 620cff93d1d..65a199efba8 100644--- a/modules/meeting/app/controllers/meetings_controller.rb+++ b/modules/meeting/app/controllers/meetings_controller.rb@@ -469,6 +469,7 @@ class MeetingsController < ApplicationController@converted_params[:project] = @project if @project.present?@converted_params[:duration] = @converted_params[:duration].to_hours if @converted_params[:duration].present?+ @converted_params[:send_notifications] = meeting_params[:notify] == "1" && params[:meeting][:copied_from_meeting_id].present?# Handle participants separately for each meeting type@converted_params[:participants_attributes] ||= {}@@ -485,9 +486,10 @@ class MeetingsController < ApplicationControllerdef meeting_paramsif params[:meeting].present?params- .expect(meeting: [:title, :location, :start_time, :project_id,- :duration, :start_date, :start_time_hour, :notify,- { participants_attributes: %i[email name invited attended user user_id meeting id] }])+ .require(:meeting) # rubocop:disable Rails/StrongParametersExpect+ .permit(:title, :location, :start_time, :project_id,+ :duration, :start_date, :start_time_hour, :notify,+ participants_attributes: %i[email name invited attended user user_id meeting id])endend@@ -539,7 +541,7 @@ class MeetingsController < ApplicationController{copy_agenda: copy_param(:copy_agenda),copy_attachments: copy_param(:copy_attachments),- send_notifications: meeting_params[:notify] == "1" && params[:meeting][:copied_from_meeting_id].present?+ send_notifications: @converted_params[:send_notifications]}enddiff --git a/modules/meeting/app/forms/meeting/send_email_updates.rb b/modules/meeting/app/forms/meeting/send_email_updates.rbindex 3791c9cd109..88e2e1278a7 100644--- a/modules/meeting/app/forms/meeting/send_email_updates.rb+++ b/modules/meeting/app/forms/meeting/send_email_updates.rb@@ -33,7 +33,7 @@ class Meeting::SendEmailUpdates < ApplicationFormmeeting_form.check_box(name: "notify",label: I18n.t("label_meeting_send_updates"),- checked: checked?,+ checked: true,data: {"show-when-checked-target": "cause","show-when-checked-target-name": "notification-banner"@@ -47,10 +47,4 @@ class Meeting::SendEmailUpdates < ApplicationForm@meeting = meeting@copy_from = copy_fromend-- def checked?- return true unless @copy_from.nil?-- @meeting.notify? != false- endenddiff --git a/modules/meeting/spec/components/meetings/email_updates_banner_component_spec.rb b/modules/meeting/spec/components/meetings/email_updates_banner_component_spec.rbnew file mode 100644index 00000000000..f447ad295af--- /dev/null+++ b/modules/meeting/spec/components/meetings/email_updates_banner_component_spec.rb@@ -0,0 +1,175 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "rails_helper"++RSpec.describe Meetings::EmailUpdatesBannerComponent, type: :component do+ let(:project) { create(:project) }++ subject do+ render_inline(described_class.new(meeting, override: override))+ page+ end++ context "when it's a one-time meeting" do+ let(:meeting) do+ build_stubbed(:meeting,+ project:,+ recurring_meeting_id: nil,+ template: false,+ notify:)+ end+ let(:override) { nil }++ context "and notifications are enabled" do+ let(:notify) { true }++ it "renders the onetime enabled banner" do+ expect(subject).to have_text I18n.t("meeting.notifications.banner.onetime.enabled")+ expect(subject).to have_css(".Banner")+ expect(subject).to have_no_selector(".Banner--warning")+ end+ end++ context "and notifications are disabled" do+ let(:notify) { false }++ it "renders the onetime disabled banner" do+ expect(subject).to have_text I18n.t("meeting.notifications.banner.onetime.disabled")+ expect(subject).to have_css(".Banner--warning")+ end+ end+ end++ context "when it's a meeting series template" do+ let(:recurring_meeting) do+ create(:recurring_meeting,+ project:)+ end+ let(:meeting) do+ meeting = recurring_meeting.template+ meeting.update!(notify:)+ meeting+ end+ let(:override) { nil }++ context "and notifications are enabled" do+ let(:notify) { true }++ it "renders the template enabled banner" do+ expect(subject).to have_text I18n.t("meeting.notifications.banner.template.enabled")+ expect(subject).to have_css(".Banner")+ expect(subject).to have_no_selector(".Banner--warning")+ end+ end++ context "and notifications are disabled" do+ let(:notify) { false }++ it "renders the template disabled banner" do+ expect(subject).to have_text I18n.t("meeting.notifications.banner.template.disabled")+ expect(subject).to have_css(".Banner--warning")+ end+ end+ end++ context "when it's an occurrence of a meeting series" do+ let(:recurring_meeting) do+ create(:recurring_meeting,+ project:)+ end+ let(:template) do+ template = recurring_meeting.template+ template.update!(notify:)+ template+ end+ let(:meeting) do+ create(:meeting,+ project:,+ recurring_meeting_id: recurring_meeting.id,+ template: false)+ end+ let(:override) { nil }++ context "and notifications are enabled" do+ let(:notify) { true }++ it "renders the occurrence enabled banner" do+ template+ expect(subject).to have_text I18n.t("meeting.notifications.banner.occurrence.enabled")+ expect(subject).to have_css(".Banner")+ expect(subject).to have_no_selector(".Banner--warning")+ end+ end++ context "and notifications are disabled" do+ let(:notify) { false }++ it "renders the occurrence disabled banner" do+ template+ expect(subject).to have_text I18n.t("meeting.notifications.banner.occurrence.disabled")+ expect(subject).to have_css(".Banner--warning")+ end+ end+ end++ context "when override is passed as 'enabled'" do+ let(:meeting) do+ build_stubbed(:meeting,+ project:,+ recurring_meeting_id: nil,+ template: false,+ notify: false)+ end+ let(:override) { "enabled" }++ it "renders the enabled banner regardless of notify" do+ expect(subject).to have_text I18n.t("meeting.notifications.banner.onetime.enabled")+ expect(subject).to have_css(".Banner")+ expect(subject).to have_no_selector(".Banner--warning")+ end+ end++ context "when override is passed as 'disabled'" do+ let(:meeting) do+ build_stubbed(:meeting,+ project:,+ recurring_meeting_id: nil,+ template: false,+ notify: true)+ end+ let(:override) { "disabled" }++ it "renders the disabled banner regardless of notify" do+ expect(subject).to have_text I18n.t("meeting.notifications.banner.onetime.disabled")+ expect(subject).to have_css(".Banner--warning")+ end+ end+enddiff --git a/modules/meeting/spec/components/meetings/side_panel/toggle_notifications_dialog_component_spec.rb b/modules/meeting/spec/components/meetings/side_panel/toggle_notifications_dialog_component_spec.rbnew file mode 100644index 00000000000..a7b0486e1f8--- /dev/null+++ b/modules/meeting/spec/components/meetings/side_panel/toggle_notifications_dialog_component_spec.rb@@ -0,0 +1,75 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "rails_helper"++RSpec.describe Meetings::SidePanel::ToggleNotificationsDialogComponent, type: :component do+ include Rails.application.routes.url_helpers++ let(:user) { build_stubbed(:user) }+ let(:project) { build_stubbed(:project) }++ before do+ login_as(user)+ end++ subject do+ render_inline(described_class.new(meeting))+ page+ end++ context "when notifications are enabled" do+ let(:meeting) { build_stubbed(:meeting, project:, notify: true) }++ it "renders the dialog with strings for disabling" do+ expect(subject).to have_text I18n.t("meeting.notifications.dialog.title.disable")+ expect(subject).to have_text I18n.t("meeting.notifications.dialog.message.disable")+ expect(subject).to have_button I18n.t("meeting.notifications.dialog.confirm_label.disable")+ end++ it "renders the correct form action" do+ expect(subject).to have_element "form", action: toggle_notifications_project_meeting_path(project, meeting)+ end+ end++ context "when notifications are disabled" do+ let(:meeting) { build_stubbed(:meeting, project:, notify: false) }++ it "renders the dialog with strings for enabling" do+ expect(subject).to have_text I18n.t("meeting.notifications.dialog.title.enable")+ expect(subject).to have_text I18n.t("meeting.notifications.dialog.message.enable")+ expect(subject).to have_button I18n.t("meeting.notifications.dialog.confirm_label.enable")+ end++ it "renders the correct form action" do+ expect(subject).to have_element "form", action: toggle_notifications_project_meeting_path(project, meeting)+ end+ end+enddiff --git a/modules/meeting/spec/features/meeting_notifications_spec.rb b/modules/meeting/spec/features/meeting_notifications_spec.rbnew file mode 100644index 00000000000..da200106b18--- /dev/null+++ b/modules/meeting/spec/features/meeting_notifications_spec.rb@@ -0,0 +1,369 @@+# frozen_string_literal: true++#-- copyright+# OpenProject is an open source project management software.+# Copyright (C) the OpenProject GmbH+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License version 3.+#+# OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+# Copyright (C) 2006-2013 Jean-Philippe Lang+# Copyright (C) 2010-2013 the ChiliProject Team+#+# This program is free software; you can redistribute it and/or+# modify it under the terms of the GNU General Public License+# as published by the Free Software Foundation; either version 2+# of the License, or (at your option) any later version.+#+# This program is distributed in the hope that it will be useful,+# but WITHOUT ANY WARRANTY; without even the implied warranty of+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the+# GNU General Public License for more details.+#+# You should have received a copy of the GNU General Public License+# along with this program; if not, write to the Free Software+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+#+# See COPYRIGHT and LICENSE files for more details.+#++++require "spec_helper"++require_relative "../support/pages/meetings/show"+require_relative "../support/pages/meetings/index"+require_relative "../support/pages/recurring_meeting/show"++RSpec.describe "Meeting notifications", :js do+ shared_let(:project) { create(:project, enabled_module_names: %w[meetings]) }+ shared_let(:user) do+ create(:user,+ lastname: "First",+ member_with_permissions: { project => %i[view_meetings create_meetings edit_meetings delete_meetings manage_agendas] })+ end++ before do+ login_as(user)+ end++ shared_examples "notification checkbox behaviour" do+ it "shows checkbox checked initially" do+ within "#meeting-form" do+ expect(page).to have_field(I18n.t("label_meeting_send_updates"), type: "checkbox", checked: true)+ end+ end++ it "toggles banner on checkbox change" do+ within "#meeting-form" do+ # toggle between checkbox states+ checkbox = find_field(I18n.t("label_meeting_send_updates"))+ expect(page).to have_css(".Banner", text: enabled_text.strip)++ checkbox.click+ expect(page).to have_css(".Banner", text: disabled_text.strip)++ checkbox.click+ expect(page).to have_css(".Banner", text: enabled_text.strip)+ end+ end+ end++ context "for a one-time meeting" do+ let(:current_user) { user }+ let(:meeting) { Meeting.last }+ let(:show_page) { Pages::Meetings::Show.new(meeting) }+ let(:meetings_page) { Pages::Meetings::Index.new(project:) }++ let(:enabled_text) { I18n.t("meeting.notifications.banner.onetime.enabled") }+ let(:disabled_text) { I18n.t("meeting.notifications.banner.onetime.disabled") }++ before do+ meetings_page.visit!+ meetings_page.click_on "add-meeting-button"+ meetings_page.click_on "One-time"+ end++ include_examples "notification checkbox behaviour"++ it "sets and toggle the calendar updates state" do+ meetings_page.set_title "Some title"+ meetings_page.click_create++ # check if notify is set correct+ expect(meeting.notify).to be true++ # do not send initial mail+ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 0++ show_page.visit!++ # check calendar updates sidepanel component+ page.within("[data-test-selector='notifications-button']") do+ expect(page).to have_text("Email calendar updates")+ expect(page).to have_text("Enabled.")+ expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")+ expect(page).to have_selector(:link_or_button, "Disable")+ end++ # edit meeting and check that mail is sent+ page.find("[data-test-selector='edit-meeting-details-button']").click+ retry_block do+ page.find(".Overlay")+ end++ page.within(".Overlay") do+ expect(page).to have_test_selector("notifications-banner")+ show_page.set_start_time "12:00"+ click_on "Save"+ end++ wait_for_network_idle++ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 1+ ActionMailer::Base.deliveries.clear++ # disable updates from the sidepanel+ page.within("[data-test-selector='notifications-button']") do+ click_on "Disable"+ end++ show_page.expect_modal "Disable email calendar updates?"+ show_page.within_modal "Disable email calendar updates?" do+ click_on "Disable email updates"+ end++ wait_for_network_idle++ # check that updates are now disabled+ expect(meeting.reload.notify).to be false++ page.within("[data-test-selector='notifications-button']") do+ expect(page).to have_text("Email calendar updates")+ expect(page).to have_text("Disabled.")+ expect(page).to have_text("Participants will not receive an email informing them of changes.")+ expect(page).to have_selector(:link_or_button, "Enable")+ end++ page.find("[data-test-selector='edit-meeting-details-button']").click+ retry_block do+ page.find(".Overlay")+ end++ page.within(".Overlay") do+ expect(page).to have_test_selector("notifications-banner")+ show_page.set_start_time "12:00"+ click_on "Save"+ end++ wait_for_network_idle++ # check that no mails are sent on edit/delete+ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 0++ show_page.trigger_dropdown_menu_item "Delete meeting"+ show_page.expect_modal "Delete meeting"++ show_page.within_modal "Delete meeting" do+ click_on "Delete"+ end++ wait_for_network_idle++ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 0+ end+ end++ context "when creating a recurring meeting" do+ let(:current_user) { user }+ let(:meetings_page) { Pages::Meetings::Index.new(project:) }++ let(:enabled_text) { I18n.t("meeting.notifications.banner.template.enabled") }+ let(:disabled_text) { I18n.t("meeting.notifications.banner.template.disabled") }++ before do+ meetings_page.visit!+ meetings_page.click_on "add-meeting-button"+ page.within(".Overlay") do+ meetings_page.click_on "Recurring"+ end+ end++ include_examples "notification checkbox behaviour"+ end++ context "for a recurring meeting" do+ let(:current_user) { user }+ let(:meeting) do+ create :recurring_meeting,+ :skip_validations,+ project:,+ start_time: 1.day.from_now.to_date,+ duration: 1.5,+ frequency: "weekly",+ end_after: "specific_date",+ end_date: 1.year.from_now.to_date,+ author: current_user+ end+ let(:show_page) { Pages::RecurringMeeting::Show.new(meeting) }+ let(:template_page) { Pages::Meetings::Show.new(meeting.template) }+ let(:occurrence_page) { Pages::Meetings::Show.new(meeting.meetings.where(template: false).first) }++ it "can set and toggle the calendar updates state for the template and occurrences" do+ template_page.visit!++ expect(meeting.template.notify).to be true+ page.within("#meetings-header-component") do+ click_on "Open first meeting"+ end++ wait_for_network_idle++ # check if mail is sent on opening first meeting+ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 1+ ActionMailer::Base.deliveries.clear++ template_page.visit!++ # check sidepanel component+ page.within("[data-test-selector='notifications-button']") do+ expect(page).to have_text("Email calendar updates")+ expect(page).to have_text("Enabled.")+ expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")+ expect(page).to have_selector(:link_or_button, "Disable")+ end++ # edit series and check that mail is sent+ page.find("[data-test-selector='edit-meeting-details-button']").click+ retry_block do+ page.find(".Overlay")+ end++ page.within(".Overlay") do+ expect(page).to have_test_selector("notifications-banner")+ expect(page).to have_text(I18n.t("meeting.notifications.banner.template.enabled"))+ template_page.set_start_time "12:00"+ wait_for_network_idle+ click_on "Save"+ end++ wait_for_network_idle++ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 1+ ActionMailer::Base.deliveries.clear++ # switch to occurrence and check sidepanel component+ occurrence_page.visit!++ page.within("[data-test-selector='notifications-button']") do+ expect(page).to have_text("Email calendar updates")+ expect(page).to have_text("Enabled.")+ expect(page).to have_text("All participants will receive updated calendar invites via email informing them of changes.")+ expect(page).to have_no_selector(:link_or_button, "Disable")+ expect(page).to have_text("To change this, edit the series template.")+ end++ # edit occurrence and check that mail is sent+ page.find("[data-test-selector='edit-meeting-details-button']").click+ retry_block do+ page.find(".Overlay")+ end++ page.within(".Overlay") do+ expect(page).to have_test_selector("notifications-banner")+ expect(page).to have_text(I18n.t("meeting.notifications.banner.occurrence.enabled"))+ occurrence_page.set_start_time "13:00"+ wait_for_network_idle+ click_on "Save"+ end++ wait_for_network_idle++ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 1+ ActionMailer::Base.deliveries.clear++ # turn off updates from the template+ template_page.visit!++ page.within("[data-test-selector='notifications-button']") do+ click_on "Disable"+ end++ template_page.expect_modal "Disable email calendar updates?"+ template_page.within_modal "Disable email calendar updates?" do+ click_on "Disable email updates"+ end++ wait_for_network_idle++ expect(meeting.template.reload.notify).to be false++ # check that this is reflected for occurrences too+ occurrence_page.visit!++ page.within("[data-test-selector='notifications-button']") do+ expect(page).to have_text("Email calendar updates")+ expect(page).to have_text("Disabled.")+ expect(page).to have_text("Participants will not receive an email informing them of changes.")+ expect(page).to have_no_selector(:link_or_button, "Enable")+ expect(page).to have_text("To change this, edit the series template.")+ end++ # check that no mails are sent on deleting the series+ show_page.visit!++ show_page.delete_meeting_series+ retry_block do+ show_page.within_modal "Delete meeting series" do+ check "I understand that this deletion cannot be reversed", allow_label_click: true+ click_on "Delete permanently"+ end+ end++ wait_for_network_idle+ expect_flash(type: :success, message: "Successful deletion.")++ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 0+ end+ end++ context "when a meeting is closed" do+ let(:current_user) { user }+ let(:meeting) { create(:meeting, project:, author: current_user, notify: true, state: :closed) }+ let(:show_page) { Pages::Meetings::Show.new(meeting) }++ it "does not show the sidebar component" do+ show_page.visit!++ expect(page).to have_no_css("[data-test-selector='notifications-button']")+ end+ end++ context "for a user with no edit permissions" do+ let(:no_permissions_user) do+ create(:user,+ lastname: "Second",+ member_with_permissions: { project => %i[view_meetings manage_agendas] })+ end+ let(:current_user) { no_permissions_user }+ let(:meeting) { create(:meeting, project:, author: current_user, notify: true) }+ let(:show_page) { Pages::Meetings::Show.new(meeting) }++ before do+ login_as no_permissions_user+ end++ it "does not show the sidebar component" do+ show_page.visit!++ expect(page).to have_no_css("[data-test-selector='notifications-button']")+ end+ end+enddiff --git a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rbindex c92977a62aa..46e2d9e7b01 100644--- a/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb+++ b/modules/meeting/spec/features/structured_meetings/structured_meeting_crud_spec.rb@@ -89,10 +89,6 @@ RSpec.describe "Meetings CRUD",it "can create a meeting and add agenda items" doexpect_and_dismiss_flash(type: :success, message: "Successful creation")- # Does not send invitation mails by default- perform_enqueued_jobs- expect(ActionMailer::Base.deliveries.size).to eq 0-# Can add and edit a single itemshow_page.add_agenda_item dofill_in "Title", with: "My agenda item"@@ -309,6 +305,12 @@ RSpec.describe "Meetings CRUD",endwait_for_network_idle++ # check for email notification for the added participant+ perform_enqueued_jobs+ expect(ActionMailer::Base.deliveries.size).to eq 1+ ActionMailer::Base.deliveries.clear+retry_block doclick_on("op-meetings-header-action-trigger")click_on "Copy"@@ -316,7 +318,6 @@ RSpec.describe "Meetings CRUD",expect(page).to have_text("Copy meeting")end- check "Email participants"fill_in "Title", with: ""click_on "Create meeting"@@ -337,9 +338,9 @@ RSpec.describe "Meetings CRUD",expect(page).to have_field(id: "checkbox_invited_#{other_user.id}", checked: true)expect(page).to have_field(id: "checkbox_attended_#{other_user.id}", checked: false)- # check for email notifications+ # check for email notifications for both participantsperform_enqueued_jobs- expect(ActionMailer::Base.deliveries.size).to eq 1+ expect(ActionMailer::Base.deliveries.size).to eq 2endcontext "with a work package reference to another" dodiff --git a/modules/meeting/spec/requests/meetings_spec.rb b/modules/meeting/spec/requests/meetings_spec.rbindex f748a749818..b8e36ac9530 100644--- a/modules/meeting/spec/requests/meetings_spec.rb+++ b/modules/meeting/spec/requests/meetings_spec.rb@@ -55,46 +55,45 @@ RSpec.describe "Meeting requests",describe "copy" dolet(:base_params) do{- copied_from_meeting_id: meeting.id,project_id: project.id,meeting: {title: "Copied meeting",- type: "Meeting"+ type: "Meeting",+ copied_from_meeting_id: meeting.id}}endlet(:params) { {} }- subject do- post meetings_path(project),- params: base_params.merge(params)-- Meeting.find_by(title: "Copied meeting")- end-context "when copying agenda items" dolet!(:agenda_item) { create(:meeting_agenda_item, meeting:, notes: "**foo**") }let(:params) { { copy_agenda: "1" } }it "copies the agenda items" do- subject+ post meetings_path(project),+ params: base_params.merge(params)++ meeting = Meeting.find_by(title: "Copied meeting")expect(response).to be_redirect- expect(subject).to be_present- expect(subject.agenda_items.count).to eq(1)- expect(subject.agenda_items.first.notes).to eq("**foo**")+ expect(meeting).to be_present+ expect(meeting.agenda_items.count).to eq(1)+ expect(meeting.agenda_items.first.notes).to eq("**foo**")endenddescribe "send_notifications" do- let(:params) { { send_notifications: } }+ let(:params) { { notify: } }context "when enabled" do- let(:send_notifications) { "1" }+ let(:notify) { "1" }before do- subject+ post meetings_path(project),+ params: base_params.deep_merge(meeting: params)++ Meeting.find_by(title: "Copied meeting")perform_enqueued_jobsend@@ -104,7 +103,7 @@ RSpec.describe "Meeting requests",endcontext "when disabled" do- let(:send_notifications) { "0" }+ let(:notify) { "0" }it "sends out no emails" doexpect(ActionMailer::Base.deliveries).to be_empty@@ -114,12 +113,15 @@ RSpec.describe "Meeting requests",context "when copying without additional params" doit "copies the meeting, but not the agenda" do- subject+ post meetings_path(project),+ params: base_params.merge(params)++ meeting = Meeting.find_by(title: "Copied meeting")expect(response).to be_redirect- expect(subject).to be_present- expect(subject.agenda_items).to be_empty+ expect(meeting).to be_present+ expect(meeting.agenda_items).to be_emptyendend@@ -128,7 +130,9 @@ RSpec.describe "Meeting requests",let(:meeting) { create(:meeting, project: other_project) }it "renders a 404" do- subject+ post meetings_path(project),+ params: base_params.merge(params)+expect(response).to have_http_status(:not_found)endenddiff --git a/modules/meeting/spec/support/pages/meetings/show.rb b/modules/meeting/spec/support/pages/meetings/show.rbindex 420eef5d830..748ec33530b 100644--- a/modules/meeting/spec/support/pages/meetings/show.rb+++ b/modules/meeting/spec/support/pages/meetings/show.rb@@ -608,5 +608,11 @@ module Pages::Meetingsdef expect_notes(text)expect(page).to have_css(".op-meeting-agenda-item--notes", text:)end++ def set_start_time(time)+ input = page.find_by_id("meeting_start_time_hour")+ page.execute_script("arguments[0].value = arguments[1]", input.native, time)+ page.execute_script("arguments[0].dispatchEvent(new Event('input'))", input.native)+ endendend